基於 RMAN 的同機資料庫克隆
Oracle資料庫克隆,也叫著Oracle資料庫複製,可以透過基於使用者管理的方式來完成,也可以基於RMAN方式來實現。而且Oracle建議使用RMAN方式來實現,因為它簡單易用,隱藏其複雜的邏輯,僅僅是執行一條duplicate命令就可以喝茶了。當然,前期的準備工作也是不可少滴,如建立相應的dump目錄,準備引數檔案,配置監聽等等。本文描述了Oracle 11g下如何使用RMAN實現同機克隆資料庫。
1、RMAN克隆的幾種型別
a、利用RMAN備份克隆並訪問目標資料庫(也就是原資料庫),也就是複製期間由Oracle net與目標資料庫保持連線
b、利用RMAN備份克隆不訪問目標資料庫,比如網路不通阿,目標資料庫不可用等等,總之是人為或故障使得與目標庫失去連線
c、直接使用活動資料庫(active)進行克隆,實時備份加克隆,夠牛滴!
2、RMAN克隆做了什麼?
RMAN克隆根據需要連線或不連線到目標資料庫後,需要連線一個輔助例項。這個輔助例項也就是我們複製後的例項。
我們知道任何一個資料庫至少有一個例項與之對應,如果是RAC環境則可以多個例項對應一個資料庫。
因此,我們在克隆資料庫之前先建一個nomount狀態的輔助例項用於分配記憶體等等一系列的後臺程式啦。
有了例項就好辦啦,RMAN為這個輔助例項生成控制檔案,基於這個例項上還原資料庫,恢復資料庫等等不拉不拉的N多操作。
那這個N多操作靠誰呢,那就是釋出命令: duplicate target databaseto aux_db
那RMAN如何連線到輔助例項呢? 與連線target或catalog方式類似,connect auxiliary name/pwd@tnsstring
通常情況下,對於磁碟備份還原操作,RMAN會自動建立及分配相應的通道,輔助例項也不例外,當然是自動分配輔助通道
而在磁帶介質就麻煩一點了,需要手工來指定其通道,並行度等等。
下面簡要描述一下RMAN克隆不同階段都作了什麼吧,關於克隆資料庫時資料檔案位置轉換請參考: RMAN 資料庫克隆檔案位置轉換方法
a、RMAN確定備份的屬性,位置等等,也就備份存在性,可用等等了。
b、RMAN為輔助例項分配通道及輔助通道的引數設定
c、RMAN還原資料檔案到輔助例項(此時使用了目標資料庫控制檔案)
d、RMAN構建輔助例項的控制檔案
e、根據需要還原歸檔日誌並進行相應的介質恢復
f、重置輔助例項的dbid,並使用open resetlog方式開啟資料庫,此時會建立相應的聯機重做日誌檔案
3、RMAN克隆大致步驟
a、備份目標資料庫(根據需要克隆型別而定,異機的話ftp一下,此步也可以置於步驟e之後,f之前)
b、建立相應的dump資料夾
c、配置輔助例項引數檔案
d、生成輔助例項密碼檔案
e、配置輔助例項監聽
f、實施資料庫克隆(輔助例項啟動到nomount狀態後)
h、驗證結果
4、RMAN同機克隆親密接觸
- --環境:
- --目標資料庫: sybo3 /u01/database/sybo3
- --輔助資料庫: sybo5 /u01/database/sybo5
- --說明:
- --對於下面描述過程中,如建立引數檔案,密碼檔案,監聽等等有不甚瞭解的,可參考下面連結中有關文章的描述。其次本次演示使用了備份檔案並連線到target db
- --http://blog.csdn.net/robinson_0612/article/category/827734 (體系結構相關)
- --http://blog.csdn.net/robinson_0612/article/category/828434 (網路配置相關)
- [oracle@linux3 database]$ cat /etc/issue
- Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
- Kernel \r on an \m
- SQL> select * from v$version where rownum<2;
- BANNER
- --------------------------------------------------------------------------------
- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- a、備份目標資料庫
- --生成後續驗證克隆成功的測試資料
- SQL> insert into t select 'Jackson','Transfer DB by rman' from dual;
- SQL> commit;
- SQL> select * from t;
- NAME ACTION
- ---------- --------------------
- Robinson Transfer DB
- Jackson Transfer DB by rman
- SQL> alter system archive log current;
- [oracle@linux3 ~]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 25 08:39:42 2013
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: SYBO3 (DBID=2347733014)
- RMAN> backup database include current controlfile plus archivelog delete input;
- piece handle=/u01/database/sybo3/flash_recovery_area/SYBO3/backupset/2013_07_25/o1_mf_annnn_TAG20130725T083957_8z0wyy9n_.bkp
- tag=TAG20130725T083957 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
- piece handle=/u01/database/sybo3/flash_recovery_area/SYBO3/backupset/2013_07_25/o1_mf_nnndf_TAG20130725T083959_8z0wz06c_.bkp
- tag=TAG20130725T083959 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:01:30
- Finished backup at 2013/07/25 08:41:29
- Starting Control File and SPFILE Autobackup at 2013/07/25 08:41:31
- piece handle=/u01/database/sybo3/flash_recovery_area/SYBO3/autobackup/2013_07_25/o1_mf_s_821695291_8z0x1vsf_.bkp comment=NONE
- Finished Control File and SPFILE Autobackup at 2013/07/25 08:41:34
- b、建立相應的dump資料夾
- [oracle@linux3 database]$ more sybo5.sh
- #!/bin/sh
- mkdir -p /u01/database
- mkdir -p /u01/database/sybo5/adump
- mkdir -p /u01/database/sybo5/controlf
- mkdir -p /u01/database/sybo5/flash_recovery_area
- mkdir -p /u01/database/sybo5/oradata
- mkdir -p /u01/database/sybo5/redo
- mkdir -p /u01/database/sybo5/dpdump
- mkdir -p /u01/database/sybo5/pfile
- [oracle@linux3 database]$ ./sybo5.sh
- c、配置輔助例項引數檔案
- --在sqlplus下生成輔助例項的引數檔案
- SQL> create pfile='/u01/oracle/db_1/dbs/initsybo5.ora' from spfile;
- --修改輔助例項引數檔案
- $ sed -i 's/sybo3/sybo5/g' $ORACLE_HOME/dbs/initsybo5.ora
- $ grep sybo3 $ORACLE_HOME/dbs/initsybo5.ora -->校驗是否還存在sybo3相關字元
- --下面是修改後最終的結果
- [oracle@linux3 database]$ more $ORACLE_HOME/dbs/initsybo5.ora
- sybo5.__db_cache_size=113246208
- sybo5.__java_pool_size=4194304
- sybo5.__large_pool_size=4194304
- sybo5.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
- sybo5.__pga_aggregate_target=142606336
- sybo5.__sga_target=234881024
- sybo5.__shared_io_pool_size=0
- sybo5.__shared_pool_size=104857600
- sybo5.__streams_pool_size=0
- *.audit_file_dest='/u01/database/sybo5/adump/'
- *.audit_trail='db'
- *.compatible='11.2.0.0.0'
- *.control_files='/u01/database/sybo5/controlf/control01.ctl','/u01/database/sybo5/controlf/control02.ctl'
- *.db_block_size=8192
- *.db_domain='orasrv.com'
- *.db_name='sybo5'
- *.db_recovery_file_dest='/u01/database/sybo5/flash_recovery_area/'
- *.db_recovery_file_dest_size=4039114752
- *.dg_broker_config_file1='/u01/database/sybo5/db_broker/dr1sybo5.dat'
- *.dg_broker_config_file2='/u01/database/sybo5/db_broker/dr2sybo5.dat'
- *.dg_broker_start=FALSE
- *.diagnostic_dest='/u01/database/sybo5'
- *.log_archive_dest_1='' #此處未指定archive位置,使用預設的閃回區
- *.memory_target=374341632
- *.open_cursors=300
- *.processes=150
- *.remote_login_passwordfile='EXCLUSIVE'
- *.undo_tablespace='UNDOTBS1'
- d、生成輔助例項密碼檔案
- --直接使用orapwd命令完成
- $ orapwd file=$ORACLE_HOME/dbs/orapwsybo5 password=oracle entries=10
- e、配置輔助例項監聽
- --配置輔助例項的監聽方式很多,如netca,netmgr,直接命令方式等等,下面直接給出的指令碼
- [oracle@linux3 ~]$ more $ORACLE_HOME/network/admin/listener.ora
- # listener.ora Network Configuration File: /u01/oracle/db_1/network/admin/listener.ora
- # Generated by Oracle configuration tools.
- SID_LIST_LISTENER_SYBO5 =
- (SID_LIST =
- (SID_DESC =
- (GLOBAL_DBNAME = sybo5.orasrv.com)
- (ORACLE_HOME = /u01/oracle/db_1)
- (SID_NAME = sybo5)
- )
- )
- SID_LIST_LISTENER_SYBO3 =
- (SID_LIST =
- (SID_DESC =
- (GLOBAL_DBNAME = sybo3.orasrv.com)
- (ORACLE_HOME = /u01/oracle/db_1)
- (SID_NAME = sybo3)
- )
- )
- LISTENER_SYBO5 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = linux3.orasrv.com)(PORT = 1532))
- )
- ADR_BASE_LISTENER_SYBO5 = /u01/oracle
- LISTENER_SYBO3 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = linux3.orasrv.com)(PORT = 1531))
- )
- ADR_BASE_LISTENER_SYBO3 = /u01/oracle
- [oracle@linux3 ~]$ more $ORACLE_HOME/network/admin/tnsnames.ora
- # tnsnames.ora Network Configuration File: /u01/oracle/db_1/network/admin/tnsnames.ora
- # Generated by Oracle configuration tools.
- SYBO5 =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.25)(PORT = 1532))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = SYBO5.ORASRV.COM)
- )
- )
- SYBO3 =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.25)(PORT = 1531))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = SYBO3.ORASRV.COM)
- )
- )
- f、實施資料庫克隆
- --下面先啟動輔助例項到nomount狀態
- [oracle@linux3 ~]$ export ORACLE_SID=sybo5
- [oracle@linux3 ~]$ sqlplus / as sysdba
- SQL> startup nomount pfile=/u01/oracle/db_1/dbs/initsybo5.ora;
- ORACLE instance started.
- --呼叫RMAN連線到目標資料庫與輔助資料庫
- [oracle@linux3 ~]$ rman target sys/oracle@sybo3 auxiliary sys/oracle@sybo5
- Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 25 14:32:51 2013
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: SYBO3 (DBID=2347733014)
- connected to auxiliary database: SYBO5 (not mounted)
- RMAN> run{
- 2> set newname for datafile 1 to '/u01/database/sybo5/oradata/system01.dbf';
- 3> set newname for datafile 2 to '/u01/database/sybo5/oradata/sysaux01.dbf';
- 4> set newname for datafile 3 to '/u01/database/sybo5/oradata/undotbs01.dbf';
- 5> set newname for datafile 4 to '/u01/database/sybo5/oradata/users01.dbf';
- 6> set newname for datafile 5 to '/u01/database/sybo5/oradata/example01.dbf';
- 7> set newname for tempfile 1 to '/u01/database/sybo5/oradata/temp01.dbf';
- 8> duplicate target database to sybo5
- 9> logfile
- 10> group 1 ('/u01/database/sybo5/redo/redo01a.log','/u01/database/sybo5/redo/redo01b.log') size 10m,
- 11> group 2 ('/u01/database/sybo5/redo/redo02a.log','/u01/database/sybo5/redo/redo02b.log') size 10m,
- 12> group 3 ('/u01/database/sybo5/redo/redo03a.log','/u01/database/sybo5/redo/redo03b.log') size 10m;
- 13> switch datafile all;
- 14> }
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- Starting Duplicate Db at 2013/07/25 14:33:14
- using target database control file instead of recovery catalog ---->使用了原資料庫的控制檔案
- allocated channel: ORA_AUX_DISK_1
- channel ORA_AUX_DISK_1: SID=134 device type=DISK
- contents of Memory Script: ------->Oracle會自動生成auxiliary db的spfile
- {
- sql clone "create spfile from memory";
- }
- executing Memory Script
- sql statement: create spfile from memory
- contents of Memory Script: ------->下面的SQL使用spfile重啟auxiliary db到nomount狀態
- {
- shutdown clone immediate;
- startup clone nomount;
- }
- executing Memory Script
- Oracle instance shut down
- connected to auxiliary database (not started)
- Oracle instance started
- Total System Global Area 376635392 bytes
- Fixed Size 1336652 bytes
- Variable Size 260049588 bytes
- Database Buffers 109051904 bytes
- Redo Buffers 6197248 bytes
- contents of Memory Script: ----->下面的這段SQL完成了一系列任務,見後面的分解
- {
- sql clone "alter system set db_name =
- ''SYBO3'' comment=
- ''Modified by RMAN duplicate'' scope=spfile";
- sql clone "alter system set db_unique_name =
- ''SYBO5'' comment=
- ''Modified by RMAN duplicate'' scope=spfile";
- shutdown clone immediate;
- startup clone force nomount
- restore clone primary controlfile;
- alter clone database mount;
- }
- executing Memory Script
- sql statement: alter system set db_name = ''SYBO3'' comment= ''Modified by RMAN duplicate'' scope=spfile -->修改db_name
- sql statement: alter system set db_unique_name = ''SYBO5'' comment= ''Modified by RMAN duplicate'' scope=spfile -->修改db_unique_name
- Oracle instance shut down
- Oracle instance started
- Total System Global Area 376635392 bytes
- Fixed Size 1336652 bytes
- Variable Size 260049588 bytes
- Database Buffers 109051904 bytes
- Redo Buffers 6197248 bytes
- Starting restore at 2013/07/25 14:33:29 --->開始restore
- allocated channel: ORA_AUX_DISK_1
- channel ORA_AUX_DISK_1: SID=134 device type=DISK
- channel ORA_AUX_DISK_1: starting datafile backup set restore
- channel ORA_AUX_DISK_1: restoring control file --->首先restore controlfile
- channel ORA_AUX_DISK_1: reading from backup piece /u01/database/sybo3/flash_recovery_area/SYBO3/autobackup/2013_07_25/
- o1_mf_s_821695291_8z0x1vsf_.bkp
- channel ORA_AUX_DISK_1: piece handle=/u01/database/sybo3/flash_recovery_area/SYBO3/autobackup/2013_07_25/
- o1_mf_s_821695291_8z0x1vsf_.bkp tag=TAG20130725T084131
- channel ORA_AUX_DISK_1: restored backup piece 1
- channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 -->controlfile restore完成
- output file name=/u01/database/sybo5/controlf/control01.ctl -->output到的位置
- output file name=/u01/database/sybo5/controlf/control02.ctl -->注意此時的控制檔案中記錄的資訊依舊是sybo3的,即target db
- Finished restore at 2013/07/25 14:33:30
- database mounted -->資料庫切換到mount狀態,對應語句alter clone database mount
- contents of Memory Script: -->這些SQL語句用於設定auxiliary db 資料檔案位置
- {
- set until scn 886687; -->Oracle自動設定了相應的scn
- set newname for datafile 1 to
- "/u01/database/sybo5/oradata/system01.dbf";
- set newname for datafile 2 to
- "/u01/database/sybo5/oradata/sysaux01.dbf";
- set newname for datafile 3 to
- "/u01/database/sybo5/oradata/undotbs01.dbf";
- set newname for datafile 4 to
- "/u01/database/sybo5/oradata/users01.dbf";
- set newname for datafile 5 to
- "/u01/database/sybo5/oradata/example01.dbf";
- restore --> 釋出restore命令
- clone database
- ;
- }
- executing Memory Script
- executing command: SET until clause
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- executing command: SET NEWNAME
- Starting restore at 2013/07/25 14:33:35 -->開始資料檔案的restore
- using channel ORA_AUX_DISK_1 -->根據控制檔案的資訊讀取備份集並還原到set newname位置
- channel ORA_AUX_DISK_1: starting datafile backup set restore
- channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
- channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/database/sybo5/oradata/system01.dbf
- channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/database/sybo5/oradata/sysaux01.dbf
- channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/database/sybo5/oradata/undotbs01.dbf
- channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/database/sybo5/oradata/users01.dbf
- channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/database/sybo5/oradata/example01.dbf
- channel ORA_AUX_DISK_1: reading from backup piece /u01/database/sybo3/flash_recovery_area/SYBO3/backupset/2013_07_25/
- o1_mf_nnndf_TAG20130725T083959_8z0wz06c_.bkp
- channel ORA_AUX_DISK_1: piece handle=/u01/database/sybo3/flash_recovery_area/SYBO3/backupset/2013_07_25/
- o1_mf_nnndf_TAG20130725T083959_8z0wz06c_.bkp tag=TAG20130725T083959
- channel ORA_AUX_DISK_1: restored backup piece 1
- channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15 -->完成資料檔案restore
- Finished restore at 2013/07/25 14:34:50
- contents of Memory Script: -->下面的指令碼將新的資料檔案全部更新到控制檔案
- {
- switch clone datafile all;
- }
- executing Memory Script
- datafile 1 switched to datafile copy
- input datafile copy RECID=7 STAMP=821716490 file name=/u01/database/sybo5/oradata/system01.dbf
- datafile 2 switched to datafile copy
- input datafile copy RECID=8 STAMP=821716491 file name=/u01/database/sybo5/oradata/sysaux01.dbf
- datafile 3 switched to datafile copy
- input datafile copy RECID=9 STAMP=821716491 file name=/u01/database/sybo5/oradata/undotbs01.dbf
- datafile 4 switched to datafile copy
- input datafile copy RECID=10 STAMP=821716491 file name=/u01/database/sybo5/oradata/users01.dbf
- datafile 5 switched to datafile copy
- input datafile copy RECID=11 STAMP=821716491 file name=/u01/database/sybo5/oradata/example01.dbf
- contents of Memory Script: -->下面的指令碼Oracle自動設定了scn後釋出recover命令
- {
- set until scn 886687;
- recover
- clone database
- delete archivelog
- ;
- }
- executing Memory Script
- executing command: SET until clause
- Starting recover at 2013/07/25 14:34:51 -->下面使用archivelog進行recover
- using channel ORA_AUX_DISK_1
- starting media recovery
- archived log for thread 1 with sequence 16 is already on disk as file /u01/database/sybo3/flash_recovery_area/SYBO3/
- archivelog/2013_07_25/o1_mf_1_16_8z16rk6o_.arc -->此時運用到了一個sybo3已經存在的歸檔日誌,sequence 為16
- channel ORA_AUX_DISK_1: starting archived log restore to default destination -->接下來還原歸檔日誌到預設位置
- channel ORA_AUX_DISK_1: restoring archived log
- archived log thread=1 sequence=15 -->從備份的歸檔日誌中讀取 sequence為15 的
- channel ORA_AUX_DISK_1: reading from backup piece /u01/database/sybo3/flash_recovery_area/SYBO3/backupset/2013_07_25/
- o1_mf_annnn_TAG20130725T084129_8z0x1syh_.bkp
- channel ORA_AUX_DISK_1: piece handle=/u01/database/sybo3/flash_recovery_area/SYBO3/backupset/2013_07_25/
- o1_mf_annnn_TAG20130725T084129_8z0x1syh_.bkp tag=TAG20130725T084129
- channel ORA_AUX_DISK_1: restored backup piece 1
- channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
- archived log file name=/u01/database/sybo5/flash_recovery_area/SYBO5/archivelog/2013_07_25/o1_mf_1_15_8z1krh5x_.arc thread=1 sequence=15
- channel clone_default: deleting archived log(s) -->刪除歸檔日誌
- archived log file name=/u01/database/sybo5/flash_recovery_area/SYBO5/archivelog/2013_07_25/o1_mf_1_15_8z1krh5x_.arc RECID=12 STAMP=821716495
- archived log file name=/u01/database/sybo3/flash_recovery_area/SYBO3/archivelog/2013_07_25/o1_mf_1_16_8z16rk6o_.arc thread=1 sequence=16
- media recovery complete, elapsed time: 00:00:04 -->介質恢復完成
- Finished recover at 2013/07/25 14:35:00
- contents of Memory Script: -->下面的指令碼用於還原恢復之後的後續工作
- { -->包括重新設定db_name,db_unique_name
- shutdown clone immediate;
- startup clone nomount;
- sql clone "alter system set db_name =
- ''SYBO5'' comment=
- ''Reset to original value by RMAN'' scope=spfile";
- sql clone "alter system reset db_unique_name scope=spfile";
- shutdown clone immediate;
- startup clone nomount;
- }
- executing Memory Script
- database dismounted
- Oracle instance shut down
- --Author: Robinson
- --Blog : http://blog.csdn.net/robinson_0612
- connected to auxiliary database (not started)
- Oracle instance started
- Total System Global Area 376635392 bytes
- Fixed Size 1336652 bytes
- Variable Size 260049588 bytes
- Database Buffers 109051904 bytes
- Redo Buffers 6197248 bytes
- sql statement: alter system set db_name = ''SYBO5'' comment= ''Reset to original value by RMAN'' scope=spfile
- sql statement: alter system reset db_unique_name scope=spfile
- Oracle instance shut down
- connected to auxiliary database (not started)
- Oracle instance started
- Total System Global Area 376635392 bytes
- Fixed Size 1336652 bytes
- Variable Size 260049588 bytes
- Database Buffers 109051904 bytes
- Redo Buffers 6197248 bytes
- sql statement: CREATE CONTROLFILE REUSE SET DATABASE "SYBO5" RESETLOGS ARCHIVELOG -->注意這裡,重新建立控制檔案
- MAXLOGFILES 16
- MAXLOGMEMBERS 3
- MAXDATAFILES 100
- MAXINSTANCES 8
- MAXLOGHISTORY 292
- LOGFILE
- GROUP 1 ( '/u01/database/sybo5/redo/redo01a.log', '/u01/database/sybo5/redo/redo01b.log' ) SIZE 10 M ,
- GROUP 2 ( '/u01/database/sybo5/redo/redo02a.log', '/u01/database/sybo5/redo/redo02b.log' ) SIZE 10 M ,
- GROUP 3 ( '/u01/database/sybo5/redo/redo03a.log', '/u01/database/sybo5/redo/redo03b.log' ) SIZE 10 M
- DATAFILE
- '/u01/database/sybo5/oradata/system01.dbf'
- CHARACTER SET AL32UTF8
- contents of Memory Script:
- {
- set newname for tempfile 1 to
- "/u01/database/sybo5/oradata/temp01.dbf";
- switch clone tempfile all;
- catalog clone datafilecopy "/u01/database/sybo5/oradata/sysaux01.dbf",
- "/u01/database/sybo5/oradata/undotbs01.dbf",
- "/u01/database/sybo5/oradata/users01.dbf",
- "/u01/database/sybo5/oradata/example01.dbf";
- switch clone datafile all;
- }
- executing Memory Script
- executing command: SET NEWNAME
- renamed tempfile 1 to /u01/database/sybo5/oradata/temp01.dbf in control file
- cataloged datafile copy
- datafile copy file name=/u01/database/sybo5/oradata/sysaux01.dbf RECID=1 STAMP=821716521
- cataloged datafile copy
- datafile copy file name=/u01/database/sybo5/oradata/undotbs01.dbf RECID=2 STAMP=821716521
- cataloged datafile copy
- datafile copy file name=/u01/database/sybo5/oradata/users01.dbf RECID=3 STAMP=821716521
- cataloged datafile copy
- datafile copy file name=/u01/database/sybo5/oradata/example01.dbf RECID=4 STAMP=821716521
- datafile 2 switched to datafile copy
- input datafile copy RECID=1 STAMP=821716521 file name=/u01/database/sybo5/oradata/sysaux01.dbf
- datafile 3 switched to datafile copy
- input datafile copy RECID=2 STAMP=821716521 file name=/u01/database/sybo5/oradata/undotbs01.dbf
- datafile 4 switched to datafile copy
- input datafile copy RECID=3 STAMP=821716521 file name=/u01/database/sybo5/oradata/users01.dbf
- datafile 5 switched to datafile copy
- input datafile copy RECID=4 STAMP=821716521 file name=/u01/database/sybo5/oradata/example01.dbf
- contents of Memory Script:
- {
- Alter clone database open resetlogs;
- }
- executing Memory Script
- database opened
- Finished Duplicate Db at 2013/07/25 14:35:36
- --驗證克隆的結果
- [oracle@linux3 dbs]$ export ORACLE_SID=sybo5
- [oracle@linux3 dbs]$ sqlplus / as sysdba
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 25 14:38:21 2013
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- Connected to:
- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- SQL> select * from t;
- NAME ACTION
- ---------- --------------------
- Robinson Transfer DB
- Jackson Transfer DB by rman
- SQL> select name,dbid,open_mode from v$database; -->使用了與之前資料庫不同的dbid
- NAME DBID OPEN_MODE
- --------- ---------- --------------------
- SYBO5 2292457546 READ WRITE
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23490154/viewspace-1062386/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN 同機複製資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- 克隆資料庫之RMAN複製(二)資料庫
- 克隆資料庫之RMAN複製(一)資料庫
- 基於RMAN 建立測試資料庫資料庫
- rman 可否克隆rac資料庫到另外一個rac環境的資料庫中?資料庫
- RMAN基於時間點恢復Oracle資料庫Oracle資料庫
- 2.10 克隆資料庫資料庫
- 使用duplicate克隆資料庫資料庫
- RMAN 異機複製資料庫資料庫
- RMAN 資料庫克隆檔案位置轉換方法資料庫
- 靜默建立oracle資料庫及克隆資料庫Oracle資料庫
- 資料庫開發(19)基於物件的資料庫資料庫物件
- 使用RMAN遷移資料庫到異機資料庫
- 2.10.1.2 使用CloneDB克隆資料庫資料庫
- EBS R12克隆 - Oracle11.2.0.3 EBS資料庫克隆(RMAN恢復) 3Oracle資料庫
- EBS R12克隆 - Oracle11.2.0.3 EBS資料庫克隆(RMAN恢復) 2Oracle資料庫
- EBS R12克隆 - Oracle11.2.0.3 EBS資料庫克隆(RMAN恢復) 1Oracle資料庫
- 基於PMEM的PG資料庫Memhive資料庫Hive
- 基於Prometheus的資料庫監控Prometheus資料庫
- 基於cancel的資料庫恢復資料庫
- 資料庫基於版本的閃回資料庫
- RAC資料庫的RMAN備份異機恢復到單節點資料庫資料庫
- 基於MySQL資料庫討論虛擬機器資料恢復MySql資料庫虛擬機資料恢復
- [20121108]關於克隆資料庫的問題.txt資料庫
- RMAN的活動資料庫複製資料庫
- rman管理的複製資料庫資料庫
- AutoTiKV:基於機器學習的資料庫調優機器學習資料庫
- 基於ORM思想的資料庫處理ORM資料庫
- 基於資料庫的熱備指令碼資料庫指令碼
- 【RMAN】catalog資料庫資料庫
- rman全備資料庫資料庫
- RMAN恢復資料庫資料庫
- 使用 RMAN 同步資料庫資料庫
- 第6章:複製資料庫之克隆開啟的risenet資料庫資料庫SENet
- 基於SCN閃回資料庫資料庫
- 使用RMAN對資料庫進行異機還原資料庫