【遷移】使用rman遷移資料庫

yellowlee發表於2011-05-24
使用rman遷移資料庫

1源庫全備,然後備份控制檔案

backup format '/xxxx/xxxt/full_%s_%p_%t' database;

backup current controlfile format '/xxxx/xxx/control_%s_%p_%t';

 

2安裝目標庫軟體,且升級到版本與源庫一致

3源庫生成pfile,拷貝到目標庫,並修改控制檔案和dump檔案路徑

Create pfile from spfile;

 

Pfile內容:

test1.__db_cache_size=377487360

test1.__java_pool_size=4194304

TEST1.__large_pool_size=4194304

test1.__large_pool_size=4194304

test1.__shared_pool_size=209715200

test1.__streams_pool_size=0

*.audit_file_dest='/tpsys/oracle/admin/test1/adump'

*.background_dump_dest='/tpsys/oracle/admin/test1/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/tpdata/oradata/test1/control01.ctl','/tpdata/oradata/test1/control02.ctl','/tpdata/oradata/test1/control03.ctl'

*.core_dump_dest='/tpsys/oracle/admin/test1/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='test1'

*.db_recovery_file_dest='/tpsys/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=5368709120

*.dispatchers='(PROTOCOL=TCP) (SERVICE=test1XDB)'

*.job_queue_processes=10

*.log_archive_start=TRUE

*.open_cursors=300

*.pga_aggregate_target=199229440

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=598736896

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/tpsys/oracle/admin/test1/udump'

 

4在目標庫用rman restore控制檔案

startup nomount pfile=’xxxxx’;

restore controlfile from '/tpdata/oradata/test1/control_11_1_748094979';

 

5建立密碼檔案

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwtest1 password=sys

 

 

6,mount資料庫

Rman restore資料庫

run{

allocate channel t1 type disk;

allocate channel t2 type disk;

set newname for datafile '/tpsys/oracle/oradata/test1/system01.dbf'  to  '/tpdata/oradata/test1/system01.dbf'    ;

set newname for datafile '/tpsys/oracle/oradata/test1/undotbs01.dbf' to  '/tpdata/oradata/test1/undotbs01.dbf'   ;

set newname for datafile '/tpsys/oracle/oradata/test1/sysaux01.dbf'  to  '/tpdata/oradata/test1/sysaux01.dbf'    ;

set newname for datafile '/tpsys/oracle/oradata/test1/users01.dbf'   to  '/tpdata/oradata/test1/users01.dbf'     ;

set newname for datafile '/tpsys/oracle/oradata/test1/iasys.dbf'     to  '/tpdata/oradata/test1/iasys.dbf'       ;

restore database;

switch datafile all;

release channel t1;

release channel t2;

}

 

allocated channel: t1

channel t1: sid=155 devtype=DISK

 

allocated channel: t2

channel t2: sid=154 devtype=DISK

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting restore at 10-APR-11

 

channel t1: starting datafile backupset restore

channel t1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /tpdata/oradata/test1/system01.dbf

restoring datafile 00002 to /tpdata/oradata/test1/undotbs01.dbf

restoring datafile 00003 to /tpdata/oradata/test1/sysaux01.dbf

restoring datafile 00004 to /tpdata/oradata/test1/users01.dbf

restoring datafile 00005 to /tpdata/oradata/test1/iasys.dbf

channel t1: reading from backup piece /tpsys/oracle/flash_recovery_area/TEST1/backupset/2011_04_08/o1_mf_nnndf_TAG20110408T174321_6sxp5sm7_.bkp

channel t1: restored backup piece 1

piece handle=/tpsys/oracle/flash_recovery_area/TEST1/backupset/2011_04_08/o1_mf_nnndf_TAG20110408T174321_6sxp5sm7_.bkp tag=TAG20110408T174321

channel t1: restore complete, elapsed time: 00:03:24

Finished restore at 10-APR-11

 

datafile 1 switched to datafile copy

input datafile copy recid=6 stamp=748129430 filename=/tpdata/oradata/test1/system01.dbf

datafile 2 switched to datafile copy

input datafile copy recid=7 stamp=748129430 filename=/tpdata/oradata/test1/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy recid=8 stamp=748129430 filename=/tpdata/oradata/test1/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy recid=9 stamp=748129430 filename=/tpdata/oradata/test1/users01.dbf

datafile 5 switched to datafile copy

input datafile copy recid=10 stamp=748129430 filename=/tpdata/oradata/test1/iasys.dbf

 

released channel: t1

 

released channel: t2

 

RMAN>

7 恢復資料庫

recover database using BACKUP CONTROLFILE

從源庫拷貝必要的歸檔檔案,這裡按照rman的提示輸入歸檔名稱

如果缺少了歸檔:

recover database using BACKUP CONTROLFILE until cancel;

shutdown immediate

startup mount;

 

8 alter database open resetlogs

 

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

相關文章