示例在同一台机器上使用RMAN克隆数据库
生活随笔
收集整理的這篇文章主要介紹了
示例在同一台机器上使用RMAN克隆数据库
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1.查看主庫(kù)ZDJS并使用RMAM進(jìn)行備份
[oracle@std ~]$ sqlplus '/as sysdba'SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 14:13:14 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to an idle instance.SQL> startup ORACLE instance started.Total System Global Area 608174080 bytes Fixed Size 1220820 bytes Variable Size 159387436 bytes Database Buffers 440401920 bytes Redo Buffers 7163904 bytes Database mounted. Database opened. SQL> show parameter nameNAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string db_name string ZDJS db_unique_name string ZDJS global_names boolean FALSE instance_name string ZDJS lock_name_space string log_file_name_convert string service_names string ZDJS [oracle@std ~]$ rman target /Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 14 14:26:58 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: ZDJS (DBID=3486931402)RMAN> run { 2> allocate channel c1 type disk; 3> allocate channel c2 type disk; 4> backup full database format '/u01/rman_bak/%d_%s_%t.bak'; 5> backup archivelog all format '/u01/rman_bak/arch_%s.bak'; 6> backup current controlfile format '/u01/rman_bak/ctl_%s.bak'; 7> }using target database control file instead of recovery catalog allocated channel: c1 channel c1: sid=143 devtype=DISKallocated channel: c2 channel c2: sid=142 devtype=DISKStarting backup at 14-JAN-15 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset input datafile fno=00001 name=/u02/app/oradata/ZDJS/system01.dbf input datafile fno=00006 name=/u02/app/oradata/ZDJS/plat01.dbf input datafile fno=00008 name=/u02/app/oradata/ZDJS/rlsm01.dbf input datafile fno=00002 name=/u02/app/oradata/ZDJS/undotbs01.dbf input datafile fno=00004 name=/u02/app/oradata/ZDJS/users01.dbf channel c1: starting piece 1 at 14-JAN-15 channel c2: starting full datafile backupset channel c2: specifying datafile(s) in backupset input datafile fno=00003 name=/u02/app/oradata/ZDJS/sysaux01.dbf input datafile fno=00010 name=/u02/app/oradata/ZDJS/qhrlst01.dbf input datafile fno=00005 name=/u02/app/oradata/ZDJS/example01.dbf input datafile fno=00007 name=/u02/app/oradata/ZDJS/rlst01.dbf input datafile fno=00009 name=/u02/app/oradata/ZDJS/rlsc01.dbf channel c2: starting piece 1 at 14-JAN-15 channel c1: finished piece 1 at 14-JAN-15 piece handle=/u01/rman_bak/ZDJS_6_868976951.bak tag=TAG20150114T142911 comment=NONE channel c1: backup set complete, elapsed time: 00:01:07 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset including current control file in backupset channel c1: starting piece 1 at 14-JAN-15 channel c1: finished piece 1 at 14-JAN-15 piece handle=/u01/rman_bak/ZDJS_8_868977018.bak tag=TAG20150114T142911 comment=NONE channel c1: backup set complete, elapsed time: 00:00:03 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset including current SPFILE in backupset channel c1: starting piece 1 at 14-JAN-15 channel c1: finished piece 1 at 14-JAN-15 piece handle=/u01/rman_bak/ZDJS_9_868977021.bak tag=TAG20150114T142911 comment=NONE channel c1: backup set complete, elapsed time: 00:00:02 channel c2: finished piece 1 at 14-JAN-15 piece handle=/u01/rman_bak/ZDJS_7_868976952.bak tag=TAG20150114T142911 comment=NONE channel c2: backup set complete, elapsed time: 00:01:18 Finished backup at 14-JAN-15Starting backup at 14-JAN-15 current log archived channel c1: starting archive log backupset channel c1: specifying archive log(s) in backup set input archive log thread=1 sequence=49 recid=1 stamp=868977033 channel c1: starting piece 1 at 14-JAN-15 channel c1: finished piece 1 at 14-JAN-15 piece handle=/u01/rman_bak/arch_10.bak tag=TAG20150114T143033 comment=NONE channel c1: backup set complete, elapsed time: 00:00:03 Finished backup at 14-JAN-15Starting backup at 14-JAN-15 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset including current control file in backupset channel c1: starting piece 1 at 14-JAN-15 channel c1: finished piece 1 at 14-JAN-15 piece handle=/u01/rman_bak/ctl_11.bak tag=TAG20150114T143038 comment=NONE channel c1: backup set complete, elapsed time: 00:00:02 Finished backup at 14-JAN-15 released channel: c1 released channel: c2 SQL> col file_name for a50 SQL> select file_id,file_name,tablespace_name from dba_data_files;FILE_ID FILE_NAME TABLESPACE_NAME ---------- -------------------------------------------------- ------------------------------4 /u02/app/oradata/ZDJS/users01.dbf USERS3 /u02/app/oradata/ZDJS/sysaux01.dbf SYSAUX2 /u02/app/oradata/ZDJS/undotbs01.dbf UNDOTBS11 /u02/app/oradata/ZDJS/system01.dbf SYSTEM5 /u02/app/oradata/ZDJS/example01.dbf EXAMPLE6 /u02/app/oradata/ZDJS/plat01.dbf PLAT7 /u02/app/oradata/ZDJS/rlst01.dbf RLST8 /u02/app/oradata/ZDJS/rlsm01.dbf RLSM9 /u02/app/oradata/ZDJS/rlsc01.dbf RLSC10 /u02/app/oradata/ZDJS/qhrlst01.dbf QHRLST10 rows selected.
2.建立pfile文件
?
3.建立克隆庫(kù)的目錄
[oracle@std oradata]$ mkdir -p $ORACLE_BASE/admin/clonedb/{a,b,c,u}dump [oracle@std oradata]$ mkdir -p $ORACLE_BASE/oradata/clonedb/?
4.將主庫(kù)pfile拷貝生成克隆庫(kù)的pfile,并生成克隆庫(kù)的口令文件
##紅字部分是修改的部分,藍(lán)字部分是需要增加的
?
[oracle@std dbs]$ cp initZDJS.ora initclonedb.ora [oracle@std dbs]$ vi initclonedb.ora [oracle@std dbs]$ cat initclonedb.ora *.audit_file_dest='/u02/app/admin/clonedb/adump' *.background_dump_dest='/u02/app/admin/clonedb/bdump' *.compatible='10.2.0.1.0' *.control_files='/u02/app/oradata/clonedb/control01.ctl','/u02/app/oradata/clonedb/control02.ctl','/u02/app/oradata/clonedb/control03.ctl' *.core_dump_dest='/u02/app/admin/clonedb/cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name='clonedb' *.dispatchers='(PROTOCOL=TCP) (SERVICE=ZDJSXDB)' *.job_queue_processes=10 *.log_archive_dest_1='location=/u01/clonedb_arch' *.open_cursors=300 *.pga_aggregate_target=201326592 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_target=605028352 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='/u02/app/admin/clonedb/udump' db_file_name_convert=("/u02/app/oradata/ZDJS","/u02/app/oradata/clonedb") log_file_name_convert=("/u02/app/oradata/ZDJS","/u02/app/oradata/clonedb")?
[oracle@std dbs]$ orapwd file=orapwclonedb password=oracle [oracle@std dbs]$ ls hc_clonedb.dat hc_PROD.dat hc_ZDJS.dat initclonedb.ora initZDJS.ora lkZDJS orapwclonedb orapwZDJS snapcf_ZDJS.f spfileZDJS.ora?
5.將克隆庫(kù)啟動(dòng)到nomount狀態(tài)
[oracle@std dbs]$ export ORACLE_SID=clonedb [oracle@std dbs]$ sqlplus '/as sysdba'SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 15:02:30 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to an idle instance.SQL> startup nomount ORACLE instance started.Total System Global Area 608174080 bytes Fixed Size 1220820 bytes Variable Size 163581740 bytes Database Buffers 436207616 bytes Redo Buffers 7163904 bytes SQL> show parameter nameNAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string /u02/app/oradata/ZDJS, /u02/app/oradata/clonedb db_name string clonedb db_unique_name string clonedb global_names boolean FALSE instance_name string clonedb lock_name_space string log_file_name_convert string /u02/app/oradata/ZDJS, /u02/app/oradata/clonedb service_names string clonedb?
6.對(duì)主庫(kù)的日志進(jìn)行歸檔,并將歸檔日志拷貝到克隆庫(kù)的歸檔目錄下
[oracle@std dbs]$ export ORACLE_SID=ZDJS [oracle@std dbs]$ sqlplus '/as sysdba'SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 15:06:09 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Oracle Label Security, OLAP and Data Mining optionsSQL> select group#,sequence#,status from v$log;GROUP# SEQUENCE# STATUS ---------- ---------- ----------------1 50 CURRENT2 48 INACTIVE3 49 INACTIVESQL> alter system archive log current;System altered.SQL> select group#,sequence#,status from v$log;GROUP# SEQUENCE# STATUS ---------- ---------- ----------------1 50 ACTIVE2 51 CURRENT3 49 INACTIVE [oracle@std dbs]$ cd /u01/ZDJS_ARCH/ [oracle@std ZDJS_ARCH]$ ls 1_49_854875280.dbf 1_50_854875280.dbf [oracle@std ZDJS_ARCH]$ cp * ../clonedb_arch/ [oracle@std ZDJS_ARCH]$ ll ../clonedb_arch/ total 26216 -rw-r----- 1 oracle oinstall 19859456 Jan 14 15:09 1_49_854875280.dbf -rw-r----- 1 oracle oinstall 6945792 Jan 14 15:09 1_50_854875280.dbf?
7.使用rman連接主庫(kù)和clone庫(kù)
[oracle@std admin]$ cat tnsnames.ora # tnsnames.ora Network Configuration File: /u02/app/product/10.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools.EXTPROC_CONNECTION_DATA =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)))(CONNECT_DATA =(SID = PLSExtProc)(PRESENTATION = RO)))ZDJS= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=std)(PORT=1521))(CONNECT_DATA= (SERVICE_NAME=ZDJS)) ) [oracle@std admin]$ export ORACLE_SID=clonedb [oracle@std admin]$ target sys/oracle@zdjs auxiliary sys/oracle -bash: target: command not found [oracle@std admin]$ rman target sys/oracle@zdjs auxiliary sys/oracleRecovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 14 15:18:47 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.connected to target database: ZDJS (DBID=3486931402) connected to auxiliary database: CLONEDB (not mounted)RMAN> list backup;using target database control file instead of recovery catalogList of Backup Sets ===================BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 1 Full 6.77M DISK 00:00:02 14-JAN-15 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20150114T142445Piece Name: /u01/rman_bak/ZDJS_3_868976686.bakControl File Included: Ckp SCN: 1756176 Ckp time: 14-JAN-15BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 2 Full 80.00K DISK 00:00:00 14-JAN-15 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20150114T142445Piece Name: /u01/rman_bak/ZDJS_5_868976688.bakSPFILE Included: Modification time: 14-JAN-15BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 3 Full 514.59M DISK 00:01:00 14-JAN-15 BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20150114T142911Piece Name: /u01/rman_bak/ZDJS_6_868976951.bakList of Datafiles in backup set 3File LV Type Ckp SCN Ckp Time Name---- -- ---- ---------- --------- ----1 Full 1756642 14-JAN-15 /u02/app/oradata/ZDJS/system01.dbf2 Full 1756642 14-JAN-15 /u02/app/oradata/ZDJS/undotbs01.dbf4 Full 1756642 14-JAN-15 /u02/app/oradata/ZDJS/users01.dbf6 Full 1756642 14-JAN-15 /u02/app/oradata/ZDJS/plat01.dbf8 Full 1756642 14-JAN-15 /u02/app/oradata/ZDJS/rlsm01.dbfBS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 4 Full 6.77M DISK 00:00:02 14-JAN-15 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20150114T142911Piece Name: /u01/rman_bak/ZDJS_8_868977018.bakControl File Included: Ckp SCN: 1756665 Ckp time: 14-JAN-15BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 5 Full 80.00K DISK 00:00:02 14-JAN-15 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20150114T142911Piece Name: /u01/rman_bak/ZDJS_9_868977021.bakSPFILE Included: Modification time: 14-JAN-15BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 6 Full 453.63M DISK 00:01:17 14-JAN-15 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20150114T142911Piece Name: /u01/rman_bak/ZDJS_7_868976952.bakList of Datafiles in backup set 6File LV Type Ckp SCN Ckp Time Name---- -- ---- ---------- --------- ----3 Full 1756644 14-JAN-15 /u02/app/oradata/ZDJS/sysaux01.dbf5 Full 1756644 14-JAN-15 /u02/app/oradata/ZDJS/example01.dbf7 Full 1756644 14-JAN-15 /u02/app/oradata/ZDJS/rlst01.dbf9 Full 1756644 14-JAN-15 /u02/app/oradata/ZDJS/rlsc01.dbf10 Full 1756644 14-JAN-15 /u02/app/oradata/ZDJS/qhrlst01.dbfBS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 7 18.94M DISK 00:00:02 14-JAN-15 BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20150114T143033Piece Name: /u01/rman_bak/arch_10.bakList of Archived Logs in backup set 7Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- --------- ---------- ---------1 49 1750460 19-DEC-14 1756675 14-JAN-15BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 8 Full 6.77M DISK 00:00:02 14-JAN-15 BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20150114T143038Piece Name: /u01/rman_bak/ctl_11.bakControl File Included: Ckp SCN: 1756683 Ckp time: 14-JAN-15?
8.使用rman命令克隆數(shù)據(jù)庫(kù)
RMAN> duplicate target database to clonedb;Starting Duplicate Db at 14-JAN-15 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=156 devtype=DISKcontents of Memory Script: {set until scn 1758326;set newname for datafile 1 to "/u02/app/oradata/clonedb/system01.dbf";set newname for datafile 2 to "/u02/app/oradata/clonedb/undotbs01.dbf";set newname for datafile 3 to "/u02/app/oradata/clonedb/sysaux01.dbf";set newname for datafile 4 to "/u02/app/oradata/clonedb/users01.dbf";set newname for datafile 5 to "/u02/app/oradata/clonedb/example01.dbf";set newname for datafile 6 to "/u02/app/oradata/clonedb/plat01.dbf";set newname for datafile 7 to "/u02/app/oradata/clonedb/rlst01.dbf";set newname for datafile 8 to "/u02/app/oradata/clonedb/rlsm01.dbf";set newname for datafile 9 to "/u02/app/oradata/clonedb/rlsc01.dbf";set newname for datafile 10 to "/u02/app/oradata/clonedb/qhrlst01.dbf";restorecheck readonlyclone database; } executing Memory Scriptexecuting command: SET until clauseexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEStarting restore at 14-JAN-15 using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: starting datafile backupset restore channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u02/app/oradata/clonedb/system01.dbf restoring datafile 00002 to /u02/app/oradata/clonedb/undotbs01.dbf restoring datafile 00004 to /u02/app/oradata/clonedb/users01.dbf restoring datafile 00006 to /u02/app/oradata/clonedb/plat01.dbf restoring datafile 00008 to /u02/app/oradata/clonedb/rlsm01.dbf channel ORA_AUX_DISK_1: reading from backup piece /u01/rman_bak/ZDJS_6_868976951.bak channel ORA_AUX_DISK_1: restored backup piece 1 piece handle=/u01/rman_bak/ZDJS_6_868976951.bak tag=TAG20150114T142911 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:47 channel ORA_AUX_DISK_1: starting datafile backupset restore channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00003 to /u02/app/oradata/clonedb/sysaux01.dbf restoring datafile 00005 to /u02/app/oradata/clonedb/example01.dbf restoring datafile 00007 to /u02/app/oradata/clonedb/rlst01.dbf restoring datafile 00009 to /u02/app/oradata/clonedb/rlsc01.dbf restoring datafile 00010 to /u02/app/oradata/clonedb/qhrlst01.dbf channel ORA_AUX_DISK_1: reading from backup piece /u01/rman_bak/ZDJS_7_868976952.bak channel ORA_AUX_DISK_1: restored backup piece 1 piece handle=/u01/rman_bak/ZDJS_7_868976952.bak tag=TAG20150114T142911 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45 Finished restore at 14-JAN-15 sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONEDB" RESETLOGS ARCHIVELOG MAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292LOGFILEGROUP 1 ( '/u02/app/oradata/clonedb/redo01.log' ) SIZE 50 M REUSE,GROUP 2 ( '/u02/app/oradata/clonedb/redo02.log' ) SIZE 50 M REUSE,GROUP 3 ( '/u02/app/oradata/clonedb/redo03.log' ) SIZE 50 M REUSEDATAFILE'/u02/app/oradata/clonedb/system01.dbf'CHARACTER SET ZHS16GBKcontents of Memory Script: {switch clone datafile all; } executing Memory Scriptreleased channel: ORA_AUX_DISK_1 datafile 2 switched to datafile copy input datafile copy recid=1 stamp=868980188 filename=/u02/app/oradata/clonedb/undotbs01.dbf datafile 3 switched to datafile copy input datafile copy recid=2 stamp=868980188 filename=/u02/app/oradata/clonedb/sysaux01.dbf datafile 4 switched to datafile copy input datafile copy recid=3 stamp=868980188 filename=/u02/app/oradata/clonedb/users01.dbf datafile 5 switched to datafile copy input datafile copy recid=4 stamp=868980188 filename=/u02/app/oradata/clonedb/example01.dbf datafile 6 switched to datafile copy input datafile copy recid=5 stamp=868980188 filename=/u02/app/oradata/clonedb/plat01.dbf datafile 7 switched to datafile copy input datafile copy recid=6 stamp=868980189 filename=/u02/app/oradata/clonedb/rlst01.dbf datafile 8 switched to datafile copy input datafile copy recid=7 stamp=868980189 filename=/u02/app/oradata/clonedb/rlsm01.dbf datafile 9 switched to datafile copy input datafile copy recid=8 stamp=868980189 filename=/u02/app/oradata/clonedb/rlsc01.dbf datafile 10 switched to datafile copy input datafile copy recid=9 stamp=868980189 filename=/u02/app/oradata/clonedb/qhrlst01.dbfcontents of Memory Script: {set until scn 1758326;recoverclone databasedelete archivelog; } executing Memory Scriptexecuting command: SET until clauseStarting recover at 14-JAN-15 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=156 devtype=DISKstarting media recoveryarchive log thread 1 sequence 49 is already on disk as file /u01/ZDJS_ARCH/1_49_854875280.dbf archive log thread 1 sequence 50 is already on disk as file /u01/ZDJS_ARCH/1_50_854875280.dbf archive log filename=/u01/ZDJS_ARCH/1_49_854875280.dbf thread=1 sequence=49 archive log filename=/u01/ZDJS_ARCH/1_50_854875280.dbf thread=1 sequence=50 media recovery complete, elapsed time: 00:00:11 Finished recover at 14-JAN-15contents of Memory Script: {shutdown clone;startup clone nomount ; } executing Memory Scriptdatabase dismounted Oracle instance shut downconnected to auxiliary database (not started) Oracle instance startedTotal System Global Area 608174080 bytesFixed Size 1220820 bytes Variable Size 163581740 bytes Database Buffers 436207616 bytes Redo Buffers 7163904 bytes sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONEDB" RESETLOGS ARCHIVELOG MAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292LOGFILEGROUP 1 ( '/u02/app/oradata/clonedb/redo01.log' ) SIZE 50 M REUSE,GROUP 2 ( '/u02/app/oradata/clonedb/redo02.log' ) SIZE 50 M REUSE,GROUP 3 ( '/u02/app/oradata/clonedb/redo03.log' ) SIZE 50 M REUSEDATAFILE'/u02/app/oradata/clonedb/system01.dbf'CHARACTER SET ZHS16GBKcontents of Memory Script: {set newname for tempfile 1 to "/u02/app/oradata/clonedb/temp01.dbf";switch clone tempfile all;catalog clone datafilecopy "/u02/app/oradata/clonedb/undotbs01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/sysaux01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/users01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/example01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/plat01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/rlst01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/rlsm01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/rlsc01.dbf";catalog clone datafilecopy "/u02/app/oradata/clonedb/qhrlst01.dbf";switch clone datafile all; } executing Memory Scriptexecuting command: SET NEWNAMErenamed temporary file 1 to /u02/app/oradata/clonedb/temp01.dbf in control filecataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/undotbs01.dbf recid=1 stamp=868980219cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/sysaux01.dbf recid=2 stamp=868980220cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/users01.dbf recid=3 stamp=868980221cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/example01.dbf recid=4 stamp=868980221cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/plat01.dbf recid=5 stamp=868980222cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/rlst01.dbf recid=6 stamp=868980223cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/rlsm01.dbf recid=7 stamp=868980224cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/rlsc01.dbf recid=8 stamp=868980224cataloged datafile copy datafile copy filename=/u02/app/oradata/clonedb/qhrlst01.dbf recid=9 stamp=868980225datafile 2 switched to datafile copy input datafile copy recid=1 stamp=868980219 filename=/u02/app/oradata/clonedb/undotbs01.dbf datafile 3 switched to datafile copy input datafile copy recid=2 stamp=868980220 filename=/u02/app/oradata/clonedb/sysaux01.dbf datafile 4 switched to datafile copy input datafile copy recid=3 stamp=868980221 filename=/u02/app/oradata/clonedb/users01.dbf datafile 5 switched to datafile copy input datafile copy recid=4 stamp=868980221 filename=/u02/app/oradata/clonedb/example01.dbf datafile 6 switched to datafile copy input datafile copy recid=5 stamp=868980222 filename=/u02/app/oradata/clonedb/plat01.dbf datafile 7 switched to datafile copy input datafile copy recid=6 stamp=868980223 filename=/u02/app/oradata/clonedb/rlst01.dbf datafile 8 switched to datafile copy input datafile copy recid=7 stamp=868980224 filename=/u02/app/oradata/clonedb/rlsm01.dbf datafile 9 switched to datafile copy input datafile copy recid=8 stamp=868980224 filename=/u02/app/oradata/clonedb/rlsc01.dbf datafile 10 switched to datafile copy input datafile copy recid=9 stamp=868980225 filename=/u02/app/oradata/clonedb/qhrlst01.dbfcontents of Memory Script: {Alter clone database open resetlogs; } executing Memory Scriptdatabase opened Finished Duplicate Db at 14-JAN-15?
9.打開(kāi)克隆庫(kù),確認(rèn)克隆成功
[oracle@std admin]$ sqlplus '/as sysdba'SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 15:25:33 2015Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, Oracle Label Security, OLAP and Data Mining optionsSQL> select status from v$instance;STATUS ------------ OPENSQL> select name from v$datafile;NAME -------------------------------------------------------------------------------- /u02/app/oradata/clonedb/system01.dbf /u02/app/oradata/clonedb/undotbs01.dbf /u02/app/oradata/clonedb/sysaux01.dbf /u02/app/oradata/clonedb/users01.dbf /u02/app/oradata/clonedb/example01.dbf /u02/app/oradata/clonedb/plat01.dbf /u02/app/oradata/clonedb/rlst01.dbf /u02/app/oradata/clonedb/rlsm01.dbf /u02/app/oradata/clonedb/rlsc01.dbf /u02/app/oradata/clonedb/qhrlst01.dbf10 rows selected.SQL> select group#,sequence#,status from v$log;GROUP# SEQUENCE# STATUS ---------- ---------- ----------------1 0 UNUSED2 0 UNUSED3 1 CURRENTSQL> alter system switch logfile;System altered.SQL> /System altered.SQL> /System altered.SQL> select group#,sequence#,status from v$log;GROUP# SEQUENCE# STATUS ---------- ---------- ----------------1 2 INACTIVE2 3 ACTIVE3 4 CURRENT SQL> show parameter nameNAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string /u02/app/oradata/ZDJS, /u02/app/oradata/clonedb db_name string clonedb db_unique_name string clonedb global_names boolean FALSE instance_name string clonedb lock_name_space string log_file_name_convert string /u02/app/oradata/ZDJS, /u02/app/oradata/clonedb service_names string clonedb?
轉(zhuǎn)載于:https://www.cnblogs.com/myrunning/p/4224017.html
總結(jié)
以上是生活随笔為你收集整理的示例在同一台机器上使用RMAN克隆数据库的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 第四十四课:jQuery UI和jQue
- 下一篇: 使用DOM4J读和写文档