프린트 하기

OS환경 : Oracle Linux 7.4 (64bit)

 

DB 환경 : Oracle Database 11.2.0.4

 

방법 : 오라클 11g R2 RAC grid 재기동시 db 자동기동 중지

RAC 환경에서 grid를 crsctl stop crs 로 중지 후 crsctl start crs 로 기동 시

db는 자동기동됨 

grid 기동시 db가 자동기동 되지 않게하는 방법을 설명함

 

 

방법 1. db리소스의 AUTO_START 값 변경

현재 grid 상태 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCR_VOTE.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORADATA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORAFRA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac2                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.racdb.db
      1        ONLINE  ONLINE       rac1                     Open                
      2        ONLINE  ONLINE       rac2                     Open                
ora.scan1.vip
      1        ONLINE  ONLINE       rac2              

db 이름이 racdb임

 

 

db리소스명으로 설정정보 조회(crs_stat -p 리소스명)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# crs_stat -p ora.racdb.db
NAME=ora.racdb.db
TYPE=ora.database.type
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AUTO_START=restore
CHECK_INTERVAL=1
DESCRIPTION=Oracle Database resource
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_START_OPTIONS@SERVERNAME(rac1)=open
GEN_START_OPTIONS@SERVERNAME(rac2)=open
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2
HOSTING_MEMBERS=
PLACEMENT=restricted
RESTART_ATTEMPTS=2
SCRIPT_TIMEOUT=60
START_TIMEOUT=600
STOP_TIMEOUT=600
UPTIME_THRESHOLD=1h
USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2

AUTO_START 가 restore 으로 되어있음

grid 중지시점의 db상태에 따라 기동되는 상태
sqlplus에서 db를 먼저 shutdown 시킨 뒤 grid를 재기동시키면 grid 기동 후 db는 자동으로 기동되지 않고
db open 상태에서 grid를 재기동시키면 grid 기동 후 db는 자동으로 기동됨

 

 

AUTO_START 옵션 설명
Oracle Clusterware가 클러스터 서버 재시작 후 리소스를 자동으로 시작하는지 여부를 나타냄
always: 서버가 중지되었을 때 리소스의 상태와 상관없이(grid 중지시점의 db상태와 상관없이) 서버가 다시 시작되면 리소스를 다시 시작함
restore: 서버가 중지되었을 때와(grid 중지시점의 db상태와) 동일한 상태로 리소스를 복원함
never: 서버가 중지되었을 때 리소스의 상태에 관계없이(grid 중지시점의 db상태와 관계없이) 리소스를 다시 시작하지 않음

 

 

db 리소스의 auto_start 값 변경

1
2
3
4
5
6
7
8
9
10
11
# crsctl modify resource "ora.racdb.db" -attr "AUTO_START=always"
# crs_stat -p ora.racdb.db | grep AUTO_START
AUTO_START=always
 
# crsctl modify resource "ora.racdb.db" -attr "AUTO_START=restore"
# crs_stat -p ora.racdb.db | grep AUTO_START
AUTO_START=restore
 
# crsctl modify resource "ora.racdb.db" -attr "AUTO_START=never"
# crs_stat -p ora.racdb.db | grep AUTO_START
AUTO_START=never

grid 중지시점의 db상태와 상관없이 db를 기동시키지 않으려면 never 옵션으로 설정

 

 

grid 재기동

1
2
# crsctl stop crs
# crsctl start crs

 

 

잠시후 grid 상태 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCR_VOTE.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORADATA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORAFRA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.racdb.db
      1        ONLINE  OFFLINE                               Instance Shutdown   
      2        ONLINE  OFFLINE                               Instance Shutdown   
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                                   

grid가 기동되도 db는 기동되지 않음

 

 

방법 2. db의 Management policy 값 변경

(방법 1 작업을 했다면 원복 후 아래단계 진행)

1
2
3
4
# crsctl modify resource "ora.racdb.db" -attr "AUTO_START=restore"
# crs_stat -p ora.racdb.db | grep AUTO_START
AUTO_START=restore
# srvctl start database -d racdb

 

 

현재 grid 상태 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCR_VOTE.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORADATA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORAFRA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac2                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.racdb.db
      1        ONLINE  ONLINE       rac1                     Open                
      2        ONLINE  ONLINE       rac2                     Open                
ora.scan1.vip
      1        ONLINE  ONLINE       rac2              

db 이름이 racdb임

 

 

db이름으로 설정정보 조회(srvctl config database)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +ORADATA/racdb/spfileracdb.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb1,racdb2
Disk Groups: ORADATA,ORAFRA
Mount point paths: 
Services: 
Type: RAC
Database is administrator managed

Management policy가 AUTOMATIC 으로 되어있음

 

 

db리소스명으로 설정정보 조회(crs_stat -p 리소스명)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# crs_stat -p ora.racdb.db
NAME=ora.racdb.db
TYPE=ora.database.type
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AUTO_START=restore
CHECK_INTERVAL=1
DESCRIPTION=Oracle Database resource
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_START_OPTIONS@SERVERNAME(rac1)=open
GEN_START_OPTIONS@SERVERNAME(rac2)=open
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2
HOSTING_MEMBERS=
PLACEMENT=restricted
RESTART_ATTEMPTS=2
SCRIPT_TIMEOUT=60
START_TIMEOUT=600
STOP_TIMEOUT=600
UPTIME_THRESHOLD=1h
USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2

AUTO_START 가 restore 으로 되어있음(grid 중지시점의 db상태에 따라 기동되는 상태)

 

 

Management policy 설정 MANUAL 로 변경 후 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# srvctl modify database -d racdb -y manual
# srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +ORADATA/racdb/spfileracdb.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: MANUAL
Server pools: racdb
Database instances: racdb1,racdb2
Disk Groups: ORADATA,ORAFRA
Mount point paths: 
Services: 
Type: RAC
Database is administrator managed

Management policy가 MANUAL 로 변경됨

 

 

db리소스명으로 설정정보 조회(crs_stat -p 리소스명)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# crs_stat -p ora.racdb.db
NAME=ora.racdb.db
TYPE=ora.database.type
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AUTO_START=never
CHECK_INTERVAL=1
DESCRIPTION=Oracle Database resource
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_START_OPTIONS@SERVERNAME(rac1)=open
GEN_START_OPTIONS@SERVERNAME(rac2)=open
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2
HOSTING_MEMBERS=
PLACEMENT=restricted
RESTART_ATTEMPTS=2
SCRIPT_TIMEOUT=60
START_TIMEOUT=600
STOP_TIMEOUT=600
UPTIME_THRESHOLD=1h
USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2

AUTO_START 가 never 로 변경됨(grid 중지시점의 db상태와 상관없이 db가 기동되지 않는 상태)

 

 

grid 재기동

1
2
# crsctl stop crs
# crsctl start crs

 

 

잠시후 grid 상태 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.OCR_VOTE.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORADATA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ORAFRA.dg
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.asm
               ONLINE  ONLINE       rac1                     Started             
               ONLINE  ONLINE       rac2                     Started             
ora.gsd
               OFFLINE OFFLINE      rac1                                         
               OFFLINE OFFLINE      rac2                                         
ora.net1.network
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
ora.ons
               ONLINE  ONLINE       rac1                                         
               ONLINE  ONLINE       rac2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                         
ora.cvu
      1        ONLINE  ONLINE       rac1                                         
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                         
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                         
ora.racdb.db
      1        ONLINE  OFFLINE                               Instance Shutdown   
      2        ONLINE  OFFLINE                               Instance Shutdown   
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                                   

grid가 기동되도 db는 기동되지 않음

 

 

원복방법

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# srvctl modify database -d racdb -y automatic
# srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +ORADATA/racdb/spfileracdb.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb1,racdb2
Disk Groups: ORADATA,ORAFRA
Mount point paths: 
Services: 
Type: RAC
Database is administrator managed

 

 

참조 : 

https://docs.oracle.com/cd/E11882_01/rac.112/e41959/resatt.htm#CHDFFEHJ

https://docs.oracle.com/database/121/RACAD/GUID-724B90C3-8A4A-4E39-B39A-C13586668B1E.htm#RACAD7298

https://logic.edchen.org/how-to-disable-auto-start-rac-database-by-srvctl/