To start and stop database in all nodes with single command
=======================================================================================
[oracle@rtmrac1 ~]$ ps -ef|grep smon
oracle 2845 1 0 08:44 ? 00:00:00 asm_smon_+ASM1
root 2907 1 2 08:44 ? 00:00:12 /u01/app/12.1.0/grid/bin/osysmond.bin
oracle 10556 1 0 08:48 ? 00:00:00 ora_smon_orcl1
[oracle@rtmrac1 ~]$ . oraenv
ORACLE_SID = [orcl1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl stop database -d orcl
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node rtmrac1
Instance orcl2 is not running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl start database -d orcl
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
=============================================================
To stop/start database instance in one node:
=======================================================================
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl stop instance -i orcl2 -d orcl
[oracle@rtmrac2 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is not running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl start instance -i orcl2 -d orcl
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
stop/start ASM instance in one instance.
srvctl stop asm -n <node_name>
--to stop with force
srvctl stop asm -n <node_name> -f
--starting ASM instance
srvctl start asm -n <node name>
=================================================================================
To stop ASM in one node: Example
=================================================================================
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 2367 1 0 08:44 ? 00:00:00 asm_pmon_+ASM2
oracle 22998 1 0 09:14 ? 00:00:00 ora_pmon_orcl2
oracle 24664 24610 0 09:16 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM2
The Oracle base has been set to /u01/app/oracle
[oracle@rtmrac2 ~]$ srvctl stop instance -i orcl2 -d orcl
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 2367 1 0 08:44 ? 00:00:00 asm_pmon_+ASM2
oracle 25367 24610 0 09:19 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is not running on node rtmrac2
[oracle@rtmrac2 ~]$ srvctl status asm
ASM is running on rtmrac2,rtmrac1
[oracle@rtmrac2 ~]$ srvctl stop asm -n rtmrac2
PRCR-1014 : Failed to stop resource ora.asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2529: Unable to act on 'ora.asm' because that would require stopping or relocating 'ora.DATA.dg', but the force option was not specified
[oracle@rtmrac2 ~]$ srvctl stop asm -n rtmrac2 -f
[oracle@rtmrac2 ~]$ srvctl status asm
ASM is running on rtmrac1
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 26471 24610 0 09:21 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ srvctl start asm -n rtmrac2
[oracle@rtmrac2 ~]$ srvctl status asm
ASM is running on rtmrac2,rtmrac1
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 27242 1 0 09:24 ? 00:00:00 asm_pmon_+ASM2
oracle 27400 24610 0 09:24 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ srvctl start instance -i orcl2 -d orcl
[oracle@rtmrac2 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
----if you get error as bellow while starting ASM
[oracle@SDBORN21 ~]$ srvctl start asm -n SDBORN21
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd
----follow as bellow
crsctl stat res -t -init
----check ora.asm and ora.crsd are OFFLINE
crsctl start res ora.asm -init
crsctl start res ora.crsd -init
----if above commands succeeded then ASM must be up
ps -ef|grep pmon
----start database instance
srvctl start instance -i <instance_name> -d <database_name>
------------------------------------------------------------
If you want to add database to HA(grid instrastructure):
------------------------------------------------------------
ex:
srvctl add database -d orcl -o /opt/oracle/product/12.2.0.1/dbhome_1 -p +DATA//PARAMETERFILE/spfile.644.1041511849
------------------------------------------------------------
modify the database startup option (mount/open).
-----------------------------------------------------------
if you set mount, if server is restarted database will open in mount mode.
srvctl modify database -db ORCL -startoption MOUNT
=======================================================================================
[oracle@rtmrac1 ~]$ ps -ef|grep smon
oracle 2845 1 0 08:44 ? 00:00:00 asm_smon_+ASM1
root 2907 1 2 08:44 ? 00:00:12 /u01/app/12.1.0/grid/bin/osysmond.bin
oracle 10556 1 0 08:48 ? 00:00:00 ora_smon_orcl1
[oracle@rtmrac1 ~]$ . oraenv
ORACLE_SID = [orcl1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl stop database -d orcl
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node rtmrac1
Instance orcl2 is not running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl start database -d orcl
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
=============================================================
To stop/start database instance in one node:
=======================================================================
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl stop instance -i orcl2 -d orcl
[oracle@rtmrac2 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is not running on node rtmrac2
[oracle@rtmrac1 ~]$ srvctl start instance -i orcl2 -d orcl
[oracle@rtmrac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
srvctl stop asm -n <node_name>
--to stop with force
srvctl stop asm -n <node_name> -f
--starting ASM instance
srvctl start asm -n <node name>
=================================================================================
To stop ASM in one node: Example
=================================================================================
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 2367 1 0 08:44 ? 00:00:00 asm_pmon_+ASM2
oracle 22998 1 0 09:14 ? 00:00:00 ora_pmon_orcl2
oracle 24664 24610 0 09:16 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM2
The Oracle base has been set to /u01/app/oracle
[oracle@rtmrac2 ~]$ srvctl stop instance -i orcl2 -d orcl
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 2367 1 0 08:44 ? 00:00:00 asm_pmon_+ASM2
oracle 25367 24610 0 09:19 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is not running on node rtmrac2
[oracle@rtmrac2 ~]$ srvctl status asm
ASM is running on rtmrac2,rtmrac1
[oracle@rtmrac2 ~]$ srvctl stop asm -n rtmrac2
PRCR-1014 : Failed to stop resource ora.asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2529: Unable to act on 'ora.asm' because that would require stopping or relocating 'ora.DATA.dg', but the force option was not specified
[oracle@rtmrac2 ~]$ srvctl stop asm -n rtmrac2 -f
[oracle@rtmrac2 ~]$ srvctl status asm
ASM is running on rtmrac1
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 26471 24610 0 09:21 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ srvctl start asm -n rtmrac2
[oracle@rtmrac2 ~]$ srvctl status asm
ASM is running on rtmrac2,rtmrac1
[oracle@rtmrac2 ~]$ ps -ef|grep pmon
oracle 27242 1 0 09:24 ? 00:00:00 asm_pmon_+ASM2
oracle 27400 24610 0 09:24 pts/1 00:00:00 grep --color=auto pmon
[oracle@rtmrac2 ~]$ srvctl start instance -i orcl2 -d orcl
[oracle@rtmrac2 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rtmrac1
Instance orcl2 is running on node rtmrac2
----if you get error as bellow while starting ASM
[oracle@SDBORN21 ~]$ srvctl start asm -n SDBORN21
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd
----follow as bellow
crsctl stat res -t -init
----check ora.asm and ora.crsd are OFFLINE
crsctl start res ora.asm -init
crsctl start res ora.crsd -init
----if above commands succeeded then ASM must be up
ps -ef|grep pmon
----start database instance
srvctl start instance -i <instance_name> -d <database_name>
------------------------------------------------------------
If you want to add database to HA(grid instrastructure):
------------------------------------------------------------
ex:
srvctl add database -d orcl -o /opt/oracle/product/12.2.0.1/dbhome_1 -p +DATA//PARAMETERFILE/spfile.644.1041511849
------------------------------------------------------------
modify the database startup option (mount/open).
-----------------------------------------------------------
if you set mount, if server is restarted database will open in mount mode.
srvctl modify database -db ORCL -startoption MOUNT
Hello Ramesh Garu ,,Your blog is very nice ,,,but I have some doubts ,,can you clarify those...Please share me your mobile number if dont mind.
ReplyDeleteMy doubt is what happens if we donot shutdown ASM while shutiing down the instance when there is OS maintenance is there
nothing happens, it will start automatically after OS start after maintenance window, oracle has(which will trigger oracle restart program) will start the GI which will starts the ASM and the databases in the server, that is the advantage of oracle has.
ReplyDelete