creating oracle10g data guard using rman(physical db)

wisdomone1發表於2010-02-01
1,對主庫進行一個全庫備份(利用rman)
    backup as copy incremental level 0 database format '/oracle/rmanbak/%Ubak' tag 'test rman standby db';
2,根據主庫生成備庫pfile(且根據備庫實際情況修正相關引數)
    adding db_unique_name
   create pfile='/oracle/rmanbak/initrman.ora' from spfile;
3,啟動主庫到mount,利用rman生成備庫控制檔案,且之後進行歸檔操作
   startup force mount
   backup current controlfile format '/oracle/rmanbak/%D_u_rmancontrolbak';
   sql 'alter database open';
   sql 'alter system archive log curent';
   sql 'alter system switch logfile';
   backup archivelog all format '/oracle/rmanbak/%d_%u_archivebak';
4,把以上諸步生成的rman備份,利用scp傳到備庫對應目錄(為了簡易,我主備庫目錄結構完全一致,請根據pfile,依次構建dump及db_recovery_dest,儲存rman的目錄.
5,在備庫上,利用rman進行生成備庫
    注:先用以上生成的pfile,把備庫啟到nomount
       startup nomount pfile
    然後
       rman target sys/system@centos auxiliary sys/system
       
    最後貼上我真正開工的指令碼,供後記
-bash-3.1$ rman target sys/system@centos auxiliary  sys/system

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jan 30 23:51:31 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: CENTOS (DBID=3005679176)
connected to auxiliary database: CENTOS (not mounted)

RMAN> duplicate target database for standby nofilenamecheck;

Starting Duplicate Db at 30-JAN-10
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

contents of Memory Script.:
{
   restore clone standby controlfile;
   sql clone 'alter database mount standby database';
}
executing Memory Script

Starting restore at 30-JAN-10
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /oracle/rmanbak/CENTOS_standbyctl.bak
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/rmanbak/CENTOS_standbyctl.bak tag=TAG20100201T124043
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/oracle/oradata/centos/centos/control01.ctl
output filename=/oracle/oradata/centos/centos/control02.ctl
output filename=/oracle/oradata/centos/centos/control03.ctl
Finished restore at 30-JAN-10

sql statement: alter database mount standby database
released channel: ORA_AUX_DISK_1

contents of Memory Script.:
{
   set newname for datafile  1 to
 "/oracle/oradata/centos/centos/system01.dbf";
   set newname for datafile  2 to
 "/oracle/oradata/centos/centos/undotbs01.dbf";
   set newname for datafile  3 to
 "/oracle/oradata/centos/centos/sysaux01.dbf";
   set newname for datafile  4 to
 "/oracle/oradata/centos/centos/users01.dbf";
   set newname for datafile  9 to
 "/oracle/oradata/centos/centos/another1.dbf";
   restore
   check readonly
   clone database
   ;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-JAN-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

channel ORA_AUX_DISK_1: restoring datafile 00001
input datafile copy recid=1 stamp=709821048 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-SYSTEM_FNO-1_0hl4u0j2bak
destination for restore of datafile 00001: /oracle/oradata/centos/centos/system01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00001
output filename=/oracle/oradata/centos/centos/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002
input datafile copy recid=3 stamp=709821083 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-UNDOTBS1_FNO-2_0jl4u0kkbak
destination for restore of datafile 00002: /oracle/oradata/centos/centos/undotbs01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00002
output filename=/oracle/oradata/centos/centos/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003
input datafile copy recid=2 stamp=709821064 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-SYSAUX_FNO-3_0il4u0jrbak
destination for restore of datafile 00003: /oracle/oradata/centos/centos/sysaux01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00003
output filename=/oracle/oradata/centos/centos/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004
input datafile copy recid=4 stamp=709821089 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-USERS_FNO-4_0kl4u0l0bak
destination for restore of datafile 00004: /oracle/oradata/centos/centos/users01.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00004
output filename=/oracle/oradata/centos/centos/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00009
input datafile copy recid=5 stamp=709821090 filename=/oracle/rmanbak/data_D-CENTOS_I-3005679176_TS-ANOTHER_FNO-9_0ll4u0l2bak
destination for restore of datafile 00009: /oracle/oradata/centos/centos/another1.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00009
output filename=/oracle/oradata/centos/centos/another1.dbf
Finished restore at 30-JAN-10

contents of Memory Script.:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy recid=6 stamp=709689206 filename=/oracle/oradata/centos/centos/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=7 stamp=709689206 filename=/oracle/oradata/centos/centos/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=8 stamp=709689206 filename=/oracle/oradata/centos/centos/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=9 stamp=709689206 filename=/oracle/oradata/centos/centos/users01.dbf
datafile 9 switched to datafile copy
input datafile copy recid=10 stamp=709689206 filename=/oracle/oradata/centos/centos/another1.dbf
Finished Duplicate Db at 30-JAN-10

RMAN>



6,在新生成的備庫上,變更standby_file_management=auto,從主庫進行相關dml,檢視備庫是否正常,其它操作同以前,不再多述



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

相關文章