首先創(chuàng)建物理備庫-
參考:http://www.linuxidc.com/Linux/2011-04/34350.htm
創(chuàng)建物理備庫后,最好創(chuàng)建各自的spfile
物理備庫上停止redo應用:
alter database recover managed STANDBY database cancel;
主庫上生成logminer會發(fā)生幾次切換日志報錯忽略
execute dbms_logstdby.build;
物理備庫上轉(zhuǎn)化為邏輯備用庫:
alter database recover to logical standby orcl; -- db_name 參數(shù)
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
備庫上修改參數(shù):
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';
備庫上創(chuàng)建備用日志:
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;
測試:
在主庫上創(chuàng)建:
create table scott.t4 (id int);
insert into scott.t4 values(4);
commit;
alter system switch logfile;
過一會兒 在邏輯備用庫上查詢:
select * from scott.t4;
檢查是否有相應的記錄產(chǎn)生,有則表示成功。
本文出自:億恩科技【mszdt.com】
服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|