DataGuard常规操作命令
1、关闭DataGuard顺序
(1)、取消备库开始应用日志
SQL> alter database recover managed standby database cancel; Database altered.
(2)、关闭备库
shutdown immediate;
(3)、关闭主库
shutdown immediate;
2、开启DataGuard顺序
最大性能模式:先开启主库还是先开启备库,是没有关系的;
最大可用模式:先开启备库再开启主库,如果启动顺序相反,主库仍然能启动,但会在主库的alert.log文件中出现错误警告信息;
...
LGWR: Error 1034 verifying archivelog destination LOG_ARCHIVE_DEST_2 LGWR: Continuing... Tue Jan 23 09:36:29 2007 Errors in file /opt/oracle/admin/devdb/bdump/test_lgwr_30979.trc: ORA-01034: ORACLE not available LGWR: Error 1034 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'test_stb_186'
...
最大保护模式:先启动备库,再启动主库,如果顺序相反,主库实例会自动中断,数据库无法启动,并会在alert.log文件中留下如下信息.
... LGWR: Error 1034 verifying archivelog destination LOG_ARCHIVE_DEST_2 LGWR: Continuing... Tue Jan 23 09:34:03 2007 Errors in file /opt/oracle/admin/devdb/bdump/test_lgwr_30812.trc: ORA-01034: ORACLE not available LGWR: Error 1034 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'test_stb_186' LGWR: Minimum of 1 applicable standby database required Tue Jan 23 09:34:07 2007 Errors in file /opt/oracle/admin/devdb/bdump/test_lgwr_30812.trc: ORA-16072: a minimum of one standby database destination is required LGWR: terminating instance due to error 16072 Instance terminated by LGWR, pid = 30812 ...
综上所述,在启动顺序上,DataGuard中主、备库最好都遵从先开启备库,再开启主库的原则;
开启步骤:
->开启备库监听
->开启备库
->开启主库监听
->开启主库
3、查看主库与备库的保护模式
主库:
SQL> select name,database_role,protection_mode from v$database; NAME DATABASE_ROLE PROTECTION_MODE --------- ---------------- -------------------- ORCL PRIMARY MAXIMUM PERFORMANCE
备库:
SQL> select name,database_role,protection_mode from v$database; NAME DATABASE_ROLE PROTECTION_MODE --------- ---------------- -------------------- ORCL PHYSICAL STANDBY MAXIMUM PERFORMANCE