标签:
包括:
centos6.5 oracle11gR2 DataGuard安装
dataGuard 主备switchover角色切换
数据同步测试
<一,>DG数据库数据同步测试
1,正常启动主库
$sqlplus / as sysdba
sql>startup
2,启动备库
$sqlplus / as sysdba
sql>startup mount
sql>alter database recover managed standby database disconnect from session
sql>alter database recover managed standby database cancel
sql>alter database open read only
sql>alter database recover managed standby database using current logfile disconnect
3,在主库上做一次日志切换
sql>alter system switch logfile
4,在主库上建表插入数据并在备库查询
sql>create table smsinfo(id integer,name char(10))
sql>insert into smsinfo values(1,‘chkRuiy‘)
sql>commit;
#如果standby模式为read-only模式下的实时redo应用模式,在主库commit后,在备库直接查询即可
sql>select * from smsinfo
5,如果standby模式为redo应用模式,需做如下操作才可查询
#测试时,需要在主库上做一次日志归档,将日志传送给standby库
sql>alter system archive log current
#在备库上取消redo应用,因为在redo应用模式下不能打开数据库
sql>alter database recover managed standby database cancel
sql>select * from smsinfo
测试成功!
新建user及tablespace同步测试
<二,>主备切换
select name,open_mode,database_role,protection_level,protection_mode from v$database;
1,主库执行
sql>alter system archive log current;
sql>alter database commit to switchover to physical standby with session shutdown;
sql>shutdown immediate
sql>startup mount
主库switchover切换到备库状态查看
select open_mode,switchover_status,database_role from v$database
2,备库执行
sql>alter database commit to switchover to primary WITH SESSION SHUTDOWN;;
sql>ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
sql>alter database open
sql>alter database recover managed standby database disconnect;
DataGuard维护命令
1,standby上检测应用率和活动
select to_char(start_time,‘dd-mon-rr hh24:mi:ss‘) start_time,item,sofar from V$recovery_progress where item in (‘Active Apply Rate‘, ‘Average Apply Rate‘,‘Redo Applied‘);
2,实时同步日志查看
/ruiy/ocr/DBSoftware/app/oracle/diag/rdbms/dg1/dg/trace/alert_dg.log
3,在主库和备库上做切换前后的下列查询,检查归档日志从主库传送到备库的情况
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
Oracle Dataguard HA (主备,灾备)方案部署调试
标签:
原文地址:http://www.cnblogs.com/ruiy/p/4269835.html