oracle 11g复制数据库

简介: 1.创建辅助实例a.创建辅助实例的密钥文件C:/>orapwd file=F:\oracle\product\10.

1.创建辅助实例
a.创建辅助实例的密钥文件
C:/>orapwd file=F:\oracle\product\10.2.0\db_1\database\PWDorcldup.ora password=lyn entires=30
b.创建OracleService
C:/>oradim -new -sid orcldup -startmode manual
c.配置初始化参数文件
F:\oracle\product\10.2.0\admin>mkdir orcldup
F:\oracle\product\10.2.0\admin\orcldup>mkdir adump bdump cdump pfile udump
NOTE:辅助实例的初始化参数中的BLOCK_SIZE必须与目标数据库相同,如果目标库的参数文件包括DB_BLOCK_SIZE参数,你必须指定辅助实例中该参数的值与目标库相同,如果目标DB中没有,辅助实例也不必指定。如果duplicate db与target db在同一台机器上,Duplicate数据库的DB_NAME不能与目标数据库相同。如果Duplicate数据库与目标数据库不爱同一台机器,需要注意各项初始化参数中的路径,必须确认该路径对于Duplicate数据库有效。
初始化参数文件init.ora的内容如下:
DB_NAME='orcldup'
control_files='/u01/duplicate/orcldup/control01.ctl','/u01/duplicate/orcldup/control02.ctl','/u01/duplicate/orcldup/control03.ctl'
shared_pool_size=200000000
db_block_size=8192
db_file_name_convert=('/u01/oradata/orcl','/u01/duplicate/orcldup')
log_file_name_convert=('/u01/oradata/orcl','/u01/duplicate/orcldup')
audit_file_dest='/u01/duplicate/adump'
background_dump_dest='/u01/duplicate/bdump'
core_dump_dest='/u01/duplicate/cdump'
user_dump_dest='/u01/duplicate/udump'
根据初始化参数文件inti.ora创建spfile
C:/>set oracle_sid=orcldup
C:/>sqlplus / as sysdba
SQL>create spfile from pfile='F:\oracle\product\10.2.0\db_1\database\init.ora';
SQL>startup nomount
d.配置监听和网络服务名
在oracle 11g中不需要再修改listener.ora中的内容
修改tnsnames.ora文件,添加如下内容
ORCLDUP =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcldup)
    )
  )
重启监听 C:/>LSNRCTL RELOAD
2.启动目标数据库到MOUNT或OPEN模式
C:/>sqlplus / as sysdba
SQL>STARTUP
连接目标数据库是否存在可用备份:
C:\>rman target sys/lyn@orcl catalog rman/rman@catalog

Recovery Manager: Release 10.2.0.3.0 - Production on Thu Aug 9 11:37:04 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1304585157)
connected to recovery catalog database

RMAN> list backup of database;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
457     Full    185.74M    DISK        00:00:55     11-JUN-12
        BP Key: 461   Status: AVAILABLE  Compressed: YES  Tag: TAG20120611T13464
3
        Piece Name: F:\BACKUP_3GND96A4_1_1
  List of Datafiles in backup set 457
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
  2       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS2.DBF
  3       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
  4       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
  5       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
  6       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORADATA1.DBF
  7       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORADATA2.DBF
  8       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM02.DBF
  9       Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\MYIDX01.DBF
  10      Full 5145206    11-JUN-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS02.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
959     Full    1.07G      DISK        00:01:18     02-AUG-12
        BP Key: 975   Status: AVAILABLE  Compressed: NO  Tag: TAG20120802T151438

Piece Name: F:\BACKUP_3NNHL3AV_1_1
  List of Datafiles in backup set 959
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 8716227    02-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
961     Full    96.00K     DISK        00:00:00     02-AUG-12
        BP Key: 976   Status: AVAILABLE  Compressed: NO  Tag: TAG20120802T151734

Piece Name: F:\BACKUP_3PNHL3GE_1_1
  List of Datafiles in backup set 961
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  13      Full 8716370    02-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORADATA3.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1323    Full    3.10G      DISK        00:06:50     08-AUG-12
        BP Key: 1327   Status: AVAILABLE  Compressed: NO  Tag: TAG20120808T12132
3
        Piece Name: F:\BACKUP_4BNI4IV3_1_1
  List of Datafiles in backup set 1323
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
  2       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS2.DBF
  3       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX
  4       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
  5       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
  6       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORADATA1.DBF
  7       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORADATA2.DBF
  8       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM02.DBF
  9       Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\MYIDX01.DBF
  10      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS02.DBF
  11      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ASM_LMT.DBF
  12      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\PERFSTAT.DBF
  13      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORADATA3.DBF
  14      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\STREAMS_TBS.DBF
  15      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ORCL\DATAFILE\O1_MF_USER123_81MTG1GN_.DBF
  16      Full 9008324    08-AUG-12 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\GGTBS.DBF
没有备份就没法恢复,而恢复时DUPLICATE的主要工作,如果没有,赶紧创建备份集思密达。
NOTE:如果创建duplicate数据库到其他服务器,那么必须将备份集和相关的归档文件复制到辅助实例所在的服务器适当路径下,以保证RMAN在向DUPLICATE数据库恢复数据文件时,能够读取到备份集。
3.执行恢复
C:\>rman target sys/lyn@orcl catalog rman/rman@catalog auxiliary sys/lyn@orcldup

在oracle 11g中由于orcldup以nomount打开数据库,所以不能以sys/lyn@orcldup连接至rman,此时应设置主机的ORACLE_SID,如export ORACLE_SID=orcldup,而后以rman target sys/lyn@orcl catalog rman/rman@catalog auxiliary sys/lyn(注意不要加@database_name)连接至rman
Recovery Manager: Release 10.2.0.3.0 - Production on Thu Aug 9 11:38:40 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1304585157)
connected to recovery catalog database
connected to auxiliary database: ORCLDUP (not mounted)
运行duplicate命令之前至少指定一个辅助通道,分配通道在RMAN的RUN块中指定,通过ALLOCATE AUXILIARY CHANNEL命令,
RUN{
   #手工分配通道类型为sbt(磁带);
   allocate auxiliary channel ch1 device type sbt;
   #手工分配通道类型为disk
   allocate auxiliary channel aux1 device type disk;
   allocate auxiliary channel aux2 device type disk;
   allocate auxiliary channel aux3 device type disk;
   ....
   DUPLICATE TARGET DATABASE TO ORCLDUP;
}
4.执行DUPLICATE命令
RMAN>DUPLICATE TARGET DATABASE TO ORCLDUP;
Starting Duplicate Db at 09-AUG-12
starting full resync of recovery catalog
full resync complete
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=36 devtype=DISK

contents of Memory Script:
{
   set until scn  9085645;
   set newname for datafile  1 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM01.DBF";
   set newname for datafile  2 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\UNDOTBS2.DBF";
   set newname for datafile  3 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSAUX01.DBF";
   set newname for datafile  4 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\USERS01.DBF";
   set newname for datafile  5 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\EXAMPLE01.DBF";
   set newname for datafile  6 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA1.DBF";
   set newname for datafile  7 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA2.DBF";
   set newname for datafile  8 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM02.DBF";
   set newname for datafile  9 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\MYIDX01.DBF";
   set newname for datafile  10 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\UNDOTBS02.DBF";
   set newname for datafile  11 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ASM_LMT.DBF";
   set newname for datafile  12 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\PERFSTAT.DBF";
   set newname for datafile  13 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA3.DBF";
   set newname for datafile  14 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\STREAMS_TBS.DBF";
   set newname for datafile  15 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORCL\DATAFILE\O1_MF_USER123_81MTG1GN_
.DBF";
   set newname for datafile  16 to
 "F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\GGTBS.DBF";
   restore
   check readonly
   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

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

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 restore at 09-AUG-12
using channel ORA_AUX_DISK_1

channel 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 F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM01.DBF
restoring datafile 00002 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\UNDOTBS2.DBF
restoring datafile 00003 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSAUX01.DBF
restoring datafile 00004 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\USERS01.DBF
restoring datafile 00005 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\EXAMPLE01.DBF
restoring datafile 00006 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA1.DBF
restoring datafile 00007 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA2.DBF
restoring datafile 00008 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM02.DBF
restoring datafile 00009 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\MYIDX01.DBF
restoring datafile 00010 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\UNDOTBS02.DBF
restoring datafile 00011 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ASM_LMT.DBF
restoring datafile 00012 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\PERFSTAT.DBF
restoring datafile 00013 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA3.DBF
restoring datafile 00014 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\STREAMS_TBS.DBF
restoring datafile 00015 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORCL\DATAFI
LE\O1_MF_USER123_81MTG1GN_.DBF
restoring datafile 00016 to F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\GGTBS.DBF
channel ORA_AUX_DISK_1: reading from backup piece F:\BACKUP_4BNI4IV3_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=F:\BACKUP_4BNI4IV3_1_1 tag=TAG20120808T121323
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:06:16
Finished restore at 09-AUG-12
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCLDUP" RESETLOGS ARCHIVE
LOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\REDO01.LOG' ) SIZE 50 M
REUSE,
  GROUP  2 ( 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\REDO02.LOG' ) SIZE 50 M
REUSE,
  GROUP  3 ( 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\REDO03.LOG' ) SIZE 50 M
REUSE
 DATAFILE
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM01.DBF'
 CHARACTER SET ZHS16GBK

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=790863609 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\UNDOTBS2.DBF
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=790863609 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=790863610 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=790863610 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\EXAMPLE01.DBF
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=790863611 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\ORADATA1.DBF
datafile 7 switched to datafile copy
input datafile copy recid=6 stamp=790863611 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\ORADATA2.DBF
datafile 8 switched to datafile copy
input datafile copy recid=7 stamp=790863611 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\SYSTEM02.DBF
datafile 9 switched to datafile copy
input datafile copy recid=8 stamp=790863611 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\MYIDX01.DBF
datafile 10 switched to datafile copy
input datafile copy recid=9 stamp=790863611 filename=F:\ORACLE\PRODUCT\10.2.0\OR
ADATA\ORCLDUP\UNDOTBS02.DBF
datafile 11 switched to datafile copy
input datafile copy recid=10 stamp=790863612 filename=F:\ORACLE\PRODUCT\10.2.0\O
RADATA\ORCLDUP\ASM_LMT.DBF
datafile 12 switched to datafile copy
input datafile copy recid=11 stamp=790863612 filename=F:\ORACLE\PRODUCT\10.2.0\O
RADATA\ORCLDUP\PERFSTAT.DBF
datafile 13 switched to datafile copy
input datafile copy recid=12 stamp=790863612 filename=F:\ORACLE\PRODUCT\10.2.0\O
RADATA\ORCLDUP\ORADATA3.DBF
datafile 14 switched to datafile copy
input datafile copy recid=13 stamp=790863612 filename=F:\ORACLE\PRODUCT\10.2.0\O
RADATA\ORCLDUP\STREAMS_TBS.DBF
datafile 15 switched to datafile copy
input datafile copy recid=14 stamp=790863612 filename=F:\ORACLE\PRODUCT\10.2.0\O
RADATA\ORCLDUP\ORCL\DATAFILE\O1_MF_USER123_81MTG1GN_.DBF
datafile 16 switched to datafile copy
input datafile copy recid=15 stamp=790863613 filename=F:\ORACLE\PRODUCT\10.2.0\O
RADATA\ORCLDUP\GGTBS.DBF

contents of Memory Script:
{
   set until scn  9085645;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script
executing command: SET until clause
Starting recover at 09-AUG-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=35 devtype=DISK
starting media recovery

archive log thread 1 sequence 266 is already on disk as file C:\DATAGUARD\DEMO\O
RCL\ARCHIVELOG\LOG1_266_784480114.ARC
archive log thread 1 sequence 267 is already on disk as file C:\DATAGUARD\DEMO\O
RCL\ARCHIVELOG\LOG1_267_784480114.ARC
archive log thread 1 sequence 268 is already on disk as file C:\DATAGUARD\DEMO\O
RCL\ARCHIVELOG\LOG1_268_784480114.ARC
archive log filename=C:\DATAGUARD\DEMO\ORCL\ARCHIVELOG\LOG1_266_784480114.ARC th
read=1 sequence=266
archive log filename=C:\DATAGUARD\DEMO\ORCL\ARCHIVELOG\LOG1_267_784480114.ARC th
read=1 sequence=267
archive log filename=C:\DATAGUARD\DEMO\ORCL\ARCHIVELOG\LOG1_268_784480114.ARC th
read=1 sequence=268
media recovery complete, elapsed time: 00:00:28
Finished recover at 09-AUG-12

contents of Memory Script:
{
   shutdown clone;
   startup clone nomount ;
}
executing Memory Script
最后以OPEN RESETLOGS方式打开数据库,复制完成。
contents of Memory Script:
{
   Alter clone database open;
}
executing Memory Script
database opened
5.验证结果
SQL>CONN SYSTEM/LYN@ORCLDUP
ORCLDUP>select name from v$tablespace;

NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
EXAMPLE
MYSPACE
MYINDEX
UNDOTBS2
ASM_LMT_TS
PERFSTAT
STREAMS_TBS

NAME
------------------------------
USER123
GG_TBS
TEMP

14 rows selected.

ORCLDUP>select name from v$datafile;

NAME
--------------------------------------------------------------------------------

F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM01.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\UNDOTBS2.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSAUX01.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\USERS01.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\EXAMPLE01.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA1.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA2.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\SYSTEM02.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\MYIDX01.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\UNDOTBS02.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ASM_LMT.DBF

NAME
--------------------------------------------------------------------------------

F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\PERFSTAT.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORADATA3.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\STREAMS_TBS.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\ORCL\DATAFILE\O1_MF_USER123_81MTG1GN_.DBF
F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDUP\GGTBS.DBF

16 rows selected.
OK,表空间和数据文件都有了,创建成功。
四、复制过程中的一些高级选项
1.跳过表空间:跳过只读表空间,只需要在DUPLICATE梦里时指定SKIP READONLY子句,而对于离线表空间,在执行DUPLICATE命令之前将其设置为OFFLINE NORMAL状态即可,这样DUPLICATE命令执行恢复时,就会跳过只读或离线表空间对应的数据文件。如果表空间既不是只读也不是离线,也可以通过SKIP TABLESPACE tbsname跳过,有多个表空间,用逗号隔开即是。
2.重命名duplicate数据库中文件
a.创建过程中重命名控制文件:在duplicate命令中指定CONTROL_FILES参数的名称和位置。
b.创建过程中重命名在线日志文件
RMAN>duplicate target database to orcldup
PFILE=F:\oracle\product\10.2.0\admin\orcldup\pfile\INIT.ORA
db_file_name_convert=('F:\oracle\product\10.2.0\oradata\orcl','F:\oracle\product\10.2.0\oradata\orcldup')
LOGFILE
  'F:\oracle\product\10.2.0\oradata\orcldup\REDO01.LOG' 20M,
  'F:\oracle\product\10.2.0\oradata\orcldup\REDO02.LOG' 20M,
  'F:\oracle\product\10.2.0\oradata\orcldup\REDO03.LOG' 20M;
c.创建过程中重命名数据文件
RMAN>RUN{
#SET NEW FILENAMES FOR THE DATAFILES
SET NEWNAME FOR DATAFILE 1 TO 'F:\oracle\product\10.2.0\oradata\orcldup\SYSTEM01.DBF';
SET NEWNAME FOR DATAFILE 1 TO 'F:\oracle\product\10.2.0\oradata\orcldup\UNDOTBS01.DBF';
#ISSUE THE DUPLICATE COMMAND
duplicate target database to orcldup
}必须指定NOFILENAMECHECK选项避免oracle自动识别。
d.创建过程中重命名临时文件
SET NEWNAME FOR TEMPFILE 10 TO 'F:\oracle\product\10.2.0\oradata\orcldup\TEMP01.DBF';
e.同步副本数据库
对于非standby方式创建的duplicate数据库并不能实现常规意义上的同步,只不过重新执行一次DUPLICATE命令。如果你不需要配置辅助实例,你需要只是把RMAN链接到目标数据库和辅助实例(必须启动到NOMOUNT状态),然后重新执行duplicate即可。
-------整理自《涂抹三思笔记》----------

目录
相关文章
|
12天前
|
存储 Oracle 关系型数据库
数据库数据恢复—ORACLE常见故障的数据恢复方案
Oracle数据库常见故障表现: 1、ORACLE数据库无法启动或无法正常工作。 2、ORACLE ASM存储破坏。 3、ORACLE数据文件丢失。 4、ORACLE数据文件部分损坏。 5、ORACLE DUMP文件损坏。
50 11
|
25天前
|
Oracle 关系型数据库 数据库
Oracle数据恢复—Oracle数据库文件有坏快损坏的数据恢复案例
一台Oracle数据库打开报错,报错信息: “system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。管理员联系我们数据恢复中心寻求帮助,并提供了Oracle_Home目录的所有文件。用户方要求恢复zxfg用户下的数据。 由于数据库没有备份,无法通过备份去恢复数据库。
|
1月前
|
存储 Oracle 关系型数据库
oracle数据恢复—Oracle数据库文件大小变为0kb的数据恢复案例
存储掉盘超过上限,lun无法识别。管理员重组存储的位图信息并导出lun,发现linux操作系统上部署的oracle数据库中有上百个数据文件的大小变为0kb。数据库的大小缩水了80%以上。 取出&并分析oracle数据库的控制文件。重组存储位图信息,重新导出控制文件中记录的数据文件,发现这些文件的大小依然为0kb。
|
18天前
|
存储 Oracle 关系型数据库
服务器数据恢复—华为S5300存储Oracle数据库恢复案例
服务器存储数据恢复环境: 华为S5300存储中有12块FC硬盘,其中11块硬盘作为数据盘组建了一组RAID5阵列,剩下的1块硬盘作为热备盘使用。基于RAID的LUN分配给linux操作系统使用,存放的数据主要是Oracle数据库。 服务器存储故障: RAID5阵列中1块硬盘出现故障离线,热备盘自动激活开始同步数据,在同步数据的过程中又一块硬盘离线,RAID5阵列瘫痪,上层LUN无法使用。
|
13天前
|
关系型数据库 MySQL 数据库
Python处理数据库:MySQL与SQLite详解 | python小知识
本文详细介绍了如何使用Python操作MySQL和SQLite数据库,包括安装必要的库、连接数据库、执行增删改查等基本操作,适合初学者快速上手。
87 15
|
6天前
|
SQL 关系型数据库 MySQL
数据库数据恢复—Mysql数据库表记录丢失的数据恢复方案
Mysql数据库故障: Mysql数据库表记录丢失。 Mysql数据库故障表现: 1、Mysql数据库表中无任何数据或只有部分数据。 2、客户端无法查询到完整的信息。
|
13天前
|
关系型数据库 MySQL 数据库
数据库数据恢复—MYSQL数据库文件损坏的数据恢复案例
mysql数据库文件ibdata1、MYI、MYD损坏。 故障表现:1、数据库无法进行查询等操作;2、使用mysqlcheck和myisamchk无法修复数据库。
|
17天前
|
SQL 关系型数据库 MySQL
MySQL导入.sql文件后数据库乱码问题
本文分析了导入.sql文件后数据库备注出现乱码的原因,包括字符集不匹配、备注内容编码问题及MySQL版本或配置问题,并提供了详细的解决步骤,如检查和统一字符集设置、修改客户端连接方式、检查MySQL配置等,确保导入过程顺利。
|
25天前
|
关系型数据库 MySQL 数据库
GBase 数据库如何像MYSQL一样存放多行数据
GBase 数据库如何像MYSQL一样存放多行数据
|
1月前
|
SQL 关系型数据库 MySQL
12 PHP配置数据库MySQL
路老师分享了PHP操作MySQL数据库的方法,包括安装并连接MySQL服务器、选择数据库、执行SQL语句(如插入、更新、删除和查询),以及将结果集返回到数组。通过具体示例代码,详细介绍了每一步的操作流程,帮助读者快速入门PHP与MySQL的交互。
39 1

推荐镜像

更多
下一篇
DataWorks