Oracle DG主備啟動和關閉流程

ywxj_001發表於2017-12-11

環境:

Oracle 11g RAC和DG


關閉操作流程

RAC節點:

關閉primary主機:

SQL>shutdown immediate

無法shutdown immediate

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup restrict;

ORACLE instance started.

SQL> shutdown

Database closed.

Database dismounted.

ORACLE instance shut down.


關閉standby主機:

SQL>alter database recover managed standby database cancel;

SQL>shutdown immediate


開啟操作流程

開啟standby主機:


SQL> startup mount;
ORACLE instance started.

Total System Global Area 1.7103E+10 bytes
Fixed Size                  2245480 bytes
Variable Size            2181041304 bytes
Database Buffers         1.4898E+10 bytes
Redo Buffers               21708800 bytes
Database mounted.
SQL> select RECOVERY_MODE from v$archive_dest_status where rownum<5;

RECOVERY_MODE
-----------------------
IDLE
IDLE
IDLE

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.
開啟primary主機:
primary主機是RAC,會自動拉起來。
primary主機RAC一切正常。

發現standby主機監聽不正常:
重啟監聽。
[oracle@dg ~]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:12:16


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused


[oracle@dg ~]$ lsnrctl stop


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:12:37


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@dg ~]$ lsnrctl start


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:12:44


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...


TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/dg/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg)(PORT=1521)))


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                11-DEC-2017 15:12:45
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/dg/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@dg ~]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:13:29


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                11-DEC-2017 15:12:45
Uptime                    0 days 0 hr. 0 min. 44 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/dg/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg)(PORT=1521)))
Services Summary...
Service "DG" has 1 instance(s).
  Instance "DG", status READY, has 1 handler(s) for this service...
The command completed successfully

開啟standby主機的只讀功能:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; 


Database altered.


SQL> alter database open read only;


Database altered.


SQL> select RECOVERY_MODE from v$archive_dest_status where rownum<5;


RECOVERY_MODE
-----------------------
IDLE
IDLE
IDLE
IDLE


SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


Database altered.


SQL> select RECOVERY_MODE from v$archive_dest_status where rownum<5;


RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY
IDLE
IDLE
IDLE

主備的alert日誌正常:
RAC01  alert日誌:
Thread 1 advanced to log sequence 35614 (LGWR switch)
  Current log# 2 seq# 35614 mem# 0: +DATA/prd/onlinelog/group_2.257.929893623
Mon Dec 11 15:50:16 2017
LNS: Standby redo logfile selected for thread 1 sequence 35614 for destination LOG_ARCHIVE_DEST_2
Mon Dec 11 15:50:16 2017
Archived Log entry 94045 added for thread 1 sequence 35613 ID 0x35485ff1 dest 1:

RAC02  alert日誌:
Thread 2 advanced to log sequence 18461 (LGWR switch)
  Current log# 3 seq# 18461 mem# 0: +DATA/prd/onlinelog/group_3.261.929893729
Mon Dec 11 15:32:10 2017
LNS: Standby redo logfile selected for thread 2 sequence 18461 for destination LOG_ARCHIVE_DEST_2
Mon Dec 11 15:32:11 2017
Archived Log entry 94043 added for thread 2 sequence 18460 ID 0x35485ff1 dest 1:


DG  alert日誌:
Media Recovery Waiting for thread 2 sequence 18461 (in transit)
Recovery of Online Redo Log: Thread 2 Group 8 Seq 18461 Reading mem 0
  Mem# 0: /oracle/oradata/standby08.log
Mon Dec 11 15:50:16 2017
RFS[4]: Selected log 6 for thread 1 sequence 35614 dbid 893924085 branch 929893623
Mon Dec 11 15:50:16 2017
Media Recovery Waiting for thread 1 sequence 35614 (in transit)
Recovery of Online Redo Log: Thread 1 Group 6 Seq 35614 Reading mem 0
  Mem# 0: /oracle/oradata/standby06.log
Mon Dec 11 15:51:44 2017
Archived Log entry 40467 added for thread 1 sequence 35613 ID 0x35485ff1 dest 1:


如果透過重啟監聽無法解決DG節點的監聽問題,可以透過動態註冊監聽來解決

alter system register









來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22996654/viewspace-2148550/,如需轉載,請註明出處,否則將追究法律責任。

相關文章