Oracle 11g 11.2.0.1 環境邏輯備庫搭建

來源:互聯網
上載者:User

首先建立物理備庫

參考:

 

建立物理備庫後,最好建立各自的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;

檢查是否有相應的記錄產生,有則表示成功。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.