GI - Grid Infrastructure Maintenance for Restart Server
1. How to Stop and Start Database?
2. How to Stop and Start ASM Instance?
3. How to Stop and Start HAS?
Database:
==========
SQL> shut immediate
SQL> startup;
SQL> startup force;
$srvctl status database -d TESTDB
$srvctl config database -d TESTDB
$srvctl stop database -d TESTDB
$srvctl start database -d TESTDB
ASM:
====
SQL> shut immediate
SQL> startup;
$srvctl status asm
$srvctl config asm
$srvctl stop asm
$srvctl stop asm -f
$srvctl start asm
ASMCMD> shutdown ---immediate/--abort
ASMCMD> startup
HAS/OHASD:
==========
$crsctl check has
$crsctl stop has
$crsctl stop has -f
$crsctl start has
$crsctl stat res -t -init
#systemctl status ohasd
#systemctl stop ohasd
#systemctl start ohasd
##### Verify the Database and ASM Instances on Oracle Restart Server ######
[root@oraclelab2 ~]# ps -ef|grep smon
root 9222 9133 0 11:47 pts/5 00:00:00 grep --color=auto smon
oracle 28574 1 0 Aug01 ? 00:00:01 asm_smon_+ASM
oracle 28737 1 0 Aug01 ? 00:00:01 ora_smon_TESTDB
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# su - oracle
Last login: Wed Aug 2 09:11:49 IST 2023 on pts/1
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [oracle] ? +ASM
The Oracle base has been set to /u01/app/oracle
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwasm
Backup of Password file:
ASM listener: LISTENER
Spfile: +OCR/ASM/ASMPARAMETERFILE/registry.253.1135130687
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[oracle@oraclelab2 ~]$ srvctl status asm
ASM is running on oraclelab2
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [+ASM] ? TESTDB
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ env |grep ORA
ORACLE_SID=TESTDB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl config database -d TESTDB
Database unique name: TESTDB
Database name: TESTDB
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/TESTDB/PARAMETERFILE/spfile.265.1143706501
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA,RECO
Services:
OSDBA group: oinstall
OSOPER group: oinstall
Database instance: TESTDB
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ###Starting & Stopping Database####
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 9516 9227 0 11:48 pts/5 00:00:00 grep --color=auto smon
oracle 28574 1 0 Aug01 ? 00:00:01 asm_smon_+ASM
oracle 28737 1 0 Aug01 ? 00:00:01 ora_smon_TESTDB
[oracle@oraclelab2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 11:49:18 2023
Version 19.17.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$ srvctl stop database -d TESTDB
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is not running.
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 9633 9227 0 11:49 pts/5 00:00:00 grep --color=auto smon
oracle 28574 1 0 Aug01 ? 00:00:01 asm_smon_+ASM
[oracle@oraclelab2 ~]$ srvctl start database -d TESTDB
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 9775 1 0 11:50 ? 00:00:00 ora_smon_TESTDB
oracle 10125 9227 0 11:50 pts/5 00:00:00 grep --color=auto smon
oracle 28574 1 0 Aug01 ? 00:00:01 asm_smon_+ASM
[oracle@oraclelab2 ~]$
#### Starting & Stopping ASM which will impact Databases which are residing under ASM #####
[oracle@oraclelab2 ~]$ . oraenv
ORACLE_SID = [TESTDB] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ env |grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/19.0.0.0/grid
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl status asm
ASM is running on oraclelab2
[oracle@oraclelab2 ~]$ srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwasm
Backup of Password file:
ASM listener: LISTENER
Spfile: +OCR/ASM/ASMPARAMETERFILE/registry.253.1135130687
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl stop asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2974: unable to act on resource 'ora.asm' on server 'oraclelab2' because that would require stopping or relocating resource 'ora.testdb.db' but the appropriate force flag was not specified
[oracle@oraclelab2 ~]$
# Above command failed due to fact that TESTDB database act as client connection to ASM #
# Use force option to stop ASM #
[oracle@oraclelab2 ~]$ srvctl stop asm -f
[oracle@oraclelab2 ~]$ srvctl status asm
ASM is not running.
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 10496 9227 0 11:53 pts/5 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
# We stopped ASM but underlying database TESTDB also went down, Once we start the ASM TESTDB database also will comes back online automatically #
[oracle@oraclelab2 ~]$ srvctl start asm
[oracle@oraclelab2 ~]$ srvctl status asm
ASM is running on oraclelab2
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 10658 1 0 11:55 ? 00:00:00 asm_smon_+ASM
oracle 10806 1 0 11:55 ? 00:00:00 ora_smon_TESTDB
oracle 11201 9227 0 11:55 pts/5 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
#### Starting & Stopping HAS will impact ASM as well as Database since both ASM and Database will run on top of HAS ####
# In order to stop ans start HAS we have use crsctl utility and run as root user #
[root@oraclelab2 ~]# . oraenv
ORACLE_SID = [root] ? +ASM
The Oracle base has been set to /u01/app/oracle
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# env |grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/19.0.0.0/grid
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# crsctl check has
CRS-4638: Oracle High Availability Services is online
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.testdb.db' on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'oraclelab2'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'oraclelab2' succeeded
CRS-2677: Stop of 'ora.testdb.db' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'oraclelab2'
CRS-2677: Stop of 'ora.DATA.dg' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.DGROUPC.dg' on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'oraclelab2'
CRS-2673: Attempting to stop 'ora.RECO.dg' on 'oraclelab2'
CRS-2677: Stop of 'ora.RECO.dg' on 'oraclelab2' succeeded
CRS-2677: Stop of 'ora.DGROUPC.dg' on 'oraclelab2' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'oraclelab2'
CRS-2677: Stop of 'ora.asm' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'oraclelab2'
CRS-2677: Stop of 'ora.evmd' on 'oraclelab2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'oraclelab2'
CRS-2677: Stop of 'ora.cssd' on 'oraclelab2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oraclelab2' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@oraclelab2 ~]# crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# crsctl check has
CRS-4638: Oracle High Availability Services is online
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# ps -ef|grep smon
oracle 11911 1 0 11:58 ? 00:00:00 asm_smon_+ASM
oracle 12062 1 0 11:59 ? 00:00:00 ora_smon_TESTDB
root 12913 12802 0 12:05 pts/6 00:00:00 grep --color=auto smon
[root@oraclelab2 ~]#
##### We can stop & start HAS using systemctl utility ####
[root@oraclelab2 ~]# systemctl status ohasd
● ohasd.service - LSB: Start and Stop Oracle High Availability Service
Loaded: loaded (/etc/rc.d/init.d/ohasd; bad; vendor preset: disabled)
Active: active (exited) since Fri 2023-06-16 19:15:25 IST; 1 months 16 days ago
Docs: man:systemd-sysv-generator(8)
Process: 3529 ExecStart=/etc/rc.d/init.d/ohasd start (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 0B
Jun 16 19:15:25 oraclelab2.localdomain.com systemd[1]: Starting LSB: Start and Stop Oracle High Availability Service...
Jun 16 19:15:25 oraclelab2.localdomain.com ohasd[3529]: Starting ohasd:
Jun 16 19:15:25 oraclelab2.localdomain.com su[3566]: (to oracle) root on none
Jun 16 19:15:25 oraclelab2.localdomain.com ohasd[3529]: CRS-4123: Oracle High Availability Services has been started.
Jun 16 19:15:25 oraclelab2.localdomain.com systemd[1]: Started LSB: Start and Stop Oracle High Availability Service.
[root@oraclelab2 ~]# systemctl stop ohasd
[root@oraclelab2 ~]# ps -ef|grep smon
root 19131 17810 0 13:32 pts/4 00:00:00 grep --color=auto smon
[root@oraclelab2 ~]# systemctl start ohasd
[root@oraclelab2 ~]# systemctl status ohasd
● ohasd.service - LSB: Start and Stop Oracle High Availability Service
Loaded: loaded (/etc/rc.d/init.d/ohasd; bad; vendor preset: disabled)
Active: active (exited) since Wed 2023-08-02 13:32:49 IST; 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 19023 ExecStop=/etc/rc.d/init.d/ohasd stop (code=exited, status=0/SUCCESS)
Process: 19172 ExecStart=/etc/rc.d/init.d/ohasd start (code=exited, status=0/SUCCESS)
Aug 02 13:32:49 oraclelab2.localdomain.com systemd[1]: Starting LSB: Start and Stop Oracle High Availability Service...
Aug 02 13:32:49 oraclelab2.localdomain.com ohasd[19172]: Starting ohasd:
Aug 02 13:32:49 oraclelab2.localdomain.com su[19199]: (to oracle) root on none
Aug 02 13:32:49 oraclelab2.localdomain.com ohasd[19172]: CRS-4123: Oracle High Availability Services has been started.
Aug 02 13:32:49 oraclelab2.localdomain.com systemd[1]: Started LSB: Start and Stop Oracle High Availability Service.
[root@oraclelab2 ~]# ps -ef|grep smon
root 19587 17810 0 13:33 pts/4 00:00:00 grep --color=auto smon
[root@oraclelab2 ~]# ps -ef|grep smon
oracle 19691 1 0 13:33 ? 00:00:00 asm_smon_+ASM
root 19724 17810 0 13:33 pts/4 00:00:00 grep --color=auto smon
[root@oraclelab2 ~]#
[root@oraclelab2 ~]# ps -ef|grep smon
oracle 19691 1 0 13:33 ? 00:00:00 asm_smon_+ASM
oracle 19853 1 0 13:33 ? 00:00:00 ora_smon_TESTDB
root 21350 17810 0 13:50 pts/4 00:00:00 grep --color=auto smon
[root@oraclelab2 ~]#
Extra Note:
1. Stop & Start ASM instance using SQL command line:
[oracle@oraclelab2 ~]$ sqlplus / as sysasm
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 13:53:09 2023
Version 19.17.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
SQL> shut immediate; >>>>>>>>>>>>>>>>>>> In case immediate did not work then we can use abort
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown
SQL>
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 21845 21370 0 13:54 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$ sqlplus / as sysasm
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 13:54:11 2023
Version 19.17.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ASM instance started
Total System Global Area 1137173320 bytes
Fixed Size 8905544 bytes
Variable Size 1103101952 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 21914 1 0 13:54 ? 00:00:00 asm_smon_+ASM
oracle 22053 21370 0 13:55 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
2. Stop & Start ASM instance using ASMCMD command line:
ASMCMD [+] > shutdown --immediate
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown
Connected to an idle instance.
ASMCMD [+] > exit
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 22669 21370 0 13:58 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ asmcmd -p
Connected to an idle instance.
ASMCMD [+] > startup;
ASM instance started
Total System Global Area 1137173320 bytes
Fixed Size 8905544 bytes
Variable Size 1103101952 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
ASMCMD [+] > exit
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 22859 1 0 13:59 ? 00:00:00 asm_smon_+ASM
oracle 22987 21370 0 13:59 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 22859 1 0 13:59 ? 00:00:00 asm_smon_+ASM
oracle 23938 1 0 14:11 ? 00:00:00 ora_smon_TESTDB
oracle 24249 21370 0 14:11 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
3. Stop & Start Database using SQL command line or using srvctl utility
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 24762 1 0 14:13 ? 00:00:00 asm_smon_+ASM
oracle 25212 1 0 14:16 ? 00:00:00 ora_smon_TESTDB
oracle 27293 21370 0 14:42 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
[oracle@oraclelab2 ~]$ srvctl stop database -d TESTDB
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 24762 1 0 14:13 ? 00:00:00 asm_smon_+ASM
oracle 25052 21370 0 14:15 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl start database -d TESTDB
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 24762 1 0 14:13 ? 00:00:00 asm_smon_+ASM
oracle 25212 1 0 14:16 ? 00:00:00 ora_smon_TESTDB
oracle 27293 21370 0 14:42 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 14:43:55 2023
Version 19.17.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 24762 1 0 14:13 ? 00:00:00 asm_smon_+ASM
oracle 27415 21370 0 14:44 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 2 14:44:37 2023
Version 19.17.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 3707763120 bytes
Fixed Size 8903088 bytes
Variable Size 721420288 bytes
Database Buffers 2969567232 bytes
Redo Buffers 7872512 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ ps -ef|grep smon
oracle 24762 1 0 14:13 ? 00:00:00 asm_smon_+ASM
oracle 27507 1 0 14:44 ? 00:00:00 ora_smon_TESTDB
oracle 28042 21370 0 14:46 pts/4 00:00:00 grep --color=auto smon
[oracle@oraclelab2 ~]$
[oracle@oraclelab2 ~]$ srvctl status database -d TESTDB
Database is running.
[oracle@oraclelab2 ~]$
Regards,
Mallik