dataguard回顧之安裝———使用rman建立物理備庫

suifeng2316發表於2011-11-09

oracle version:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
[root@Yy228 ~]# uname -a
Linux Yy228 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux

本次試驗是在同一臺機上安裝的,具體步驟如下:
1,檢查主庫dg1是否啟用歸檔模式,並將設定成強制日誌模式。
SQL> alter database force logging;
2,使用rman備份主庫dg1,指令碼如下:

run{

allocate channel ch1 device type disk  ;

sql 'alter system switch logfile';

backup database tag 'fulbak_dbf' format ' /home1/zz/bak/FULLBAK_%d_%T_%s_%p.dbf'

include current controlfile;

sql 'alter system switch logfile';

backup archivelog  all delete all input tag 'fulbak_arch' format ' /home1/zz/bak/FULLBAK_%d_%T_%s.arch';

release channel ch1;

crosscheck backup;

delete noprompt obsolete;

delete noprompt expired backup;

crosscheck archivelog all;

delete noprompt expired archivelog all;

}

3,建立物理備庫控制檔案

alter database create standby controlfile as '/home1/zz/bak/standby.ctl'

4,建立跟蹤目錄

mkdir adump bdump cdump udump dpdump

5,配置網路,保證主備庫之間正常通訊

6,建立密碼檔案

檔名字一定規範,且密碼得一致

否則會出現錯誤:ORA-01031: insufficient privileges

orapwd file='/home/oracle/product/10.2.0/db_1/dbs/orapwddg2' password=xxx entries=5

7,建立備庫初始化引數檔案

將主庫的pfile檔案修改並新增以下引數

db_unique_name=dg2

log_archive_config='dg_config=(dg1,dg2)'

*.log_archive_dest_1='location=/home1/zz/arch_dg2

valid_for=(all_logfiles,all_roles)

db_unique_name=dg2'

log_archive_dest_2='service=dg1 lgwr async

valid_for=(online_logfiles,primary_role)

db_unique_name=dg1'

log_archive_dest_state_1=enable

log_archive_dest_state_2=enable

fal_server=dg1

fal_client=dg2

db_file_name_convert='/home/oracle/oradata/dg1','/home/oracle/oradata/dg2'

log_file_name_convert='/home/oracle/oradata/dg1','/home/oracle/oradata/dg2'

8,將第三步建立的備庫控制檔案移動到初始化引數檔案指定的位置

9,使用rman生成standby 資料庫

備庫必須啟動到nomout狀態

rman target sys/xxx@dg1 auxiliary /

RMAN> duplicate target database for standby;

 10,修改主庫的引數

alter system set db_unique_name=dg1 scope=spfile;

alter system set log_archive_config='dg_config=(dg1,dg2)';

alter system set log_archive_dest_1 ='location=/home1/zz/arch_dg1  valid_for=(all_logfiles,all_roles) db_unique_name=dg1';

alter system set log_archive_dest_2='service=dg2 lgwr async  valid_for=(online_logfiles,primary_role) db_unique_name=dg2';

alter system set fal_client=dg1;

alter system set fal_server=dg2;

alter system set db_file_name_convert='/home/oracle/oradata/dg1','/home/oracle/oradata/dg2' scope=spfile

alter system set log_file_name_convert='/home/oracle/oradata/dg1','/home/oracle/oradata/dg2' scope=spfile

由於前面備份主庫的時候將1112號歸檔檔案刪除了,而備庫需要這兩個歸檔檔案,

使用rman將其恢復restore archivelog from sequence 11;

11, 將備庫啟動redo 應用

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

此時物理備庫搭建完畢!


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23073818/viewspace-710475/,如需轉載,請註明出處,否則將追究法律責任。

相關文章