实验平台:REDHATlinux4.7+oracle10g
目标库信息:
ORACLE_BASE:/u01/app/oracle
ORACLE_HOME:/u01/app/oracle/product/10.2.0/db_1
ORACLE_SID:orcl
IP:192.168.1.20
辅助库信息:
ORACLE_BASE:/u01/app/oracle
ORACLE_HOME:/u01/app/oracle/product/10.2.0/db_1
ORACLE_SID:orcl
IP:192.168.1.21
我们以实例名相同的为例,实例名不同也一样,在pfile里修改对应参数就可以了。
步骤如下:
(1)构建辅助数据库目录结构
(2)创建pfile,并复制到辅助数据库,修改相关内容
(3)创建辅助实例口令文件
(4)RMAN备份源库
(5)添加配置监听
(6)将源库备份文件拷贝到辅助库相同位置
(7)用pfile文件,将辅助数据库启动到nomount状态
(8)执行RMANduplicate命令复制数据库
(9)创建spfile文件
(10)在磁带上恢复备份
(11)使用DBNEWID程序生成新的DBID
一.构建辅助数据库目录结构
1.1Oracledata目录
[oracle@localhostoracle]$mkdiroradata
[oracle@localhostoracle]$ls
oradataoraInventoryproduct
[oracle@localhostoracle]$cdoradata/
[oracle@localhostoracle]$mkdirorcl
1.2其他目录
[oracle@localhostoracle]$pwd
/u01/app/oracle
[oracle@localhostoracle]$mkdiradmin
[oracle@localhostoracle]$ls
adminoradataoraInventoryproduct
[oracle@localhostoracle]$cdadmin
[oracle@localhostadmin]$ls
[oracle@localhostadmin]$mkdirorcl
[oracle@localhostadmin]$ls
orcl
[oracle@localhostadmin]$cdorcl
[oracle@localhostorcl]$mkdiradump
[oracle@localhostorcl]$mkdirbdump
[oracle@localhostorcl]$mkdircdump
[oracle@localhostorcl]$mkdirdpdump
[oracle@localhostorcl]$mkdirpfile
[oracle@localhostorcl]$mkdirudump
[oracle@localhostorcl]$ls
adumpbdumpcdumpdpdumppfileudump
二.创建pfile,复制到辅助数据库,并修改相关参数
2.1在源库上创建pfile文件
SQL>connsys/admin@orclassysdba;
Connected.
SQL>createpfilefromspfile;
Filecreated.
2.2用scp命令将pfile文件传到辅助库。要放在$ORACLE_HOME/dbs目录下,不然ORACLE不识别。
[oracle@db1orcl]$cd/u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@db1dbs]$ls
hc_DAVE.datinitdw.oralkDAVEorapworclspfileorcl.ora
hc_orcl.datinit.oralkORCLsnapcf_orcl.f
initDAVE.orainitorcl.oraorapwDAVEspfileDAVE.ora
[oracle@db1dbs]$scpinitorcl.ora192.168.1.21:/$ORACLE_HOME/dbs
Theauthenticityofhost'192.168.1.21(192.168.1.21)'can'tbeestablished.
RSAkeyfingerprintis1a:20:7a:05:bd:e0:ac:04:21:02:b1:72:01:69:40:d6.
Areyousureyouwanttocontinueconnecting(yes/no)?yes
Warning:Permanentlyadded'192.168.1.21'(RSA)tothelistofknownhosts.
oracle@192.168.1.21'spassword:
initorcl.ora100%11081.1KB/s00:00
2.3在辅助库上确认文件是否传送过来
[oracle@localhostorcl]$cd$ORACLE_HOME/dbs
[oracle@localhostdbs]$ls
initdw.orainit.orainitorcl.ora
2.4在辅助库上修改pfile参数
[oracle@localhostdbs]$moreinitorcl.ora
orcl.__db_cache_size=167772160
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__shared_pool_size=62914560
orcl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.compatible='10.2.0.1.0'
*.control_file_record_keep_time=14
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/or
adata/orcl/control02.ctl','/u01/app/oracle/oradata/orcl/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='location=/u01/archivelog'
*.open_cursors=300
*.pga_aggregate_target=81788928
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=246415360
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'
说明,在这里我没有做修改,因为我异机复制实例名相同,存储位置也相同。如果说你复制的不同的话,就需要修改相关的实例名。如果存储位置不同的话,还需要添加以下参数,对数据文件位置进行转换。
db_file_name_convert=('/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/DAVE')
三.创建辅助实例ORCL的口令文件
[oracle@localhostdbs]$cd$ORACLE_HOME/bin
[oracle@localhostbin]$orapwdfile=$ORACLE_HOME/dbs/orapworclpassword=admin
[oracle@localhostbin]$cd$ORACLE_HOME/dbs
[oracle@localhostdbs]$ls
initdw.orainit.orainitorcl.oraorapworcl
windows下oracle默认的位置是$ORACLE_HOME/database目录,文件名格式是pwdSID.ora。
linux下oracle默认的位置是$ORACLE_HOME/dbs目录,文件名格式是orapwSID。
创建完后,数据库需要重启动,新的口令文件才能生效。
关于口令文件创建,详细内容参考blog:
OracleOS认证口令文件密码丢失处理
http://blog.csdn.net/tianlesoftware/archive/2009/10/20/4698293.aspx
四.RMAN备份源库(orcl)
[oracle@db1backup]$rmantargetsys/admin@orcl
RecoveryManager:Release10.2.0.1.0-ProductiononSunJul1818:26:162010
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1248423599)
RMAN>RUN{
allocatechannelc1typedisk;
allocatechannelc2typedisk;
BACKUPFORMAT'/u02/backup/orcl_%U_%T'skipinaccessiblefilesperset5DATABASETAGorcl_hot_db_bk;
sql'altersystemarchivelogcurrent';
BACKUPFORMAT'/u02/backup/arch_%U_%T'skipinaccessiblefilesperset5ARCHIVELOGALLDELETEINPUT;
backupcurrentcontrolfiletag='bak_ctlfile'format='/u02/backup/ctl_file_%U_%T';
backupspfiletag='spfile'format='/u02/backup/ORCL_spfile_%U_%T';
releasechannelc2;
releasechannelc1;
}
五.添加,配置监听
5.1在辅助库的Listener.ora文件中,添加如下内容
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=PLSExtProc)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(PROGRAM=extproc)
)
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)
(SID_NAME=orcl)
)
)
5.2修改辅助库的tnsnames.ora文件,添加如下内容
TARGETORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.20)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=orcl)
)
)
ORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
)
(CONNECT_DATA=
(SERVICE_NAME=orcl)
)
)
5.3修改源库的tnsnames.ora文件,添加如下内容:
AUXORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.21)(PORT=1521))
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
六.将源库的备份拷贝到辅助数据库的相同位置
这里有两种方法,一种直接在辅助库上建相同的目录结构,在用SCP命令把这些备份文件copy过去,但是这样会占用大量的网络资源。还有一种就是建好目录结构后用NFS直接Mount上去。在这里我们用后面一种方法试一下。
6.1在辅助库上建相同的备份目录结构
因为我们在源库上备份是备份到/u02/backup目录中的,所以我们在辅助库上也建这个目录
[root@localhost/]#mkdir-p/u02/backup
[root@localhost/]#chownoracle/u02
[root@localhost/]#chmod777/u02
6.2将源库的备份挂载到辅助库上
6.2.1在源库上将/u02/backup目录添加到共享
[root@db1~]#more/etc/exports
/u02/backup192.168.1.21(rw,async,anonuid=65534,anongid=65534)
[root@db1~]#servicenfsstart
6.2.2在辅助库上挂载源库的目录,注意,mount命令必须以root用户执行
[root@localhost/]#mount-tnfs-orw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0
10.85.10.1:/u02/backup/u02/backup
--注意:在挂载NFS的时候,一定要加上-t-o参数,不然在RMAN复制的时候会报错:
--ORA-27054:NFSfilesystemwherethefileiscreatedorresidesisnotmountedwithcorrectoptions
[root@localhost/]#cd/u02/backup/
[root@localhostbackup]#ls
arch_3klj4676_1_1_20100718orcl_3hlj45vf_1_1_20100718
arch_3llj4676_1_1_20100718orcl_3ilj465c_1_1_20100718
ctl_file_3mlj467h_1_1_20100718orcl_3jlj4661_1_1_20100718
orcl_3glj45vf_1_1_20100718ORCL_spfile_3nlj467k_1_1_20100718
七.启动辅助库至nomount状态,注意使用pfile参数启动
[oracle@localhostdbs]$sqlplus/nolog
SQL*Plus:Release10.2.0.1.0-ProductiononTueJul2003:53:532010
Copyright(c)1982,2005,Oracle.Allrightsreserved.
SQL>conn/assysdba
Connectedtoanidleinstance.
SQL>startupnomountpfile=?/dbs/initorcl.ora
ORACLEinstancestarted.
TotalSystemGlobalArea247463936bytes
FixedSize1218772bytes
VariableSize79693612bytes
DatabaseBuffers163577856bytes
RedoBuffers2973696bytes
SQL>exit--启动后就退出session,因为在duplicata的时候不能有session连接
DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production
WiththePartitioning,OLAPandDataMiningoptions
八.RMAN连接到目标实例和辅助实例,运行duplicate命令复制数据库
[oracle@db1~]$rmantargetsys/admin@orclauxiliarysys/admin@auxorcl;
RecoveryManager:Release10.2.0.1.0-ProductiononSunJul1820:41:192010
Copyright(c)1982,2005,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1248423599)
connectedtoauxiliarydatabase:ORCL(notmounted)
RMAN>duplicatetargetdatabasetoORCLnofilenamecheck
2>logfile
3>'/u01/app/oracle/oradata/orcl/redo01.dbf'size50m,
4>'/u01/app/oracle/oradata/orcl/redo02.dbf'size50m,
5>'/u01/app/oracle/oradata/orcl/redo03.dbf'size50m;
注:这个地方有2个地方需要说明:
(1)Nofilenamecheck参数:
如果在复制时,位置不同时,我们会用参数db_file_name_convert对文件位置进行转换。但是在这个复制示例中我们用的是相同的位置。所以这里必须加上nofilenamecheck参数。该参数通知复制操作不必在执行还原操作前确认文件名是不同的。如果没有指定nofilenamecheck参数,rman会给出如下错误:
RMAN-05001:auxiliaryfilename/u01/app/oracle/oradata/orcl/example01.dbfconflictswithafileusedbythetargetdatabase
RMAN-05001:auxiliaryfilename/u01/app/oracle/oradata/orcl/users01.dbfconflictswithafileusedbythetargetdatabase
(2)logfile参数:
在完成复制进程并执行最有一条openresetlogs命令时,RMAN必须为辅助数据库构建全新的日志文件。如上面命令所示,我们可以在duplicate命令中指定logfile参数,并指定使用的日志文件的大小,数目和位置。
还可以在pfile里指定log_file_name_convert参数来进行转换。这种方法相对而言要简单一点。但因为我们在RMAN同机复制数据库的例子中用的就是这种方法,所以就换种方法来测试。
StartingDuplicateDbat18-JUL-10
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
allocatedchannel:ORA_AUX_DISK_1
channelORA_AUX_DISK_1:sid=155devtype=DISK
contentsofMemoryScript:
{
setuntilscn733545;
setnewnamefordatafile1to"/u01/app/oracle/oradata/orcl/system01.dbf";
setnewnamefordatafile2to"/u01/app/oracle/oradata/orcl/undotbs01.dbf";
setnewnamefordatafile3to"/u01/app/oracle/oradata/orcl/sysaux01.dbf";
setnewnamefordatafile4to"/u01/app/oracle/oradata/orcl/users01.dbf";
setnewnamefordatafile5to"/u01/app/oracle/oradata/orcl/example01.dbf";
restore
checkreadonly
clonedatabase;
}
executingMemoryScript
executingcommand:SETuntilclause
executingcommand:SETNEWNAME
executingcommand:SETNEWNAME
executingcommand:SETNEWNAME
executingcommand:SETNEWNAME
executingcommand:SETNEWNAME
Startingrestoreat18-JUL-10
usingchannelORA_AUX_DISK_1
channelORA_AUX_DISK_1:startingdatafilebackupsetrestore--开始restore数据文件
channelORA_AUX_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00002to/u01/app/oracle/oradata/orcl/undotbs01.dbf
restoringdatafile00003to/u01/app/oracle/oradata/orcl/sysaux01.dbf
restoringdatafile00005to/u01/app/oracle/oradata/orcl/example01.dbf
channelORA_AUX_DISK_1:readingfrombackuppiece/u02/backup/orcl_3plj4ejl_1_1_20100718
channelORA_AUX_DISK_1:restoredbackuppiece1
piecehandle=/u02/backup/orcl_3plj4ejl_1_1_20100718tag=ORCL_HOT_DB_BK
channelORA_AUX_DISK_1:restorecomplete,elapsedtime:00:01:48
channelORA_AUX_DISK_1:startingdatafilebackupsetrestore
channelORA_AUX_DISK_1:specifyingdatafile(s)torestorefrombackupset
restoringdatafile00001to/u01/app/oracle/oradata/orcl/system01.dbf
restoringdatafile00004to/u01/app/oracle/oradata/orcl/users01.dbf
channelORA_AUX_DISK_1:readingfrombackuppiece/u02/backup/orcl_3olj4ejk_1_1_20100718
channelORA_AUX_DISK_1:restoredbackuppiece1
piecehandle=/u02/backup/orcl_3olj4ejk_1_1_20100718tag=ORCL_HOT_DB_BK
channelORA_AUX_DISK_1:restorecomplete,elapsedtime:00:01:14
Finishedrestoreat18-JUL-10
sqlstatement:CREATECONTROLFILEREUSESETDATABASE"ORCL"RESETLOGSARCHIVELOG
--创建源库的控制文件,然后根据这个文件进行相关的恢复
MAXLOGFILES16
MAXLOGMEMBERS3
MAXDATAFILES100
MAXINSTANCES8
MAXLOGHISTORY292
LOGFILE
GROUP1'/u01/app/oracle/oradata/orcl/redo01.dbf'SIZE50M,
GROUP2'/u01/app/oracle/oradata/orcl/redo02.dbf'SIZE50M,
GROUP3'/u01/app/oracle/oradata/orcl/redo03.dbf'SIZE50M
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf'
CHARACTERSETWE8ISO8859P1
contentsofMemoryScript:
{
switchclonedatafileall;
}
executingMemoryScript
releasedchannel:ORA_AUX_DISK_1
datafile2switchedtodatafilecopy
inputdatafilecopyrecid=1stamp=724831148filename=/u01/app/oracle/oradata/orcl/undotbs01.dbf
datafile3switchedtodatafilecopy
inputdatafilecopyrecid=2stamp=724831148filename=/u01/app/oracle/oradata/orcl/sysaux01.dbf
datafile4switchedtodatafilecopy
inputdatafilecopyrecid=3stamp=724831148filename=/u01/app/oracle/oradata/orcl/users01.dbf
datafile5switchedtodatafilecopy
inputdatafilecopyrecid=4stamp=724831148filename=/u01/app/oracle/oradata/orcl/example01.dbf
contentsofMemoryScript:
{
setuntilscn733545;
recover
clonedatabase
deletearchivelog;
}
executingMemoryScript
executingcommand:SETuntilclause
Startingrecoverat18-JUL-10
allocatedchannel:ORA_AUX_DISK_1
channelORA_AUX_DISK_1:sid=155devtype=DISK
startingmediarecovery
channelORA_AUX_DISK_1:startingarchivelogrestoretodefaultdestination
channelORA_AUX_DISK_1:restoringarchivelog
archivelogthread=1sequence=46
channelORA_AUX_DISK_1:readingfrombackuppiece/u02/backup/arch_3tlj4er7_1_1_20100718
channelORA_AUX_DISK_1:restoredbackuppiece1
piecehandle=/u02/backup/arch_3tlj4er7_1_1_20100718tag=TAG20100718T205809
channelORA_AUX_DISK_1:restorecomplete,elapsedtime:00:00:01
channelORA_AUX_DISK_1:startingarchivelogrestoretodefaultdestination
channelORA_AUX_DISK_1:restoringarchivelog
archivelogthread=1sequence=45
channelORA_AUX_DISK_1:readingfrombackuppiece/u02/backup/arch_3slj4er7_1_1_20100718
channelORA_AUX_DISK_1:restoredbackuppiece1
piecehandle=/u02/backup/arch_3slj4er7_1_1_20100718tag=TAG20100718T205809
channelORA_AUX_DISK_1:restorecomplete,elapsedtime:00:00:02
archivelogfilename=/u01/archivelog/1_45_720642866.dbfthread=1sequence=45
channelclone_default:deletingarchivelog(s)
archivelogfilename=/u01/archivelog/1_45_720642866.dbfrecid=2stamp=724831155
archivelogfilename=/u01/archivelog/1_46_720642866.dbfthread=1sequence=46
channelclone_default:deletingarchivelog(s)
archivelogfilename=/u01/archivelog/1_46_720642866.dbfrecid=1stamp=724831153
mediarecoverycomplete,elapsedtime:00:00:02
Finishedrecoverat18-JUL-10
contentsofMemoryScript:
{
shutdownclone;
startupclonenomount;
--如果此时,辅助实例上有session连在上面,将一直等到session退出才能执行,如果等了很长时间还没有执行,不妨检查一下,有没有session连在数据库上。
}
executingMemoryScript
databasedismounted
Oracleinstanceshutdown
connectedtoauxiliarydatabase(notstarted)
Oracleinstancestarted
TotalSystemGlobalArea247463936bytes
FixedSize1218772bytes
VariableSize79693612bytes
DatabaseBuffers163577856bytes
RedoBuffers2973696bytes
sqlstatement:CREATECONTROLFILEREUSESETDATABASE"ORCL"RESETLOGSARCHIVELOG
--创建新的控制文件
MAXLOGFILES16
MAXLOGMEMBERS3
MAXDATAFILES100
MAXINSTANCES8
MAXLOGHISTORY292
LOGFILE
GROUP1'/u01/app/oracle/oradata/orcl/redo01.dbf'SIZE50M,
GROUP2'/u01/app/oracle/oradata/orcl/redo02.dbf'SIZE50M,
GROUP3'/u01/app/oracle/oradata/orcl/redo03.dbf'SIZE50M
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf'
CHARACTERSETWE8ISO8859P1
contentsofMemoryScript:
{
setnewnamefortempfile1to
"/u01/app/oracle/oradata/orcl/temp01.dbf";
switchclonetempfileall;
catalogclonedatafilecopy"/u01/app/oracle/oradata/orcl/undotbs01.dbf";
catalogclonedatafilecopy"/u01/app/oracle/oradata/orcl/sysaux01.dbf";
catalogclonedatafilecopy"/u01/app/oracle/oradata/orcl/users01.dbf";
catalogclonedatafilecopy"/u01/app/oracle/oradata/orcl/example01.dbf";
switchclonedatafileall;
}
executingMemoryScript
executingcommand:SETNEWNAME
renamedtemporaryfile1to/u01/app/oracle/oradata/orcl/temp01.dbfincontrolfile
catalogeddatafilecopydatafilecopyfilename=/u01/app/oracle/oradata/orcl/undotbs01.dbfrecid=1stamp=724831185
catalogeddatafilecopydatafilecopyfilename=/u01/app/oracle/oradata/orcl/sysaux01.dbfrecid=2stamp=724831186
catalogeddatafilecopydatafilecopyfilename=/u01/app/oracle/oradata/orcl/users01.dbfrecid=3stamp=724831186
catalogeddatafilecopydatafilecopyfilename=/u01/app/oracle/oradata/orcl/example01.dbfrecid=4stamp=724831186
datafile2switchedtodatafilecopy
inputdatafilecopyrecid=1stamp=724831185filename=/u01/app/oracle/oradata/orcl/undotbs01.dbf
datafile3switchedtodatafilecopy
inputdatafilecopyrecid=2stamp=724831186filename=/u01/app/oracle/oradata/orcl/sysaux01.dbf
datafile4switchedtodatafilecopy
inputdatafilecopyrecid=3stamp=724831186filename=/u01/app/oracle/oradata/orcl/users01.dbf
datafile5switchedtodatafilecopy
inputdatafilecopyrecid=4stamp=724831186filename=/u01/app/oracle/oradata/orcl/example01.dbf
contentsofMemoryScript:
{
Alterclonedatabaseopenresetlogs;
}
executingMemoryScript
executingMemoryScript
databaseopened
FinishedDuplicateDbat18-JUL-10
九.创建spfile,并验证数据库
通过上面8步的操作,复制操作已经完成。我们现在创建一个spfile。
SQL>createspfilefrompfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora';
Filecreated.
SQL>selectnamefromv$database;
NAME
---------
ORCL
SQL>selecttablespace_name,file_namefromdba_data_files;
TABLESPACE_NAMEFILE_NAME
-------------------------------------------------------------------------------
SYSTEM/u01/app/oracle/oradata/orcl/system01.dbf
UNDOTBS1/u01/app/oracle/oradata/orcl/undotbs01.dbf
SYSAUX/u01/app/oracle/oradata/orcl/sysaux01.dbf
USERS/u01/app/oracle/oradata/orcl/users01.dbf
EXAMPLE/u01/app/oracle/oradata/orcl/example01.dbf
十.在远程服务器上复制磁带备份
如果在远程服务器上复制磁带备份,必须配置辅助通道,以反映介质管理器的需求。除了指定介质管理器和用于常规通道的类或池外,还必须指定目标客户端名称,如下所示:
RMAN>configureauxiliarychannel1devicetypesbtparms="env=(nb_ora_serv=db1,nb_ora_client=db2)";
十一.使用DBNEWID适用程序的不完全复制
复制时最令人不满意的一点是不存在"可重启的复制",也就是说,如果在执行还原所有文件的步骤(复制进程中最常出错)时出错。比如在恢复操作期间出错,就必须再次重启复制进程并重新还原文件。我们无法修复复制进程(如使丢失的归档日志可用),只能重新开始整个过程。
将resoteoptimization选项设置为on,rman就不会在还原位置中再次还原具有相同数据文件头SCN信息文件。这也适合用于复制操作。如果复制操作还原一个文件,然后重新启动该复制操作,RMAN将不会再次还原该文件。然后,如果将一个归档日志应用于该文件,则会再次还原该归档日志。
在Oracle10g中,使用DBNEWID使用程序可以部分修复恢复进程,这个使用程序以安全和可控的方式为复制的数据库指定新的DBID。我们可以手工恢复复制的数据库,准备所有元素,然后再次运行DBNEWID实用程序完成由复制操作启动的进程。这就允许我们至少可以手工完成复制操作。
DBNEWID使用程序的用法很简单。首先,必须确认在使用实用程序前生成了有效的备份,尽管要执行验证备份的进程,但是在修改DBID期间仍然可能会遇到不可恢复的错误。确认备份有效后,还必须在一致的状态中关闭数据库,然后将数据库切换回加载状态。
使用示例如下:
SQL>shutdownimmediate
Databaseclosed.
Databasedismounted.
ORACLEinstanceshutdown.
SQL>startupmount;
ORACLEinstancestarted.
TotalSystemGlobalArea247463936bytes
FixedSize1218772bytes
VariableSize79693612bytes
DatabaseBuffers163577856bytes
RedoBuffers2973696bytes
Databasemounted.
SQL>!
[oracle@localhostu01]$nidtarget=/
DBNEWID:Release10.2.0.1.0-ProductiononTueJul2007:20:372010
Copyright(c)1982,2005,Oracle.Allrightsreserved.
ConnectedtodatabaseORCL(DBID=1252611919)
Connectedtoserverversion10.2.0
ControlFilesindatabase:
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/oradata/orcl/control02.ctl
/u01/app/oracle/oradata/orcl/control03.ctl
ChangedatabaseIDofdatabaseORCL?(Y/[N])=>y
Proceedingwithoperation
ChangingdatabaseIDfrom1252611919to1252672326
ControlFile/u01/app/oracle/oradata/orcl/control01.ctl-modified
ControlFile/u01/app/oracle/oradata/orcl/control02.ctl-modified
ControlFile/u01/app/oracle/oradata/orcl/control03.ctl-modified
Datafile/u01/app/oracle/oradata/orcl/system01.dbf-dbidchanged
Datafile/u01/app/oracle/oradata/orcl/undotbs01.dbf-dbidchanged
Datafile/u01/app/oracle/oradata/orcl/sysaux01.dbf-dbidchanged
Datafile/u01/app/oracle/oradata/orcl/users01.dbf-dbidchanged
Datafile/u01/app/oracle/oradata/orcl/example01.dbf-dbidchanged
Datafile/u01/app/oracle/oradata/orcl/temp01.dbf-dbidchanged
ControlFile/u01/app/oracle/oradata/orcl/control01.ctl-dbidchanged
ControlFile/u01/app/oracle/oradata/orcl/control02.ctl-dbidchanged
ControlFile/u01/app/oracle/oradata/orcl/control03.ctl-dbidchanged
Instanceshutdown
DatabaseIDfordatabaseORCLchangedto1252672326.
Allpreviousbackupsandarchivedredologsforthisdatabaseareunusable.
DatabaseisnotawareofpreviousbackupsandarchivedlogsinRecoveryArea.
Databasehasbeenshutdown,opendatabasewithRESETLOGSoption.
SuccesfullychangeddatabaseID.
DBNEWID-Completedsuccesfully.
本文转自东方之子736651CTO博客,原文链接: http://blog.51cto.com/ecloud/1323027,如需转载请自行联系原作者