RMAN實戰系列之一:用duplicate複製資料庫
rman實驗(1)
本文可以任意轉載,轉載時請務必以超連結形式標明文章原始出處和作者資訊及本宣告
http://blog.itpub.net/post/11/2317
RMAN實戰系列之一:用duplicate複製資料庫
源平臺:
windows 2000
hostname=host1
ORACLE_BASE=e:oracle
目標平臺:
windows 2000
hostname=host2
ORACLE_BASE=d:oracle
db_name=hyb
資料庫版本:Oracle 9.0.1
目的:在host2上覆制host1的資料庫
1. 假定在host2上已經安裝好了資料庫軟體,以OFA的結構建立新資料庫的目錄架構,把host1上的初始化引數檔案複製到host2上,修改以下引數:
control_files/user_dump_dest/ background_dump_dest/ core_dump_dest
以及其他必須的引數。如
background_dump_dest=D:oracleadminhybbdump
core_dump_dest=D:oracleadminhybcdump
user_dump_dest=D:oracleadminhybudump
control_files=("D:oracleoradatahybCONTROL01.CTL", "D:oracleoradatahybCONTROL02.CTL", "D:oracleoradatahybCONTROL03.CTL")
用oradim建立windows服務:
oradmin –new –sid hyb –pfile d:oracleadminhybpfileinit.ora
用orapwd建立密碼檔案:
orapwd file=d:oracleora90databasepwdhyb.ora password=oracle entries=5
2. 啟動sqlplus,建立spifle,並startup到nomount狀態
create spfile from pfile=’ d:oracleadminhybpfileinit.ora’;
startup nomount;
3. 在host1上全備份資料庫和歸檔日誌
rman>configure channel device type disk format “e:rman%t%U.bak”;
rman>backup database plus archivelog;
4. 在host2上e盤中建立rman目錄,把host1上的rman全備份複製到host2對應的rman目錄上。
5. 由於host2的目錄結構與host1不一致,使用SET NEWNAMW改變資料檔案的路徑,使用logfile子句修改重做日誌檔案的位置。
6. 啟動rman,連線到目標資料庫、恢復目錄資料庫和輔助資料庫。
7. 用命令DUPLICATE探測資料檔案的位置,使用rman提示符中顯示的指令碼:
rman>duplicate target database to hyb logfile 'D:ORACLEoradatahyb redo01.log' size 10m, 'D:ORACLEoradatahybredo02.log' size 10m nofilenamecheck;
上述命令會出錯:
RMAN-10035: exception raised in RPC: ORA-19624: 操作失敗,如果可能請重試
ORA-19504: 無法建立檔案"E:ORACLEORADATASIMISSIDB_RBS.ORA"
ORA-27040: skgfrcre: 建立錯誤,無法建立檔案
OSD-04002: 無法開啟檔案
O/S-Error: (OS 3) 系統找不到指定的路徑。
ORA-06512: 在"SYS.X$DBMS_BACKUP_RESTORE", line 1358
RMAN-10031: ORA-19624 occurred during call to DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE
無需理會,需要的是其中的指令碼:
正在列印儲存的指令碼: Memory Script
{
set until scn 766952815;
set newname for datafile 1 to
"D:ORACLEORADATASIMISSYSTEM01.DBF";
set newname for datafile 2 to
"D:ORACLEORADATASIMISUNDOTBS01.DBF";
set newname for datafile 3 to
"D:ORACLEORADATASIMISCWMLITE01.DBF";
set newname for datafile 4 to
"D:ORACLEORADATASIMISDRSYS01.DBF";
set newname for datafile 5 to
"D:ORACLEORADATASIMISEXAMPLE01.DBF";
set newname for datafile 6 to
"D:ORACLEORADATASIMISINDX01.DBF";
set newname for datafile 7 to
"D:ORACLEORADATASIMISTOOLS01.DBF";
set newname for datafile 8 to
"D:ORACLEORADATASIMISUSERS01.DBF";
set newname for datafile 9 to
"E:ORACLEORADATASIMISSIDB.ORA";
set newname for datafile 10 to
"E:ORACLEORADATASIMISYB.ORA";
set newname for datafile 11 to
"E:ORACLEORADATASIMISZS.ORA";
set newname for datafile 12 to
"E:ORACLEORADATASIMISFF.ORA";
set newname for datafile 13 to
"E:ORACLEORADATASIMISBM.ORA";
set newname for datafile 14 to
"E:ORACLEORADATASIMISSIDB_INDEX.ORA";
set newname for datafile 15 to
"E:ORACLEORADATASIMISPHOTO.ORA";
set newname for datafile 16 to
"E:ORACLEORADATASIMISHIS.ORA";
set newname for datafile 17 to
"E:ORACLEORADATASIMISSIDB_RBS.ORA";
set newname for datafile 18 to
"F:ORACLEORADATASIMISGRYSZM1994.ORA";
set newname for datafile 19 to
"F:ORACLEORADATASIMISGRYSZM1995.ORA";
set newname for datafile 20 to
"F:ORACLEORADATASIMISGRYSZM1996.ORA";
set newname for datafile 21 to
"F:ORACLEORADATASIMISGRYSZM1997.ORA";
set newname for datafile 22 to
"F:ORACLEORADATASIMISGRYSZM1998.ORA";
set newname for datafile 23 to
"F:ORACLEORADATASIMISGRYSZM1999.ORA";
set newname for datafile 24 to
"F:ORACLEORADATASIMISGRYSZM2000.ORA";
set newname for datafile 25 to
"F:ORACLEORADATASIMISGRYSZM2001.ORA";
set newname for datafile 26 to
"F:ORACLEORADATASIMISGRYSZM2002.ORA";
set newname for datafile 27 to
"F:ORACLEORADATASIMISGRYSZM2003.ORA";
set newname for datafile 28 to
"F:ORACLEORADATASIMISGRYSZM2004.ORA";
set newname for datafile 29 to
"F:ORACLEORADATASIMISGRYSZM2005.ORA";
set newname for datafile 30 to
"F:ORACLEORADATASIMISGRYSZM2006.ORA";
set newname for datafile 31 to
"F:ORACLEORADATASIMISGRYSZM2007.ORA";
set newname for datafile 32 to
"F:ORACLEORADATASIMISGRYSZM2008.ORA";
set newname for datafile 33 to
"F:ORACLEORADATASIMISGRYSZM_LOCAL_INDEX.ORA";
set newname for datafile 34 to
"F:ORACLEORADATASIMISGRYSZM_GLOBAL_INDEX.ORA";
restore
check readonly
clone database
;
}
把該指令碼複製到自己的run塊中,修改必要的部分,本例如下:
run
{
set until scn 766952815;
set newname for datafile 1 to
"D:ORACLEORADATAHYBSYSTEM01.DBF";
set newname for datafile 2 to
"D:ORACLEORADATAHYBUNDOTBS01.DBF";
set newname for datafile 3 to
"D:ORACLEORADATAHYBCWMLITE01.DBF";
set newname for datafile 4 to
"D:ORACLEORADATAHYBDRSYS01.DBF";
set newname for datafile 5 to
"D:ORACLEORADATAHYBEXAMPLE01.DBF";
set newname for datafile 6 to
"D:ORACLEORADATAHYBINDX01.DBF";
set newname for datafile 7 to
"D:ORACLEORADATAHYBTOOLS01.DBF";
set newname for datafile 8 to
"D:ORACLEORADATAHYBUSERS01.DBF";
set newname for datafile 9 to
"D:ORACLEORADATAHYBSIDB.ORA";
set newname for datafile 10 to
"D:ORACLEORADATAHYBYB.ORA";
set newname for datafile 11 to
"D:ORACLEORADATAHYBZS.ORA";
set newname for datafile 12 to
"D:ORACLEORADATAHYBFF.ORA";
set newname for datafile 13 to
"D:ORACLEORADATAHYBBM.ORA";
set newname for datafile 14 to
"D:ORACLEORADATAHYBSIDB_INDEX.ORA";
set newname for datafile 15 to
"D:ORACLEORADATAHYBPHOTO.ORA";
set newname for datafile 16 to
"D:ORACLEORADATAHYBHIS.ORA";
set newname for datafile 17 to
"D:ORACLEORADATAHYBSIDB_RBS.ORA";
set newname for datafile 18 to
"D:ORACLEORADATAHYBGRYSZM1994.ORA";
set newname for datafile 19 to
"D:ORACLEORADATAHYBGRYSZM1995.ORA";
set newname for datafile 20 to
"D:ORACLEORADATAHYBGRYSZM1996.ORA";
set newname for datafile 21 to
"D:ORACLEORADATAHYBGRYSZM1997.ORA";
set newname for datafile 22 to
"D:ORACLEORADATAHYBGRYSZM1998.ORA";
set newname for datafile 23 to
"D:ORACLEORADATAHYBGRYSZM1999.ORA";
set newname for datafile 24 to
"D:ORACLEORADATAHYBGRYSZM2000.ORA";
set newname for datafile 25 to
"D:ORACLEORADATAHYBGRYSZM2001.ORA";
set newname for datafile 26 to
"D:ORACLEORADATAHYBGRYSZM2002.ORA";
set newname for datafile 27 to
"D:ORACLEORADATAHYBGRYSZM2003.ORA";
set newname for datafile 28 to
"D:ORACLEORADATAHYBGRYSZM2004.ORA";
set newname for datafile 29 to
"D:ORACLEORADATAHYBGRYSZM2005.ORA";
set newname for datafile 30 to
"D:ORACLEORADATAHYBGRYSZM2006.ORA";
set newname for datafile 31 to
"D:ORACLEORADATAHYBGRYSZM2007.ORA";
set newname for datafile 32 to
"D:ORACLEORADATAHYBGRYSZM2008.ORA";
set newname for datafile 33 to
"D:ORACLEORADATAHYBGRYSZM_LOCAL_INDEX.ORA";
set newname for datafile 34 to
"D:ORACLEORADATAHYBGRYSZM_GLOBAL_INDEX.ORA";
duplicate target database to hyb
logfile 'D:ORACLEoradatahybredo01.log' size 10m,
'D:ORACLEoradatahybredo02.log' size 10m,
'D:ORACLEoradatahybredo03.log' size 10m
nofilenamecheck;
}
注意設定nofilenamecheck選項,不然會出現錯誤:
RMAN-05001: auxiliary filename F:ORACLEORADATASIMIS GRYSZM_GLOBAL_INDEX.ORA conflicts with a file used by the target database
複製上述指令碼在rman中執行,RMAN輸出如下:
正在執行命令: SET until clause
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
正在執行命令: SET NEWNAME
啟動 Duplicate Db 於 27-7月 -04
分配的通道: ORA_AUX_DISK_1
通道 ORA_AUX_DISK_1: sid=11 devtype=DISK
正在列印儲存的指令碼: Memory Script
{
set until scn 766952815;
set newname for datafile 1 to
"D:ORACLEORADATAHYBSYSTEM01.DBF";
set newname for datafile 2 to
"D:ORACLEORADATAHYBUNDOTBS01.DBF";
set newname for datafile 3 to
"D:ORACLEORADATAHYBCWMLITE01.DBF";
set newname for datafile 4 to
"D:ORACLEORADATAHYBDRSYS01.DBF";
set newname for datafile 5 to
"D:ORACLEORADATAHYBEXAMPLE01.DBF";
set newname for datafile 6 to
"D:ORACLEORADATAHYBINDX01.DBF";
set newname for datafile 7 to
"D:ORACLEORADATAHYBTOOLS01.DBF";
set newname for datafile 8 to
"D:ORACLEORADATAHYBUSERS01.DBF";
set newname for datafile 9 to
"D:ORACLEORADATAHYBSIDB.ORA";
set newname for datafile 10 to
"D:ORACLEORADATAHYBYB.ORA";
set newname for datafile 11 to
"D:ORACLEORADATAHYBZS.ORA";
set newname for datafile 12 to
"D:ORACLEORADATAHYBFF.ORA";
set newname for datafile 13 to
"D:ORACLEORADATAHYBBM.ORA";
set newname for datafile 14 to
"D:ORACLEORADATAHYBSIDB_INDEX.ORA";
set newname for datafile 15 to
"D:ORACLEORADATAHYBPHOTO.ORA";
set newname for datafile 16 to
"D:ORACLEORADATAHYBHIS.ORA";
set newname for datafile 17 to
"D:ORACLEORADATAHYBSIDB_RBS.ORA";
set newname for datafile 18 to
"D:ORACLEORADATAHYBGRYSZM1994.ORA";
set newname for datafile 19 to
"D:ORACLEORADATAHYBGRYSZM1995.ORA";
set newname for datafile 20 to
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/6906/viewspace-21545/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN高階應用之Duplicate複製資料庫(4)實戰資料庫
- 實戰10g新特性之rman duplicate複製資料庫資料庫
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- Rman duplicate資料庫複製(單系統)資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- RMAN高階應用之Duplicate複製資料庫(3)複製流程資料庫
- Oracle備份與恢復系列(四)續 RMAN Duplicate複製資料庫Oracle資料庫
- 使用RMAN高階應用之Duplicate複製資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- Oracle 11gR2 使用RMAN Duplicate複製資料庫Oracle資料庫
- Oracle11gR2使用RMAN duplicate複製資料庫Oracle資料庫
- RMAN高階應用之Duplicate複製資料庫(1)概述資料庫
- DG rman duplicate 複製庫錯誤
- Duplicate 複製資料庫實驗過程資料庫
- RMAN高階應用之Duplicate複製資料庫(5)補充資料庫
- Oracle 之 Duplicate 複製資料庫Oracle資料庫
- DUPLICATE遠端複製資料庫資料庫
- duplicate複製資料庫(rac-rac)資料庫
- RMAN複製資料庫(十)資料庫
- RMAN複製資料庫(九)資料庫
- RMAN複製資料庫(八)資料庫
- RMAN複製資料庫(七)資料庫
- RMAN複製資料庫(六)資料庫
- RMAN複製資料庫(五)資料庫
- RMAN複製資料庫(四)資料庫
- RMAN複製資料庫(三)資料庫
- RMAN複製資料庫(二)資料庫
- RMAN複製資料庫(一)資料庫
- 使用RMAN複製資料庫資料庫
- oracle rman複製資料庫Oracle資料庫
- Oracle 11gR2 使用 RMAN duplicate from active database 複製資料庫OracleDatabase資料庫
- RMAN高階應用之Duplicate複製資料庫(2)輔助例項資料庫
- 續上_在同一節點上利用rman duplicate複製資料庫資料庫
- RMAN 同機複製資料庫資料庫
- RMAN的活動資料庫複製資料庫