萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> oracle教程 >> oracle 11gR2 邏輯備用數據庫搭建

oracle 11gR2 邏輯備用數據庫搭建

  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;

copyright © 萬盛學電腦網 all rights reserved