새싹 DBA/Oracle

[오라클] DB SHUTDOWN (RAC/HA)

LIMMI 2024. 7. 26. 10:16

1. root로 접속

2. oracle 유저로 변경

$ su - oracle

$ vi .bash_profile

3. alias 로 alert 가 등록되어 있지만 .bash_profile 에서 한번 더 확인

export ORACLE_BASE=/oracle/db
export ORACLE_HOME=/oracle/db/product/19.0.0
export ORACLE_SID=AHGDB

alias alert = 'tail -100f /logs/oracle/diag/rdbms/ `echo ${DB_NAME}|tr "A-Z" "a-z"`/${ORACLE_SID}.log

 

처음에 db명이 변수로 등록되어있지 않아서 DIGWDB (개발DB) 에서 bash.profile 긁어왔다.

긁어올땐 cat 으로 긁어오기 !! 

 

4. 알랏로그 띄워두고 session duplicate 해서 새로운 창 띄우기

$adrci show alert 

-- 또는 등록해둔 alert alias 로 alert 띄우기
$alert


-- 새로운 창에서 -- 

$ su - oracle

$ sqlplus sys as sysdba

SQL> shutdown immediate;

-> 동시에 아까 띄워둔 alert.log 보면서 잘 죽는지 확인

 

ASM 으로 DB를 관리하면 또 하나 체크해야할 것이 있다. 

 

SQL exit

SQL > exit;

5. crsctl  상태 확인하기

oracle 유저에서도 나와서 root 계정에서

# crsctl stat res -t

 

관리되고 있는 항목들의 현 상태가 나온다. 

6. DB 정지 / 시작

--DB 정지--
# srvctl> stop database -db AHGDB
# srvctl> stop listener

--DB 시작--
# srvctl> start database -db AHGDB
# srvctl> start listener;

7. 리스너 확인

$oracle > lsnrctl status LISTENER_AHGDB

8. 클러스터 전체(db/asm/listener) 시작 / 정지 

- RAC 에서
# crsctl stop crs
# crsctl start crs

- RAC 외
# crsctl stop has
# crsctl start has

 

 

하면 완료 !