基于 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

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏向治洪

开源数据库框架greenDAO

最近在对开发项目的性能进行优化。由于项目里涉及了大量的缓存处理和数据库运用,需要对数据库进行频繁的读写、查询等操作。因此首先想到了对整个项目的数据库框架进行优...

2705
来自专栏生信宝典

基因组分析中多物种同源基因的鉴定和筛选

OrthoMCL能做什么 Orthologs are homologs separated by speciation events. Paralogs are...

4217
来自专栏Android知识点总结

Android原生下载(上篇)基本逻辑+断点续传

1461
来自专栏MasiMaro 的技术博文

使用FormatMessage函数编写一个内核错误码查看器

在编写驱动程序的时候,常用的一个结构是NTSTATUS,它来表示操作是否成功,但是对于失败的情况它的返回码过多,不可能记住所有的情况,应用层有一个GetLast...

982
来自专栏Java3y

移动商城第六篇【单品查询、静态化页面】

单品页查询 当点击某个商品的时候,查看该商品的详细信息: ? 修改每个商品的超链接: <a href="${path}/ite...

4557
来自专栏KK的小酒馆

SQlite数据库简介Android网络与数据存储

SQLite看名字就知道是个数据库,Android专门为移动端内置了此种轻量级工具,并且为了方便在Java语言中进行数据库操作,编写了SQLiteOpenHel...

1483
来自专栏梦里茶室

sqlite在Android上的一个bug:SQLiteCantOpenDatabaseException when nativeExecuteForCursorWindow

这是sqlite在Android系统上的一个bug,在需要建立索引的sql语句频繁执行时,会发生这个异常。

1072
来自专栏阿杜的世界

HttpClient使用总结

根据业务量级决定使用同步调用或异步调用:异步回调方式的并发性非常高,缺点是代码可读性一般,在开发中,我会首先选择同步实现,在遇到性能问题后再考虑优化为异步回调方...

862
来自专栏知识分享

4-MSP430定时器_定时器中断

一开始没写好就上传了,,,,,,,,这次来个全的 自己学MSP430是为了写一篇关于PID的文章,需要430在proteus上做仿真,一则认为在自动控制算法上P...

3666
来自专栏JetpropelledSnake

Django学习笔记之利用Form和Ajax实现注册功能

1805

扫码关注云+社区

领取腾讯云代金券