方案B:rman备份方式
step1. 在源端执行脚本
$ perl xttdriver.pl -p
这一步创建数据文件备份,位置由xtt.properties 的dfcopydir 指定;创建了xttplan.txt 和rmanconvert.cmd 两个文件。 确保需要传输的表空间数据文件都是读写模式,非offline 状态。step2. 将备份集和rmanconvert.cmd 文件拷贝到目标端, 如果使用共享的 nfs ,备份集的拷贝可以忽略,源端做完备份后,目标端对产生的备份集赋予相应的权限。
$ scp /oracle/app/oracle/backup/* 10.10.20.1:'/home/oracle/source'
$ scp /home/oracle/rman-xtt/rmanconvert.cmd 10.10.20.1:'/home/oracle/rman-xtt'
step3 目标端转换数据文件备份
*
$ perl xttdriver.pl -c
2.3.1 roll forward Phase
step 1:source 端做第一次增量备份
如果是分批次做增量备份,需要先修改 xtt.properties 中的 tablespaces 参数为所有表空间的名字,源端将所有备份的 xttplan.txt 等文件合并为一个,目标端将所有备份的 xttnewdatafiles.txt 文件合并为一个。
$ perl xttdriver.pl -i
--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------
Backup incremental
--------------------------------------------------------------------
Prepare newscn for Tablespaces: 'SOE'
Prepare newscn for Tablespaces: 'SOE1'
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
rman target / cmdfile /home/oracle/rman-xtt/rmanincr.cmd
Recovery Manager: Release 10.2.0.4.0 - Production on Wed Sep 23 14:57:13 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1418362679)
RMAN> set nocfau;
2> host 'echo ts::SOE';
3> backup incremental from scn 3871502
4> tag tts_incr_update tablespace 'SOE' format
5> '/oracle/app/oracle/backup/%U';
6> set nocfau;
7> host 'echo ts::SOE1';
8> backup incremental from scn 3871518
9> tag tts_incr_update tablespace 'SOE1' format
10> '/oracle/app/oracle/backup/%U';
11> executing command: SET NOCFAU
using target database control file instead of recovery catalog
ts::SOE
host command complete
Starting backup at 23-SEP-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=33 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00014 name=/oracle/app/oracle/oradata/orcl/soe.dbf
channel ORA_DISK_1: starting piece 1 at 23-SEP-15
channel ORA_DISK_1: finished piece 1 at 23-SEP-15
piece handle=/oracle/app/oracle/backup/2gqhsoac_1_1 tag=TTS_INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55
Finished backup at 23-SEP-15
executing command: SET NOCFAU
ts::SOE1
host command complete
Starting backup at 23-SEP-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/oracle/app/oracle/oradata/orcl/soe1.dbf
channel ORA_DISK_1: starting piece 1 at 23-SEP-15
channel ORA_DISK_1: finished piece 1 at 23-SEP-15
piece handle=/oracle/app/oracle/backup/2hqhsodv_1_1 tag=TTS_INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 23-SEP-15
Recovery Manager complete.
--------------------------------------------------------------------
Done backing up incrementals
--------------------------------------------------------------------
该step产生两个文件tsbkupmap.txt、incrbackups.txt需要传到dest端,内容如下:
$ more tsbkupmap.txt
SOE1::6:::1=2hqhsodv_1_1
SOE::14:::1=2gqhsoac_1_1
$ more incrbackups.txt
/oracle/app/oracle/backup/2hqhsodv_1_1
/oracle/app/oracle/backup/2gqhsoac_1_1
同时其会产生一个新的记录scn的文件:xttplan.txt.new,
$ more xttplan.txt.new
SOE::::3871502
14
SOE1::::3871518
6
step 2 将tsbkupmap.txt,incrbackups.txt,xttplan.txt传到dest端
$ scp `cat incrbackups.txt` oracle@10.10.20.1:/home/oracle/source
2hqhsodv_1_1 100% 104KB 104.0KB/s 00:00
2gqhsoac_1_1 100% 48KB 48.0KB/s 00:00
$ scp xttplan.txt tsbkupmap.txt oracle@10.10.20.1:/home/oracle/rman-xtt
oracle@10.10.20.1's password:
xttplan.txt 100% 63 0.1KB/s 00:00
tsbkupmap.txt 100% 77 0.1KB/s 00:00
step 3:dest 端应用增量备份
oracle@rac1:/home/oracle/rman-xtt>perl xttdriver.pl -r
--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Start rollforward
--------------------------------------------------------------------
--------------------------------------------------------------------
End of rollforward phase
-------------------------------------------------------------------
step 3: 源端 确定下一次增量备份的from_scn
内部触发的其实是删除xttplan.txt.new ,将其内容备份到 xttplan.txt 中
$ perl xttdriver.pl -s
--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------
Prepare newscn for Tablespaces: 'SOE'
Prepare newscn for Tablespaces: 'SOE1'
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
Prepare newscn for Tablespaces: ''
New /home/oracle/rman-xtt/xttplan.txt with FROM SCN's generated
查看from_scn
$ more xttplan.txt
TEST1::::2818317
6
7
8
11
12
16
17
18
19
TEST2::::2818328
9
10
xttplan.txt: END
step 4: 第二次增量备份
$ perl xttdriver.pl -i
查看生成的文件:
$ more xttplan.txt.new
$ more incrbackups.txt
step 5:将生成的文件传到dest端
$ scp `cat incrbackups.txt` oracle@10.10.20.1:/home/oracle/source
$ scp xttplan.txt tsbkupmap.txt oracle@10.10.20.1:/home/oracle/rman-xtt
step 6: 在目标端应用增量备份
oracle@rac1:/home/oracle/rman-xtt>perl xttdriver.pl -r
step 7:soure 端更新from_scn
perl xttdriver -s
2.3.2 Transport Phase
以 上的步骤,source端migration的表空间都是read write状态,即不会影响应用。下面进行的最后一次增量备份,要求将表空间置于read only状态,生产不可用。因而下面的操作也是实际影响downtime的最主要部分。
step 1: 最后一次增量备份
**************************************************************************
将source端migration的表空间置于read only状态
SQL> alter tablespace SOE1 read only;
Tablespace altered.
SQL> alter tablespace SOE read only;
Tablespace altered.
在source端进行最后一次增量备份
perl xttdriver.pl -i
step 2: 将生成的文件传到dest端 , 如果使用共享 nfs ,增量备份集的传输可以忽略,注意备份集要赋予相应权限
$ scp `cat incrbackups.txt` oracle@10.10.20.1:/home/oracle/source
$ scp xttplan.txt tsbkupmap.txt oracle@10.10.20.1:/home/oracle/rman-xtt
step 3 在dest端应用备份
oracle@rac1:/home/oracle/rman-xtt>perl xttdriver.pl -r
step 4 在source查询相应schema的权限及创建语句 ,以及 directory,dblink 等对象所需要的主机文件, tnsnames 等。以下 spool 出来的脚本做相应修改后在新数据库执行。
mkdir -p /user/oracle/xtts_metadata
cd /user/oracle/xtts_metadata
sqlplus / as sysdba
set long 9999 linesize 300 pagesize 9999 long 9999
spool /user/oracle/xtts_metadata/dir.sql
select dbms_metadata.get_ddl('DIRECTORY',DIRECTORY_NAME)||’;’ from dba_directories;
spool off
spool /user/oracle/xtts_metadata/user.sql
select dbms_metadata.get_ddl('USER',username) from dba_users where username in('SOE','SOE1'); --默认表空间在导入表空间元信息后再指定
spool off
创建 directory :
mkdir -p /xxx/xxx
chown oracle:dba /xxx/xxx
CREATE OR REPLACE DIRECTORY "xxx" AS '/xxx/xxx';
step 5 根据上述语句在dest端创建相应schema及授权
step 6 在dest端执行以下命令,产生datapump脚本
perl xttdriver.pl -e
step 7 确认
AQ_TM_PROCESSES
为非零值
源端
AQ_TM_PROCESSES
为非零值,否则
impdp
会出错
step 8 修改上一步产生的脚本,在dest端第一次抽取元数据:基于表空间抽取
impdp directory=DATA_PUMP_DIR logfile=imp.log \
network_link=ttslink transport_full_check=no \
transport_tablespaces=SOE,SOE1 \
exclude=statistics\
cluster=n \
transport_datafiles='+DATADG/orcl/datafile/soe.dbf','+DATADG/orcl/datafile/soetest1.dbf','+DATADG/orcl/datafile/soe1.dbf','+DATADG/orcl/datafile/soetest2.dbf'
检查确认用户的对象和表空间正常:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** directory=DATA_PUMP_DIR logfile=imp.log network_link=ttslink transport_full_check=no transport_tablespaces=SOE,SOE1 cluster=n transport_datafiles=+DATADG/orcl/datafile/soe.dbf,+DATADG/orcl/datafile/soetest1.dbf,+DATADG/orcl/datafile/soe1.dbf,+DATADG/orcl/datafile/soetest2.dbf
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
Processing object type TRANSPORTABLE_EXPORT/TRIGGER
Processing object type TRANSPORTABLE_EXPORT/INDEX/FUNCTIONAL_AND_BITMAP/INDEX
Processing object type TRANSPORTABLE_EXPORT/INDEX/STATISTICS/FUNCTIONAL_AND_BITMAP/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Wed Sep 23 16:57:50 2015 elapsed 0 00:00:54
数据泵在导出表空间元数据如果出现 bug ,则使用传统 exp/imp 工具:
注意导出导入时要设置 NLS_LANG 环境变量,并且在导出元数据之前对所有的空表分配区:
select 'alter table '||owner||'.'||table_name||' allocate extent;' from
dba_tables a, dba_segments b where a.table_name=b.segment_name(+) and owner in (xxx) and b.segment_name is null;
exp \'/ as sysdba\' file=soe_soe1.dmp tablespaces=soe,soe1 transport_tablespace=y
imp \'/ as sysdba\' file=soe_soe1.dmp transport_tablespace=y lof=imp_tbs.log buffer=1024M tablespaces=soe,soe1 datafiles='+DATADG/orcl/datafile/soe.dbf','+DATADG/orcl/datafile/soetest1.dbf','+DATADG/orcl/datafile/soe1.dbf','+DATADG/orcl/datafile/soetest2.dbf'
step 9 修改用户默认表空间
select 'alter user '||username||' default tablespace '||default_tablespace||';' from dba_users@ttslink where username in ('SOE','SOE1');
由上面的结果得知,此次抽取元数据只抽取了表、索引、触发器,对于序列、过程、视图、包都没有抽取,所以我们进行第二次抽取元数据。在此之前先检查以下dest端表空间、用户对象的状态:
1 )表空间
select tablespace_name,file_name,status from dba_data_files;
TABLESPACE_NAME FILE_NAME
------------------------------ ---------
USERS +DATADG/orcl/datafile/users.932.890771737
UNDOTBS1 +DATADG/orcl/datafile/undotbs1.928.890771737
SYSAUX +DATADG/orcl/datafile/sysaux.875.890771737
SYSTEM +DATADG/orcl/datafile/system.263.890771735
UNDOTBS2 +DATADG/orcl/datafile/undotbs2.929.890771853
SOE1 +DATADG/orcl/datafile/soetest2.dbf
SOE1 +DATADG/orcl/datafile/soe1.dbf
USERS +DATADG/orcl/datafile/users.1205.891175465
USERS +DATADG/orcl/datafile/users.1206.891175501
USERS +DATADG/orcl/datafile/users.1207.891175533
USERS +DATADG/orcl/datafile/users.1208.891175611
USERS +DATADG/orcl/datafile/users.1209.891175647
USERS +DATADG/orcl/datafile/users.1210.891176427
SOE +DATADG/orcl/datafile/soe.dbf
SOE +DATADG/orcl/datafile/soetest1.dbf
2) 用户对象:
soe:
soe@ORCL> select * from ((select 's-t',owner, object_type, count(*)
from dba_objects@ttslink
where owner in ('SOE', 'SOE1')
group by owner, object_type
MINUS
select 's-t',owner, object_type, count(*)
from dba_objects
where owner in ('SOE', 'SOE1')
group by owner, object_type)
union all
(select 't-s',owner, object_type, count(*)
from dba_objects
where owner in ('SOE', 'SOE1')
group by owner, object_type
MINUS
select 't-s',owner, object_type, count(*)
from dba_objects@ttslink
where owner in ('SOE', 'SOE1')
group by owner, object_type)) order by owner,object_type;
step 9 第二次抽取除表 、 索引 、 约束 、 trigger 以外的 元数据:基于schema抽取
impdp directory=DATA_PUMP_DIR logfile=imp.log \
network_link=ttslink \
schemas=SOE,SOE1 cluster=n \
content=metadata_only \
exclude=index,table,constraint\
程序输出:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/******** directory=DATA_PUMP_DIR logfile=imp.log network_link=ttslink schemas=SOE,SOE1 cluster=n content=metadata_only include=view,PROCEDURE,SEQUENCE,PACKAGE transport_datafiles=+DATADG/orcl/datafile/soe.dbf,+DATADG/orcl/datafile/soetest1.dbf,+DATADG/orcl/datafile/soe1.dbf,+DATADG/orcl/datafile/soetest2.dbf
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
ORA-39082: Object type ALTER_PACKAGE_SPEC:"SOE"."ORDERENTRY" created with compilation warnings
ORA-39082: Object type ALTER_PACKAGE_SPEC:"SOE1"."ORDERENTRY" created with compilation warnings
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
ORA-39082: Object type PACKAGE_BODY:"SOE1"."ORDERENTRY" created with compilation warnings
ORA-39082: Object type PACKAGE_BODY:"SOE"."ORDERENTRY" created with compilation warnings
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" completed with 4 error(s) at Wed Sep 23 17:17:52 2015 elapsed 0 00:00:05
step 10 检查schema对象状态
select * from ((select 's-t',owner, object_type, count(*)
from dba_objects
where owner in ('SOE', 'SOE1')
group by owner, object_type
MINUS
select 's-t',owner, object_type, count(*)
from dba_objects@TTSLINK
where owner in ('SOE', 'SOE1')
group by owner, object_type)
union all
(select 't-s',owner, object_type, count(*)
from dba_objects@ttslink
where owner in ('SOE', 'SOE1')
group by owner, object_type
MINUS
select 't-s',owner, object_type, count(*)
from dba_objects
where owner in ('SOE', 'SOE1')
group by owner, object_type)) order by owner,object_type;
由上面的结果,PACKAGE BODY ORDERENTRY状态是invalid的,这也与第二次抽取元数据的errors对应,我们可以重编译以解决此问题:
soe1@ORCL>alter package ORDERENTRY compile body;
Package body altered.
soe@ORCL>alter package ORDERENTRY compile body;
Package body altered.
至此指定用户元数据全部倒入,还需要将 PUBLIC DBLINK 和 PUBLIC SYNONYM 单独导出导入,或者在目标端手工创建。
expdp system/oracle directory=dump_dir dumpfile=pub.dmp logfile=pub.log INCLUDE=DB_LINK:"LIKE 'TEST01'"
step 11 手工收集统计信息
step 12 dest 端验证transported的数据
RMAN> validate tablespace SOE, SOE1 check logical;
Starting validate at 2015-09-23 17:34:29
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1239 instance=orcl1 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00014 name=+DATADG/orcl/datafile/soe.dbf
input datafile file number=00007 name=+DATADG/orcl/datafile/soe1.dbf
input datafile file number=00015 name=+DATADG/orcl/datafile/soetest1.dbf
input datafile file number=00006 name=+DATADG/orcl/datafile/soetest2.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:00:07
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
6 OK 0 1254 1280 3972895
File Name: +DATADG/orcl/datafile/soetest2.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 16
Other 0 10
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
7 OK 0 137048 262144 3973354
File Name: +DATADG/orcl/datafile/soe1.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 78344
Index 0 44136
Other 0 2616
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
14 OK 0 128771 262144 3972304
File Name: +DATADG/orcl/datafile/soe.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 83909
Other 0 2701
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
15 OK 0 1144 1280 3972293
File Name: +DATADG/orcl/datafile/soetest1.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 126
Other 0 10
Finished validate at 2015-09-23 17:34:37
由上可以看出,逻辑验证通过 。如果有坏块,需要查询 V$DATABASE_BLOCK_CORRUPTION 视图确认坏块属于什么对象。
此时,需要将应用切换到新库!
step 12 将dest端表空间置于read write状态
SQL> alter tablespace SOE read write;
Tablespace altered
SQL> alter tablespace SOE1 read write;
Tablespace altered
到此,整个XTTS的步骤完成
2.1 增加数据文件的异常处理
强烈推荐在数据迁移开始后,不要再增加数据文件,如果在数据迁移过程中产生新的数据文件,XTTS 不能正确传输这些文件,可以通过如下两种方式来解决:
2.4.1 方式一
对 于临时增加的数据文件,在rman_xttconverv3版本中可以直接使用如下方式来解决:
Please Do the following:
--------------------------
1. Copy fixnewdf.txt from source to destination temp dir
2. Copy new datafile copies
TEST_LJL_13.tf
from /home/oracle/backup to the <stage_dest> in destination
3. On Destination, run $ORACLE_HOME/perl/bin/perl xttdriver.pl --fixnewdf
4. Re-execute the incremental backup in source:
$ORACLE_HOME/perl/bin/perl xttdriver.pl -i
NOTE: Before running incremental backup, delete FAILED in source temp dir or
run xttdriver.pl with -L option
2.4.2 方式二
对 于临时增加的两个数据文件,可以利用DBMS_FILE_TRANSFER.GET_FILE包来实现文件由source端传到dest端,数据文件传输完成后 , 会自动完成大小端的转化 , 该包的参数如下:
DBMS_FILE_TRANSFER.GET_FILE(
source_directory_object IN VARCHAR2,–源目录
source_file_name IN VARCHAR2,–源文件名
dblink_to_source -源端到目标端的dblink
destination_directory_object IN VARCHAR2,–目标目录
destination_file_name IN VARCHAR2,–目标文件名
);
执行该功能的时机是在最后一次增量迁移开始时,把表空间置为只读后。
目标端执行:
SQL> exec DBMS_FILE_TRANSFER.GET_FILE('SOURCEDIR','soetest1.dbf', 'DFTLINK','DESTDIR','soetest1.dbf');
PL/SQL procedure successfully completed.
dest端检查文件是否存在
ASMCMD> ls -ll +datadg/orcl/datafile/soetest1.dbf
Type Redund Striped Time Sys Name
N soetest1.dbf => +DATADG/ORCL/DATAFILE/FILE_TRANSFER.1223.891187881
2.4.3 方式 三
例如对于新增的数据文件test_sylar,需要执行以下步骤,手动恢复到dest端
step 1: 在xttplan.txt文件中对应表空间test2增加文件号13
vi xttplan.txt
TEST1::::2818317
6
7
8
11
12
16
17
18
19
TEST2::::2818328
9
10
13
step 2: 在getfile.sql增加相应文件内容
vi getfile.sql
0, SOURCEDIR,test1.dbf,DESTDIR,test1.dbf
0,SOURCEDIR,test2.dbf,DESTDIR,test2.dbf
0,SOURCEDIR,test3.dbf,DESTDIR,test3.dbf
0,SOURCEDIR,test1_4.dbf,DESTDIR,test1_4.dbf
0,SOURCEDIR,test1_88.dbf,DESTDIR,test1_88.dbf
0,SOURCEDIR,test1_1988.dbf,DESTDIR,test1_1988.dbf
0,SOURCEDIR,test1_1989.dbf,DESTDIR,test1_1989.dbf
0,SOURCEDIR,test1990.dbf,DESTDIR,test1990.dbf
0,SOURCEDIR,test1991.dbf,DESTDIR,test1991.dbf
1,SOURCEDIR,test21.dbf,DESTDIR,test21.dbf
1,SOURCEDIR,test22.dbf,DESTDIR,test22.dbf
1,SOURCEDIR,test_sylar.dbf,DESTDIR,test_sylar.dbf
step 3: 编辑xttnewdatafiles.txt增加相应内容
::TEST1
6,+DATADG/orcl/datafile/test1.dbf
7,+DATADG/orcl/datafile/test2.dbf
8,+DATADG/orcl/datafile/test3.dbf
11,+DATADG/orcl/datafile/test1_4.dbf
12,+DATADG/orcl/datafile/test1_88.dbf
16,+DATADG/orcl/datafile/test1_1988.dbf
17,+DATADG/orcl/datafile/test1_1989.dbf
18,+DATADG/orcl/datafile/test1990.dbf
19,+DATADG/orcl/datafile/test1991.dbf
::TEST2
9,+DATADG/orcl/datafile/test21.dbf
10,+DATADG/orcl/datafile/test22.dbf
13,+DATADG/orcl/datafile/test_sylar.dbf
step 4: 将source端的备份字节convert为目标端的字节
oracle@rac1:/home/oracle/rman-xtt>pwd
/home/oracle/rman-xtt
oracle@rac1:/home/oracle/rman-xtt>dba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Sep 19 19:47:30 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
sys@ORCL>@xttcnvrtbkupdest.sql
Enter value for 1: /home/oracle/source/1rqhilqu_1_1
Enter value for 2: /home/oracle/source
Enter value for 3: 6
ERROR IN CONVERSION ORA-19624: operation failed, retry possible
ORA-19504: failed to create file
"/home/oracle/source/xtts_incr_backup"
ORA-27038: created file already exists
Additional information: 1
ORA-19600: input file is backup
piece (/home/oracle/source/1rqhilqu_1_1)
ORA-19601: output file is backup piece (/home/oracle/source/xtts_incr_backup)
CONVERTED BACKUP PIECE/home/oracle/source/xtts_incr_backup
PL/SQL procedure successfully completed.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
step 5 :利用dbms backuprestore包恢复数据文件test_sylar
DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype := dbms_backup_restore.DeviceAllocate (type => '',ident => 't1');
dbms_backup_restore.RestoreSetDatafile;
dbms_backup_restore.RestoreDatafileTo(dfnumber => 13,toname => '+datadg/orcl/datafile/TEST_SYLAR.DBF');
dbms_backup_restore.RestoreBackupPiece(done => done,handle => '/home/oracle/source/xtts_incr_backup', params => null);
dbms_backup_restore.DeviceDeallocate;
END;
step 6: 检查数据库是否存在此文件
ASMCMD> ls -l +DATADG/orcl/datafile/test_sylar.dbf
Type Redund Striped Time Sys Name
N test_sylar.dbf => +DATADG/ORCL/DATAFILE/UNKNOWN.1074.890857729
