Pages

Wednesday, February 20, 2019

Start / Stop Oracle RAC

В данной заметке приведены команды, которые используюся для старта и остановки сервисов Oracle RAC.






Stop:


Stopping Cluster Resources by Using the crsctl Command

Остановлены будут все сервисы OHAS/CRS/ASM/Database зарегистрированные в кластере.

>>> root - ON EACH NODE

$ crsctl stop crs
$ crsctl check cluster -all

CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Check failed, or completed with errors.

Для того чтобы остановить сразу на всех узлах кластера можно выполнить:

$ crsctl stop crs -all

Stopping Database Instances by Using the srvctl Command

$ srvctl stop database -db HYDRA
$ srvctl status database -db HYDRA

Instance HYDRA1 is not running on node head01

Instance HYDRA2 is not running on node head02

Start:

Starting Cluster Resources by Using the crsctl Command

Стартованы будут все сервисы OHAS/CRS/ASM/Database зарегистрированные в кластере.

>>> root - ON EACH NODE

$ crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

После этого нужно подождать несколько минут и затем проверить статус след. образом:

$ crsctl check cluster -all

**************************************************************
head01:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

**************************************************************
head02:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

Для того чтобы стартовать сразу на всех узлах кластера можно выполнить:

$ crsctl start crs -all

Starting Database Instances by Using the srvctl Command

$ srvctl start database -db HYDRA
$ srvctl status database -db HYDRA

Instance HYDRA1 is running on node head01
Instance HYDRA2 is running on node head02

Issues:

На своей практике получал следующую ошибку, когда стопал ASM отдельно через srvctl:

$ srvctl stop asm -n head01

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

Проблема и решение описано в этом документе:

ORA-15097 Cannot Shutdown ASM if OCR is Located in ASM (Doc ID 984663.1)

Проблема связана с тем, что OCR и Voting Disk расположены на ASM. Поэтому утилита srvctl не даст нам остановить его, поскольку кластерные демоны постоянно ведут работу с этими файлами. При этом ничего не мешает просто зайти в ASM через sqlplus и просто оттуда его остановить. В свою очередь srvctl перед тем как остановить какой либо сервис, зарегистрированный в кластере - проверяет зависимости сервисов между собой.

Убедимся, что OCR и Voting Disk действительно на ASM:

$ ocrcheck

Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     409568
         Used space (kbytes)      :       1524
         Available space (kbytes) :     408044
         ID                       :  164476546
         Device/File Name         :      +DATA
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded


Проверка зависимостей остановки ASM:

$ crsctl stat res ora.asm -p | grep DEPENDENCIES
START_DEPENDENCIES=hard(ora.cssd) weak(ora.LISTENER.lsnr)
STOP_DEPENDENCIES=hard(ora.cssd)

В итоге, чтобы остановить ASM я сделал следующее:

$ srvctl stop asm -n head01 -f

OR

$ crsctl stop crs


Interesting:

Когда останавливаем БД через srvctl - то БД останавливается в режиме IMMEDIATE.

Есть останавливать через crvctl - тогда в режиме ABORT.

Подробнее здесь: https://blog.oracle-ninja.com/2014/04/06/database-shutdown-with-crsctl/

Используемые материалы:

How to Troubleshoot Grid Infrastructure Startup Issues [ID 1050908.1]
What to Do if 11gR2 Clusterware is Unhealthy [ID 1068835.1]
Steps To Shutdown(stop)/Startup(start) CRS, OHAS, ASM, RDBMS & ACFS Services on a RAC Cluster 11.2 & 12.1 Configuration (Doc ID 1355977.1)