• No results found

Manage Services (continued)

In document Oracle 11g RAC Student Guide Volume 2 (Page 150-159)

Practices for Lesson 7

Practice 7-1: Manage Services (continued)

/u01/crs11g/bin/crs_stat

/u01/crs11g/bin/srvctl status service -d $DBNAME -s SERV1 [oracle@vx0306 less07]$

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

Oracle Database 11g: RAC Administration A - 57 NAME=ora.vx0306.vip

Service SERV1 is running on instance(s) RDB1 [oracle@vx0306 less07]$

3) Add SERV1 to the tnsnames.ora files on both nodes to both oracle homes. When you are finished, make sure listeners are aware of its existence.

[oracle@vx0306 less07]$ cat sol_07_01_03.sh

#!/bin/ksh

y=`cat /home/oracle/nodeinfo | sed -n '1,1p'`

z=`cat /home/oracle/nodeinfo | sed -n '2,2p'`

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

ssh $z "cat /home/oracle/solutions/less07/tnsserv1.ora >>

/u01/app/oracle/product/11.1.0/db_1/network/admin/tnsnames.ora

"

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

Oracle Database 11g: RAC Administration A - 59

/u01/app/oracle/product/11.1.0/asm_1/bin/lsnrctl services | grep SERV1

[oracle@vx0306 less07]$

[oracle@vx0306 less07]$ cat wrong_tnsserv1.ora SERV1 =

Service "SERV1" has 1 instance(s).

[oracle@vx0306 less07]$

4) Connect as SYSTEM under each instance and look at the current value of the SERVICE_NAMES initialization parameter, and check that it is set correctly.

[oracle@vx0306 less07]$ cat sol_07_01_04.sh

#!/bin/ksh

y=`cat /home/oracle/nodeinfo | sed -n '1,1p'`

z=`cat /home/oracle/nodeinfo | sed -n '2,2p'`

DBNAME=`ps -ef | grep dbw0_RDB | grep -v grep | grep -v callout1 | awk '{ print $8 }' | sed 's/1/''/' | sed 's/ora_dbw0_/''/'`

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

I1NAME=$DBNAME"1"

I2NAME=$DBNAME"2"

export ORACLE_SID=$I1NAME

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1

$ORACLE_HOME/bin/sqlplus -s /NOLOG <<EOF

set echo on

connect system/oracle1@$I1NAME

select instance_name from v\$instance;

show parameter service

connect system/oracle1@$I2NAME

select instance_name from v\$instance;

show parameter service EOF

[oracle@vx0306 less07]$

[oracle@vx0306 less07]$ ./sol_07_01_04.sh

INSTANCE_NAME --- RDB1

NAME TYPE VALUE

--- --- ---

service_names string SERV1, RDB

INSTANCE_NAME --- RDB2

NAME TYPE VALUE

--- --- ---

service_names string RDB [oracle@vx0306 less07]$

5) Using Grid Control, how can you check that SERV1 service is currently running as expected?

a) If you are still connected to your previous Enterprise Manager session, you should

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

Oracle Database 11g: RAC Administration A - 61

b) If not, connect as user SYS in Database Control. On the Cluster Home page, click the Availability tab. On the Availability page, click the Cluster Managed

Database Services link in the Services section. On the Cluster and Database Login page, click Continue.

c) On the Cluster Managed Database Services page, you should see SERV1 up and running on the first instance only.

d) On the Cluster Managed Database Services page, click the SERV1 link.

e) On the SERV1 page, you should see that SERV1 is running on the first instance and is down on the second instance.

6) Using a telnet session connected as user oracle to the first node, execute the sol_07_01_06_a.sh script. This script monitors events happening inside Oracle Clusterware. From a second terminal window as user oracle, kill the SMON process of the first instance (RDB1 in this example). Observe the sequence of events in the first session. When the first instance is back, look at the SERVICE_NAMES initialization parameter values on both instances. What do you observe? When you are finished, enter Ctrl + C in the first window to stop event monitoring.

a) Immediately after the SMON process is killed, Oracle Clusterware automatically moves the SERV1 service to its available instance RDB2 (in this example).

Although Oracle Clusterware also restarts RDB1, SERV1 does not fall back to RDB1.

b) Here is what you should see in the first session:

[oracle@vx0306 less07]$ cat sol_07_01_06_a.sh

#!/bin/ksh

/u01/crs11g/bin/evmwatch -A -t "@timestamp @@"

[oracle@vx0306 less07]$

[oracle@vx0306 less07]$ ./sol_07_01_06_a.sh

"14-Nov-2007 09:41:42 RAC: ora.vx0306.ASM1.asm: imcheck: "

"14-Nov-2007 09:41:42 RAC: ora.vx0306.ASM1.asm: imup: "

"14-Nov-2007 09:43:19 RAC: ora.RDB.RDB1.inst: imcheck: "

"14-Nov-2007 09:43:19 RAC: ora.RDB.RDB1.inst: imup: "

"14-Nov-2007 09:44:59 CRS is requested to perform action fail on resource ora.RDB.RDB1.inst by Instance Monitor"

"14-Nov-2007 09:44:59 CRS ora.RDB.RDB1.inst is transitioning from state ONLINE to state OFFLINE on member vx0306"

"14-Nov-2007 09:44:59 RAC: ora.RDB.RDB1.inst: down: "

"14-Nov-2007 09:44:59 CRS is requested to perform action fail on resource ora.RDB.SERV1.RDB1.srv by ora.RDB.RDB1.inst"

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

"14-Nov-2007 09:44:59 CRS ora.RDB.SERV1.RDB1.srv is

transitioning from state ONLINE to state OFFLINE on member vx0306"

"14-Nov-2007 09:44:59 RAC: ora.RDB.SERV1.RDB1.srv: down: "

"14-Nov-2007 09:44:59 CRS ora.RDB.SERV1.RDB1.srv stopped"

"14-Nov-2007 09:44:59 CRS ora.RDB.SERV1.RDB1.srv is

transitioning from state OFFLINE to state ONLINE on member vx0313"

"14-Nov-2007 09:44:05 RAC: ora.RDB.SERV1.RDB1.srv: up: "

"14-Nov-2007 09:45:01 CRS ora.RDB.SERV1.RDB1.srv started on member vx0313"

"14-Nov-2007 09:44:05 CRS ora.RDB.SERV1.RDB1.srv was modified"

"14-Nov-2007 09:45:06 RAC: ora.RDB.RDB1.inst: imstop: "

"14-Nov-2007 09:45:06 CRS ora.RDB.RDB1.inst stopped"

"14-Nov-2007 09:45:06 CRS ora.RDB.RDB1.inst is transitioning from state OFFLINE to state ONLINE on member vx0306"

"14-Nov-2007 09:45:06 CRS is requested to perform action check on resource ora.RDB.db by ora.RDB.RDB1.inst"

"14-Nov-2007 09:45:14 CRS is requested to perform action check on resource ora.RDB.SERV1.cs by ora.RDB.SERV1.RDB1.srv"

"14-Nov-2007 09:45:14 CRS ora.RDB.SERV1.RDB1.srv was modified"

"14-Nov-2007 09:44:47 RAC: ora.RDB.RDB2.inst: imcheck: "

"14-Nov-2007 09:44:47 RAC: ora.RDB.RDB2.inst: imup: "

"14-Nov-2007 09:45:45 RAC: ora.RDB.RDB1.inst: up: "

"14-Nov-2007 09:45:45 RAC: ora.RDB.RDB1.inst: imstop: "

"14-Nov-2007 09:45:45 RAC: ora.RDB.RDB1.inst: imcheck: "

"14-Nov-2007 09:45:45 CRS ora.RDB.SERV1.RDB1.srv was modified"

"14-Nov-2007 09:45:45 CRS ora.RDB.RDB1.inst started on member vx0306"

"14-Nov-2007 09:45:08 RAC: ora.vx0313.ASM2.asm: imcheck: "

"14-Nov-2007 09:45:08 RAC: ora.vx0313.ASM2.asm: imup: "

"14-Nov-2007 09:46:42 RAC: ora.vx0306.ASM1.asm: imcheck: "

"14-Nov-2007 09:46:42 RAC: ora.vx0306.ASM1.asm: imup: "

c) Here is what you should see in the second session:

[oracle@vx0306 less07]$ cat sol_07_01_06_b.sh

#!/bin/ksh

y=`cat /home/oracle/nodeinfo | sed -n '1,1p'`

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

Oracle Database 11g: RAC Administration A - 63 I1NAME=$DBNAME"1"

I2NAME=$DBNAME"2"

export ORACLE_SID=$I1NAME

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 /u01/crs11g/bin/srvctl status database -d $DBNAME

ps -ef | grep "ora_smon_$I1NAME" | grep -v grep | grep -v killsmon | awk '{print "kill -9 " $2 }' >

/home/oracle/solutions/less07/z.sh

chmod 777 /home/oracle/solutions/less07/z.sh

echo "Killing smon..."

/home/oracle/solutions/less07/z.sh echo "waiting for instance back ..."

sleep 120

export ORACLE_SID=$I1NAME

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1

$ORACLE_HOME/bin/sqlplus -s /NOLOG <<EOF connect system/oracle1@$I1NAME

select instance_name from v\$instance;

show parameter service

connect system/oracle1@$I2NAME

select instance_name from v\$instance;

show parameter service EOF

[oracle@vx0306 less07]$

[oracle@vx0306 less07]$ ./sol_07_01_06_b.sh Instance RDB1 is running on node vx0306 Instance RDB2 is running on node vx0313 Killing smon...

waiting for instance back ...

INSTANCE_NAME --- RDB1

NAME TYPE VALUE

Oracle Internal & Or acle Academy Use Only

Practice 7-1: Manage Services (continued)

--- --- ---

service_names string RDB INSTANCE_NAME

--- RDB2

NAME TYPE VALUE

--- --- ---

service_names string SERV1, RDB [oracle@vx0306 less07]$

7) Using Grid Control, check that SERV1 is running on RDB2.

a) Connect as user SYS in Database Control. On the Cluster Home page, click the Availability tab. On the Availability page, click the Cluster Managed Database Services link in the Services section. On the Cluster and Database Login page, click Continue.

b) On the Cluster Managed Database Services page, you should see SERV1 up and running on the second instance only with a warning.

c) On Cluster Managed Database Services page, click the SERV1 link.

d) On the SERV1 page, you should see that SERV1 is stopped on the preferred instance and up on the available instance.

Oracle Internal & Or acle Academy Use Only

Oracle Database 11g: RAC Administration A - 65

In document Oracle 11g RAC Student Guide Volume 2 (Page 150-159)