时间:2021-07-01 10:21:17 帮助过:23人阅读
oracle 11.2.0.1逻辑备用库环境搭建 首先创建物理备用库,创建物理备用库后,最好创建各自的spfile 物理备库上 停止redo应用 alter database recover managed STANDBY database cancel; 主库上生成logminer 会发生几次切换日志 报错忽略 execute dbms_logstd
oracle 11.2.0.1逻辑备用库环境搭建
首先创建物理备用库,,创建物理备用库后,最好创建各自的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;