Data Guard管理(切换)
时间:2010-09-16 来源:lzdyxin
检查standby database的状态
SQL> select database_role,protection_mode,protection_level from v$database;
SQL> select sequence# ,applied from v$archived_log order by sequence#;
开始Redo应用
主库
SQL> alter system archive log current;
备库,11g可以只读打开库应用日志
SQL> alter database open read only;
SQL> alter database recover managed standby database disconnect from session;
也可以使用alter database recover managed standby database using current logfile disconnect from session;应用日志。
没有using current logfile是去apply standby archived log.
有using current logfile是当日志传到standby redo log的时候就去应用,是real-time的,必须要有standby redo log.
备用服务器的管理模式与只读模式
1.启动到管理模式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from session;
2.启动到只读方式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database open read only;
(3)如果在管理恢复模式下到只读模式
SQL> recover managed standby database cancel;
SQL> alter database open read only;
SQL> conn dyx/dyx
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
TEST
SQL> select * from test;
ID
----------
1
这个时候,可以给数据库增加临时数据文件(这个在热备份的时候是没有备份过来的)
如
alter tablespace temp add tempfile '/u02/oradata/test/temp01.dbf' size 100M;
5.从只读方式到管理恢复方式
SQL> recover managed standby database disconnect from session;
主备切换
主库
lsnrctl stop
SQL> alter database commit to switchover to physical standby with session shutdown;
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database recover managed standby database disconnect;
lsnrctl start
备库
SQL> alter database commit to switchover to primary;
SQL> shutdown immediate;
SQL> startup
SQL> select database_role,protection_mode,protection_level from v$database;
SQL> select sequence# ,applied from v$archived_log order by sequence#;
开始Redo应用
主库
SQL> alter system archive log current;
备库,11g可以只读打开库应用日志
SQL> alter database open read only;
SQL> alter database recover managed standby database disconnect from session;
也可以使用alter database recover managed standby database using current logfile disconnect from session;应用日志。
没有using current logfile是去apply standby archived log.
有using current logfile是当日志传到standby redo log的时候就去应用,是real-time的,必须要有standby redo log.
备用服务器的管理模式与只读模式
1.启动到管理模式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from session;
2.启动到只读方式
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database open read only;
(3)如果在管理恢复模式下到只读模式
SQL> recover managed standby database cancel;
SQL> alter database open read only;
SQL> conn dyx/dyx
Connected.
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
TEST
SQL> select * from test;
ID
----------
1
这个时候,可以给数据库增加临时数据文件(这个在热备份的时候是没有备份过来的)
如
alter tablespace temp add tempfile '/u02/oradata/test/temp01.dbf' size 100M;
5.从只读方式到管理恢复方式
SQL> recover managed standby database disconnect from session;
主备切换
主库
lsnrctl stop
SQL> alter database commit to switchover to physical standby with session shutdown;
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database recover managed standby database disconnect;
lsnrctl start
备库
SQL> alter database commit to switchover to primary;
SQL> shutdown immediate;
SQL> startup
相关阅读 更多 +