1. Data Guard 开启和关闭恢复模式
11g之前:
目标端取消恢复模式:
alter database recover managed standby database cancel; --停止恢复
alter database open read only; (默认以只读模式打开)
再开启到恢复状态:
shutdown immediate;
startup nomount ;
alter database mount standby database;
alter database recover managed standby database disconnect from session; --开启恢复
-------------------------------------------------------------------------------------------------
11g之后:
开启恢复状态:
startup nomount ;
alter database mount standby database;
alter database open read only; (默认以只读模式打开)
alter database recover managed standby database using current logfile disconnect from session; --实时应用
注意: 11g之后dg可以打开到read only之后,开启日志应用,我们称之为Active DataGuard
11g之前dg必须停止恢复,然后才能打开到read only状态,如上面
-------------------------------------------------------------------------------------------------
2.正常开启关闭Data Guard流程
2.1 Data Guard关闭流程
sept1: 停止standby 数据库redo日志的应用
sql> alter database recover managed standby database cancel ;
setp2: 关闭主数据库
sept3: 关闭standby数据库
2.2 DataGuard启动流程
setp1 :启动standby数据库
SQL>startup nomount ;
SQL>alter database mount standby database;
sept2: 启动主数据库
sept3: 开启standby数据库redo日志应用
alter database recover managed standby database using current logfile disconnect from session; --实时应用