oracle 11g RAC : Starting and Stopping Instances and RAC databases with srvctl and sql
==================
A. srvctl
==================
1. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
2. Stopping Instances and RAC databases with srvctl
[oracle@node1 ~]$ srvctl stop database -d node
3. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is not running on node node1
Instance node2 is not running on node node2
4. Starting Instances and RAC databases with srvctl
[oracle@node1 ~]$ srvctl start database -d node
5. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
6. Stopping Instances and RAC databases with srvctl (not all instance)
[oracle@node1 ~]$ srvctl stop instance -d node -i node2
7. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is not running on node node2
8. Starting Instances and RAC databases with srvctl (not all instance)
[oracle@node1 ~]$ srvctl start instance -d node -i node2
9. status database with srvctl
[oracle@node1 ~]$ srvctl status database -d node
Instance node1 is running on node node1
Instance node2 is running on node node2
==================
B. sql command
==================
10. status database with sql
[oracle@node1 ~]$ sqlplus system/oracle0@node1
sql> column instance_name format a10
sql> column host_name format a10
sql> column archiver format a10
sql> column status format a10
sql> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_N HOST_NAME ARCHIVER THREAD# STATUS
———- ———- ———- ———- ———-
node1 node1 STARTED 1 OPEN
node2 node2 STARTED 2 OPEN
sql> exit;
11. Stopping Instances and RAC databases with sql (not all instance, in ex : node1)
[oracle@node1 ~]$ sqlplus sys/oracle0@node1 as sysdba
sql> shutdown;
sql> exit;
[oracle@node1 ~]$
12. status database with srvctl
[oracle@node1 ~]$ sqlplus system/oracle0@node2
sql> column instance_name format a10
sql> column host_name format a10
sql> column archiver format a10
sql> column status format a10
sql> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_N HOST_NAME ARCHIVER THREAD# STATUS
———- ———- ———- ———- ———-
node2 node2 STARTED 2 OPEN
sql> exit;
[oracle@node1 ~]$
13. Starting Instances and RAC databases with sql (not all instance, in ex : node1)
[oracle@node1 ~]$ sqlplus sys/oracle0@node1 as sysdba
SQL*Plus: Release 11.1.0.6.0 – Production on Tue Sep 23 13:46:08 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
ERROR:
ORA-12521: TNS:listener does not currently know of instance requested in
connect descriptor
Enter user-name: / as sysdba
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 853716992 bytes
Fixed Size 1303244 bytes
Variable Size 557845812 bytes
Database Buffers 289406976 bytes
Redo Buffers 5160960 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@node1 ~]$
=========================================
Note use command : sqlplus / as sysdba
=========================================
ERROR:
ORA-12521: TNS:listener does not currently know of instance requested in
connect descriptor
14. status database with sql
[oracle@node1 ~]$ sqlplus system/oracle0@node2
sql> column instance_name format a10
sql> column host_name format a10
sql> column archiver format a10
sql> column status format a10
sql> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_N HOST_NAME ARCHIVER THREAD# STATUS
———- ———- ———- ———- ———-
node2 node2 STARTED 2 OPEN
node1 node1 STARTED 1 OPEN
At this point, we've installed and configured Oracle RAC 10
g entirely and have a fully functional clustered database.
After all the work done up to this point, you
may well ask, "OK, so how do I start and stop services?" If you have
followed the instructions in this guide, all services—including Oracle
Clusterware, all Oracle instances, Enterprise Manager Database Console,
and so on—should start automatically on each reboot of the Linux nodes.
There are times, however, when you might want
to shut down a node and manually start it back up. Or you may find that
Enterprise Manager is not running and need to start it. This section
provides the commands (using
SRVCTL) responsible for starting and stopping the cluster environment.
Ensure that you are logged in as the
oracle UNIX user. We will runn all commands in this section from
linux1:
# su - oracle
$ hostname
linux1
Stopping the Oracle RAC 10g Environment
The first step is to stop the Oracle instance.
When the instance (and related services) is down, then bring down the
ASM instance. Finally, shut down the node applications (Virtual IP, GSD,
TNS Listener, and ONS).
$ export ORACLE_SID=orcl1
$ emctl stop dbconsole
$ srvctl stop instance -d orcl -i orcl1
$ srvctl stop asm -n linux1
$ srvctl stop nodeapps -n linux1
Starting the Oracle RAC 10g Environment
The first step is to start the node
applications (Virtual IP, GSD, TNS Listener, and ONS). When the node
applications are successfully started, then bring up the ASM instance.
Finally, bring up the Oracle instance (and related services) and the
Enterprise Manager Database console.
$ export ORACLE_SID=orcl1
$ srvctl start nodeapps -n linux1
$ srvctl start asm -n linux1
$ srvctl start instance -d orcl -i orcl1
$ emctl start dbconsole
Start/Stop All Instances with SRVCTL
Shutdown RAC Database Instances on all nodes: Suppose DBA has two node RAC database,
So he has to stop all instances from all DB nodes. Here,
I am taking an example of two node RAC. First,
I am checking on which server database is running and then stopping and verify for the same.
Syntax: srvctl stop database -d {databasename-Airtel}
[oracle@node2 ~]$ srvctl status database -d Airtel
Instance Airtel1 is running on node node1
Instance Airtel2 is running on node node2
[oracle@node2 ~]$ srvctl stop database -d Airtel
[oracle@node2 ~]$ srvctl status database -d Airtel
Instance Airtel1 is not running on node node1
Instance Airtel2 is not running on node node2
Start/stop all the instances and their enabled
services. I have included this step just for fun as a way to bring down
all instances!
$ srvctl start database -d orcl
$ srvctl stop database -d orcl
Checking CRS Status
crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
srvctl status nodeapps
VIP tzdev1vip is enabled
VIP tzdev1vip is running on node: tzdev1rac
VIP tzdev2vip is enabled
VIP tzdev2vip is running on node: tzdev2rac
Network is enabled
Network is running on node: tzdev1rac
Network is running on node: tzdev2rac
GSD is disabled
GSD is not running on node: tzdev1rac
GSD is not running on node: tzdev2rac
ONS is enabled
ONS daemon is running on node: tzdev1rac
ONS daemon is running on node: tzdev2rac
eONS is enabled
eONS daemon is running on node: tzdev1rac
eONS daemon is running on node: tzdev2rac
Clusterware Resource Status Check
$ crsctl status
resource -t
--------------------------------------------------------------
NAME
TARGET STATE SERVER
STATE_DETAILS
-------------------------------------------------------------
Local Resources
---------------------------------------------------------------
ora.LISTENER.lsnr
ONLINE ONLINE tzdev1rac
ONLINE ONLINE tzdev2rac
ora.asm
OFFLINE OFFLINE tzdev1rac
OFFLINE OFFLINE tzdev2rac
ora.eons
ONLINE ONLINE tzdev1rac
ONLINE ONLINE tzdev2rac
ora.gsd
OFFLINE OFFLINE tzdev1rac
OFFLINE OFFLINE tzdev2rac
ora.net1.network
ONLINE ONLINE tzdev1rac
ONLINE ONLINE tzdev2rac
ora.ons
ONLINE ONLINE tzdev1rac
ONLINE ONLINE tzdev2rac
-----------------------------------------------------------------
Cluster Resources
------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1
ONLINE ONLINE tzdev1rac
ora.LISTENER_SCAN2.lsnr
1
ONLINE ONLINE tzdev2rac
ora.LISTENER_SCAN3.lsnr
1
ONLINE ONLINE tzdev2rac
ora.oc4j
1
OFFLINE OFFLINE
ora.scan1.vip
1
ONLINE ONLINE tzdev1rac
ora.scan2.vip
1
ONLINE ONLINE tzdev2rac
ora.scan3.vip
1
ONLINE ONLINE tzdev2rac
ora.trezor.db
1
ONLINE ONLINE tzdev1rac
Open
2
ONLINE ONLINE tzdev2rac
ora.tzdev1rac.vip
1
ONLINE ONLINE tzdev1rac
ora.tzdev2rac.vip
1
ONLINE ONLINE tzdev2rac
Stop the Oracle clusterware stack
crsctl stop crs or you can run
crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed
resources on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.crsd' on 'tzdev1rac'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources
on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN2.lsnr' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.trezor.db' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN3.lsnr' on 'tzdev1rac'
CRS-2677: Stop of 'ora.LISTENER_SCAN2.lsnr' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.scan2.vip' on 'tzdev1rac'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.tzdev1rac.vip' on 'tzdev1rac'
CRS-2677: Stop of 'ora.LISTENER_SCAN3.lsnr' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.scan3.vip' on 'tzdev1rac'
CRS-2677: Stop of 'ora.tzdev1rac.vip' on 'tzdev1rac' succeeded
CRS-2672: Attempting to start 'ora.tzdev1rac.vip' on 'tzdev2rac'
CRS-2677: Stop of 'ora.scan2.vip' on 'tzdev1rac' succeeded
CRS-2672: Attempting to start 'ora.scan2.vip' on 'tzdev2rac'
CRS-2677: Stop of 'ora.scan3.vip' on 'tzdev1rac' succeeded
CRS-2672: Attempting to start 'ora.scan3.vip' on 'tzdev2rac'
CRS-2676: Start of 'ora.tzdev1rac.vip' on 'tzdev2rac' succeeded
CRS-2677: Stop of 'ora.trezor.db' on 'tzdev1rac' succeeded
CRS-2676: Start of 'ora.scan2.vip' on 'tzdev2rac' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN2.lsnr' on 'tzdev2rac'
CRS-2676: Start of 'ora.scan3.vip' on 'tzdev2rac' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN3.lsnr' on 'tzdev2rac'
CRS-2676: Start of 'ora.LISTENER_SCAN2.lsnr' on 'tzdev2rac' succeeded
CRS-2676: Start of 'ora.LISTENER_SCAN3.lsnr' on 'tzdev2rac' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.eons' on 'tzdev1rac'
CRS-2677: Stop of 'ora.ons' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'tzdev1rac'
CRS-2677: Stop of 'ora.net1.network' on 'tzdev1rac' succeeded
CRS-2677: Stop of 'ora.eons' on 'tzdev1rac' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on
'tzdev1rac' has completed
CRS-2677: Stop of 'ora.crsd' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.ctssd' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.evmd' on 'tzdev1rac'
CRS-2677: Stop of 'ora.cssdmonitor' on 'tzdev1rac' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'tzdev1rac' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'tzdev1rac' succeeded
CRS-2677: Stop of 'ora.evmd' on 'tzdev1rac' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'tzdev1rac'
CRS-2677: Stop of 'ora.cssd' on 'tzdev1rac' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'tzdev1rac'
CRS-2673: Attempting to stop 'ora.gipcd' on 'tzdev1rac'
CRS-2677: Stop of 'ora.gipcd' on 'tzdev1rac' succeeded
CRS-2677: Stop of 'ora.diskmon' on 'tzdev1rac' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed
resources on 'tzdev1rac' has completed
CRS-4133: Oracle High Availability Services has been stopped.
Start the Oracle clusterware stack
crsctl start crs or you can run
crsctl start has
CRS-4123: Oracle High Availability Services has been started.
Start the Oracle Database
To start all Oracle RAC instances for a database, enter the
following command, where db_name is the name of the database:
$ oracle_home/bin/srvctl
start database -d db_name
(this command is starting all the instances)
Stop the Oracle Database
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
(this command is starting all the instances)