1.standby database 正常的打开与关闭
1.1 针对 physical standby
打开:--打开数据库SQL>startup; -- 开启 mgr 进程 SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect from session; ( physical standby )关闭:
-- 关闭 mgr 进程SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;-- 正常关闭数据库SQL> shutdown immediate;1.2 针对 logical standby
-- 开启 mgr 进程SQL>ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE; -- 关闭 mgr 进程SQL>ALTER DATABASE STOP LOGICAL STANDBY APPLY;2. 查看数据库角色与保护模式
SQL> select protection_mode, protection_level, database_role role, switchover_status from v$database;
3.查询每个standby 的状态:
-- 主库执行SQL> SELECT DEST_ID, STATUS,APPLIED_SCN FROM V$ARCHIVE_DEST WHERE TARGET='STANDBY'; DEST_ID STATUS APPLIED_SCN---------- --------- ----------- 2 VALID 18180694. 检查redo 传送情况
-- 备库查看当前 log sequence
SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 41Next log sequence to archive 0Current log sequence 41-- 主库日志切换SQL> alter system switch logfile;System altered.-- 备库查看当前 log sequence ,如果 log sequence 有变化说明传输没有问题。SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 41Next log sequence to archive 0Current log sequence 425. 检查 mrp 应用情况
--备库执行SQL> SELECT THREAD#, SEQUENCE#, FIRST_CHANGE#,NEXT_CHANGE#,APPLIED FROM V$ARCHIVED_LOG; THREAD# SEQUENCE# FIRST_CHANGE# NEXT_CHANGE# APPLIED---------- ---------- ------------- ------------ --------- 1 24 1449716 1451135 YES 1 26 1476706 1481494 YES 1 25 1451135 1476706 YES 1 27 1481494 1491422 YES 1 29 1524315 1547524 YES6. 查询archived log 的历史信息:(主备都执行,对比是否相同)
SQL> SELECT THREAD#, SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# FROM V$LOG_HISTORY;7. 查询DG的日志信息,这些日志信息可以写入alert log 或者进程的trace 文件
SQL> set pagesize 200SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;MESSAGE------------------------------------------ARC0: Archival startedARC1: Archival startedARC2: Archival startedARC2: Becoming the 'no FAL' ARCHARC1: Becoming the heartbeat ARCHARC1: Becoming the active heartbeat ARCHARC3: Archival started