1. START / STOP CLUSTERWARE CRS:
To start and stop CRS when the machine starts or shutdown, on unix there are rc scripts in place.
/etc/init.d/init.crs start
/etc/init.d/init.crs stop
/etc/init.d/init.crs enable
/etc/init.d/init.crs disable
You can also, as root, manually start, stop, enable or disable the services with:
# crsctl start crs
# crsctl stop crs
# crsctl enable crs
# crsctl disable crs
On a unix system, you may find the following in the /etc/inittab file.
# cat /etc/inittab | grep crs
h3:35:respawn:/etc/init.d/init.crsd run > /dev/null 2>&1 </dev/null
# cat /etc/inittab | grep evmd
h1:35:respawn:/etc/init.d/init.evmd run > /dev/null 2>&1 </dev/null
# cat /etc/inittab | grep css
h2:35:respawn:/etc/init.d/init.cssd fatal > /dev/null 2>&1 </dev/null
/etc/init.d> ls -al *init*
init.crs
init.crsd
init.cssd
init.evmd
# cat /etc/inittab
..
..
h1:35:respawn:/etc/init.d/init.evmd run > /dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal > /dev/null 2>&1 </dev/null
h3:35:respawn:/etc/init.d/init.crsd run > /dev/null 2>&1 </dev/null
===================================
2. STARTING / STOPPING THE CLUSTER:
===================================
-- Stopping the Cluster:
Before you shut down any processes that are monitored by Enterprise Manager Grid Control, set a blackout in
Grid Control for the processes that you intend to shut down. This is necessary so that the availability records
for these processes indicate that the shutdown was planned downtime, rather than an unplanned system outage.
Shut down all Oracle RAC instances on all nodes. To shut down all Oracle RAC instances for a database,
enter the following command, where db_name is the name of the database:
$ ORACLE_HOME/bin/srvctl stop database -d db_name
Shut down all ASM instances on all nodes. To shut down an ASM instance, enter the following command,
where node is the name of the node where the ASM instance is running:
$ ORACLE_HOME/bin/srvctl stop asm -n node
Stop all node applications on all nodes. To stop node applications running on a node, enter the following command,
where node is the name of the node where the applications are running
$ ORACLE_HOME/bin/srvctl stop nodeapps -n node
Log in as the root user, and shut down the Oracle Clusterware or CRS process by entering the following command
on all nodes:
# CRS_HOME/bin/crsctl stop crs # as root
----- Starting the Cluster:
# CRS_HOME/bin/crsctl start crs # as root
$ ORACLE_HOME/bin/srvctl start nodeapps -n node
$ ORACLE_HOME/bin/srvctl start asm -n node
$ ORACLE_HOME/bin/srvctl start database -d db_name # will start all instances of the Database
================================================
3. CRS_STAT -t command OR SRVCTL STATUS command:
================================================
CRS_STAT example:
-----------------
Viewing the status of instances, database, nodeapps:
For example, to list the status of the apps in the cluster, use crs_stat:
/home/oracle-->$CRS_HOME/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE aix1
ora....x1.lsnr application ONLINE ONLINE aix1
ora....ix1.gsd application ONLINE ONLINE aix1
ora....ix1.ons application ONLINE ONLINE aix1
ora....ix1.vip application ONLINE ONLINE aix1
ora....SM2.asm application ONLINE ONLINE aix2
ora....x2.lsnr application ONLINE ONLINE aix2
ora....ix2.gsd application ONLINE ONLINE aix2
ora....ix2.ons application ONLINE ONLINE aix2
ora....ix2.vip application ONLINE ONLINE aix2
ora....test.db application ONLINE ONLINE aix1
ora....x1.inst application ONLINE ONLINE aix1
ora....x2.inst application ONLINE ONLINE aix2
/home/oracle-->
SRVCTL example:
---------------
$ srvctl status nodeapps -n mynewserver
VIP is running on node: mynewserver
GSD is running on node: mynewserver
Listener is not running on node: mynewserver
ONS daemon is running on node: mynewserver
CRSCTL example:
---------------
Checking crs on the node:
# crsctl check crs
Cluster Synchronization Services appears healthy
Cluster Ready Services appears healthy
Event Manager appears healthy
Checking crs clusterwide:
crsctl check cluster
# crsctl check cluster
node1-pub ONLINE
node2-pub ONLINE
===================
4. OTHER EXAMPLES:
===================
Example 1. Bring up the MYSID1 instance of the MYSID database.
$ srvctl start instance -d MYSID -i MYSID1
Example 2. Stop the MYSID database: all its instances and all its services, on all nodes.
$ srvctl stop database -d MYSID
Example 3. Stop the nodeapps on the myserver node. NB: Instances and services also stop.
$ srvctl stop nodeapps -n myserver
Example 4. Add the MYSID3 instance, which runs on the myserver node, to the MYSID
clustered database.
$ srvctl add instance -d MYSID -i MYSID3 -n myserver
Example 4. Add a new node, the mynewserver node, to a cluster.
$ srvctl add nodeapps -n mynewserver -o $ORACLE_HOME -A 10.10.10.100/255.255.255.0/eth1
(The -A flag precedes an address specification.)
srvctl add database -d drpdb -o $ORACLE_HOME -m local -p "+DATA/drpdb/spfiledrpdb.ora" -n drpdb1
$GIRD_HOME/bin/srvctl add database -d rac11g2s -o $ORACLE_HOME -m local -p "+DATA/rac11g2s/spfilerac11g2s.ora" -n rac11g2 -r physical_standby -
$GIRD_HOME/bin/
srvctl add instance -d rac11g2s -i rac11g2s1 -n rac4b
srvctl add database -d rac11g2s -o $ORACLE_HOME -m local -p "+DATA/rac11g2s/spfilerac11g2s.ora" -n rac11g2 -r physical_standby -s mount
each instance must be started on read only mode if all of them are used for read only application. On rac4b
SQL>
---------------------------------------------------------------------------------------------------------------
Modification on 19 Dec 2013 Thursday in NBL:
drpdb1:
Add Database to Cluster:
$oracle_home/bin/srvctl add database -d drpdb -o $ORACLE_HOME -m local -p "+DATA/drpdb/spfiledrpdb.ora" -n dcpdb -r physical_standby
$oracle_home/bin/srvctl add instance -d drpdb -i drpdb1 -n drpdb1
Drpdb1:
Modify ASM:
$GRID_HOME/bin/srvctl modify instance -d drpdb -i drpdb1 -s +ASM1
srvctl modify instance -d rac11g2s -i rac11g2s1 -s +ASM1
drpdb:
Start Standby Database drpdb:
$GRID_HOME/bin/srvctl status database -d drpdb
$GRID_HOME/bin/srvctl start database -d drpdb
srvctl config database -d drpdb
drpdb1:
Remove Database:
$ORACLE_HOME/bin/srvctl remove instance -d drpdb -i drpdb1
$ORACLE_HOME/bin/srvctl remove database -d drpdb
drpdb1:
Remove Listener from Cluster:
$GRID_HOME/bin/srvctl remove listener -n drpdb1 -l listenerdb
drpdb1:
Start Standby Database drpdb:
$GRID_HOME/bin/srvctl status database -d drpdb
$GRID_HOME/bin/srvctl start database -d drpdb
drpdb1:
Show Configuration of standby Database drpdb:
$GRID_HOME/bin/srvctl config database -d drpdb
Drpdb1:
Scan Listener Status:
$GRID_HOME/bin/srvctl status scan_listener
dcpdb1:
oracle@dcpdb1 [/home/oracle]$ emctl status dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.
oracle@dcpdb1 [/home/oracle]$ export ORACLE_UNQNAME=dcpdb
oracle@dcpdb1 [/home/oracle]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://dcpdb1:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is not running.
------------------------------------------------------------------
Logs are generated in directory /u02/app/oracle/product/11.2.0.4/dbhome_1/dcpdb1_dcpdb/sysman/log
oracle@dcpdb1 [/home/oracle]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://dcpdb1:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ........... started.
------------------------------------------------------------------
Logs are generated in directory /u02/app/oracle/product/11.2.0.4/dbhome_1/dcpdb1_dcpdb/sysman/log
oracle@dcpdb1 [/home/oracle]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://dcpdb1:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u02/app/oracle/product/11.2.0.4/dbhome_1/dcpdb1_dcpdb/sysman/log
oracle@dcpdb1 [/home/oracle]$
Modification finished on 19 Dec 2013 Thursday in NBL:
-------------------------------------------------------------------
srvctl remove listener -n dcpdb1 -l listenerdb
srvctl remove listener -n dcpdb2 -l listenerdb
-----------------
grid@drpdb1 [/u01/app/11.2.0.4/grid/bin]$ srvctl status database -d drpdb
Instance drpdb1 is not running on node drpdb1
grid@drpdb1 [/u01/app/11.2.0.4/grid/bin]$ srvctl start database -d drpdb
grid@drpdb1 [/u01/app/11.2.0.4/grid/bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE drpdb1
ora.FRA.dg ora....up.type ONLINE ONLINE drpdb1
ora....ER.lsnr ora....er.type ONLINE ONLINE drpdb1
ora....BA.lsnr ora....er.type ONLINE ONLINE drpdb1
ora....N1.lsnr ora....er.type ONLINE ONLINE drpdb1
ora.OCR.dg ora....up.type ONLINE ONLINE drpdb1
ora.VOTING.dg ora....up.type ONLINE ONLINE drpdb1
ora.asm ora.asm.type ONLINE ONLINE drpdb1
ora.cvu ora.cvu.type ONLINE ONLINE drpdb1
ora.drpdb.db ora....se.type ONLINE ONLINE drpdb1
ora....SM1.asm application ONLINE ONLINE drpdb1
ora....B1.lsnr application ONLINE ONLINE drpdb1
ora....B1.lsnr application ONLINE ONLINE drpdb1
ora.drpdb1.gsd application ONLINE OFFLINE
ora.drpdb1.ons application ONLINE ONLINE drpdb1
ora.drpdb1.vip ora....t1.type ONLINE ONLINE drpdb1
ora.gsd ora.gsd.type ONLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE drpdb1
ora.oc4j ora.oc4j.type ONLINE ONLINE drpdb1
ora.ons ora.ons.type ONLINE ONLINE drpdb1
ora.scan1.vip ora....ip.type ONLINE ONLINE drpdb1
grid@drpdb1 [/u01/app/11.2.0.4/grid/bin]$
-------------------
Example 5. To change the VIP (virtual IP) on a RAC node, use the command
$ srvctl modify nodeapps -A new_address
Example 6. Disable the ASM instance on myserver for maintenance.
$ srvctl disable asm -n myserver
Some other examples:
--------------------
$ srvctl add instance -d -i -n
$ srvctl add service -d -s -r “” [-a ""] [-P ]
$ srvctl add service -d -s -u {-r “” | -a “”}
$ srvctl add nodeapps -n -o -A /netmask[/if1[|if2|...]]
$ srvctl add asm -n -i -o [-p ]
$ srvctl config database
$ srvctl config database -d [-a] [-t]
$ srvctl config service -d [-s ] [-a] [-S ]
$ srvctl config nodeapps -n [-a] [-g] [-o] [-s] [-l]
$ srvctl config asm -n
$ srvctl config listener -n drpdb1
$ srvctl disable database -d
$ srvctl disable instance -d -i “”
$ srvctl disable service -d -s “” [-i ]
$ srvctl disable asm -n [-i ]
$ srvctl enable database -d
$ srvctl enable instance -d -i “”
$ srvctl enable service -d -s “” [-i ]
$ srvctl enable asm -n [-i ]
$ srvctl getenv database -d [-t ""]
$ srvctl getenv instance -d -i [-t ""]
$ srvctl getenv service -d -s [-t ""]
$ srvctl getenv nodeapps -n [-t ""]
$ srvctl modify database -d [-n <db_name] [-o ] [-m ] [-p ] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}] [-s ] [-y {AUTOMATIC | MANUAL}]
$ srvctl modify instance -d -i -n
$ srvctl modify instance -d -i {-s | -r}
$ srvctl modify service -d -s -i -t [-f]
$ srvctl modify service -d -s -i -r [-f]
$ srvctl modify service -d -s -n -i [-a ] [-f]
$ srvctl modify asm -n -i [-o ] [-p ]
$ srvctl relocate service -d -s -i -t [-f]
$ srvctl remove database -d [-f]
$ srvctl remove instance -d -i [-f]
$ srvctl remove service -d -s [-i ] [-f]
$ srvctl remove nodeapps -n “” [-f]
$ srvctl remove asm -n [-i ] [-f]
$ srvctl setenv database -d {-t =[,=,...] | -T =}
$ srvctl setenv instance -d [-i ] {-t “=[,=,...]” | -T “=”}
$ srvctl setenv service -d [-s ] {-t “=[,=,...]” | -T “=”}
$ srvctl setenv nodeapps -n {-t “=[,=,...]” | -T “=”}
$ srvctl start database -d [-o ] [-c | -q]
$ srvctl start instance -d -i “” [-o ] [-c | -q]
$ srvctl start service -d [-s "" [-i ]] [-o ] [-c | -q]
$ srvctl start nodeapps -n
$ srvctl start asm -n [-i ] [-o ] [-c | -q]
$ srvctl start listener -n [-l ]
$ srvctl status database -d [-f] [-v] [-S ]
$ srvctl status instance -d -i “” [-f] [-v] [-S ]
$ srvctl status service -d [-s ""] [-f] [-v] [-S ]
$ srvctl status nodeapps -n
$ srvctl status asm -n
$ srvctl stop database -d [-o ] [-c | -q]
$ srvctl stop instance -d -i “” [-o ] [-c | -q]
$ srvctl stop service -d [-s "" [-i ]] [-c | -q] [-f]
$ srvctl stop nodeapps -n
$ srvctl stop asm -n [-i ] [-o ] [-c | -q]
$ srvctl stop listener -n [-l ]
$ srvctl unsetenv database -d -t “”
$ srvctl unsetenv instance -d [-i ] -t “”
$ srvctl unsetenv service -d [-s ] -t “”
$ srvctl unsetenv nodeapps -n -t “”
No comments:
Post a Comment