oracle 11.2.0.1逻辑备用库环境搭建
首先创建物理备用库,参考《oracle 11gr2 物理备用数据库搭建及切换》
创建物理备用库后,最好创建各自的spfile
物理备库上 停止redo应用
alter database recover managed standby database cancel;
主库上生成logminer 会发生几次切换日志 报错忽略
execute dbms_logstdby.build;
物理备库上 转化为逻辑备用库
alter database recover to logical standby orcl; <-- db_name 参数
shutdown immediate
startup mount
select db_unique_name,open_mode, database_role,switchover_status,guard_status,protection_mode from v$database;
备库上 重建逻辑standby的密码文件
orapwd file=$oracle_home/dbs/orapwstby password=oracle entries=5 ignorecase=y force=y
备库上 修改参数
alter system set log_archive_dest_1='location=/u01/oradata/arch/stby valid_for=(online_logfiles,all_roles) db_unique_name=stby';
alter system set log_archive_dest_2='location=/u01/oradata/arch valid_for=(standby_logfiles,standby_roles) db_unique_name=stby';
备库上 创建备用日志
alter database add standby logfile group 4 ('/u01/oradata/stby/standbylj01.log') size 20m reuse;
alter database add standby logfile group 5 ('/u01/oradata/stby/standbylj02.log') size 20m reuse;
alter database add standby logfile group 6 ('/u01/oradata/stby/standbylj03.log') size 20m reuse;
select member from v$logfile;
备库上 打开逻辑standby
alter database open resetlogs;
alter database start logical standby apply immediate;
备库上 检查
select instance_name,status from v$instance;
select db_unique_name,open_mode, database_role,switchover_status,guard_status,protection_mode from v$database;
select group#,sequence#,used,status from v$standby_log;
测试
在主库上 创建
create table scott.t4 (id int);
insert into scott.t4 values(4);
commit;
alter system switch logfile;
过一会儿 在逻辑备用库上查询
select * from scott.t4;
阅读(3591) | 评论(1) | 转发(0) |