11G-12c xtts实验记录


SQL> select * from dba_data_files;

FILE_NAME FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS ONLINE_
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- ------------------------------ ---------- ---------- --------- ------------ --- ---------- ---------- ------------ ---------- ----------- -------
/oracle/ap/oracle/oradata/target/system01.dbf 1 SYSTEM 2705326080 330240 AVAILABLE 1 YES 3.4360E+10 4194302 1280 2704277504 330112 SYSTEM
/oracle/ap/oracle/oradata/target/sysaux01.dbf 2 SYSAUX 629145600 76800 AVAILABLE 2 YES 3.4360E+10 4194302 1280 628097024 76672 ONLINE
/oracle/ap/oracle/oradata/target/undotbs01.dbf 3 UNDOTBS1 660602880 80640 AVAILABLE 3 YES 3.4360E+10 4194302 640 659554304 80512 ONLINE
/oracle/ap/oracle/oradata/target/users01.dbf 4 USERS 10485760 1280 AVAILABLE 4 YES 3.4360E+10 4194302 160 9437184 1152 ONLINE
/oracle/ap/oracle/oradata/target/ogg.dbf 5 OGG 1048576000 128000 AVAILABLE 5 YES 3.4360E+10 4194302 1 1047527424 127872 ONLINE

SQL> create tablespace test datafile '/oracle/ap/oracle/oradata/target/test01.dbf' size 10m aotuextend on;
create tablespace test datafile '/oracle/ap/oracle/oradata/target/test01.dbf' size 10m aotuextend on
*
ERROR at line 1:
ORA-02180: invalid option for CREATE TABLESPACE


SQL> create tablespace test datafile '/oracle/ap/oracle/oradata/target/test01.dbf' size 10m aotuextend on;
create tablespace test datafile '/oracle/ap/oracle/oradata/target/test01.dbf' size 10m aotuextend on
*
ERROR at line 1:
ORA-02180: invalid option for CREATE TABLESPACE


SQL> create tablespace test datafile '/oracle/ap/oracle/oradata/target/test01.dbf' size 10m autoextend on;

Tablespace created.

SQL> create user jiacheng identified by jiacheng default tablespace test;

User created.

SQL>

SQL> grant connect,resource,select any table to jiacheng;

扫描二维码关注公众号,回复: 11315394 查看本文章

Grant succeeded.

SQL> conn jiacheng/jiacheng
Connected.
sid = (select sid from v$mystat where rownum = 1)
*

ERROR at line 29:
ORA-00942: table or view does not exist


SQL> create table xttstest(a number);

Table created.


SQL> insert into xttstest values(100);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from xttstest;

A
----------
100

SQL>
SQL> select username,default_tablespace from dba_users where username='JIACHENG';

USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
JIACHENG TEST

SQL>
SQL> select * from v$transportable_platform;

PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- -------------------------------- --------------
1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
7 Microsoft Windows IA (32-bit) Little
10 Linux IA (32-bit) Little
6 AIX-Based Systems (64-bit) Big
3 HP-UX (64-bit) Big
5 HP Tru64 UNIX Little
4 HP-UX IA (64-bit) Big
11 Linux IA (64-bit) Little
15 HP Open VMS Little
8 Microsoft Windows IA (64-bit) Little
9 IBM zSeries Based Linux Big
13 Linux x86 64-bit Little
16 Apple Mac OS Big
12 Microsoft Windows x86 64-bit Little
17 Solaris Operating System (x86) Little
18 IBM Power Based Linux Big
19 HP IA Open VMS Little
20 Solaris Operating System (x86-64 Little
)

21 Apple Mac OS (x86-64) Little

20 rows selected.


######start xtts
上传xtts的包

[oracle@rhel5 soft]$ cat xtt.properties
tablespaces=TEST
platformid=13
dfcopydir=/oracle/xtts/backup
backupformat=/oracle/xtts/backupformat
stageondest=/u01/soft/xtts/backup
storageondest=/u01/app/oracle/oradata/orcl
backupondest=/u01/soft/xtts/backupformat
parallel=8
rollparallel=4
getfileparallel=4
[oracle@rhel5 soft]$

将xttconvert脚本拷贝到目标端的相同位置下

[oracle@rhel5 soft]$ pwd
/oracle/soft
[oracle@rhel5 soft]$ ls
rman-xttconvert_2.0.zip xttdbopen.sql xttprep.tmpl xttstartupnomount.sql
xttcnvrtbkupdest.sql xttdriver.pl xtt.properties
告诉系统xttconvert脚本所在的位置
[oracle@rhel5 soft]$ export TMPDIR=/oracle/soft


源端调用xttdriver.pl做迁移准备
[oracle@rhel5 soft]$ perl xttdriver.pl -p

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Starting prepare phase
--------------------------------------------------------------------
Prepare source for Tablespaces:
'TEST' /u01/soft/xtts/backup
xttpreparesrc.sql for 'TEST' started at Sun Nov 3 17:06:37 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:37 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:39 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:39 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:39 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:39 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:40 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:40 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:40 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:40 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:40 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:40 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:41 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:41 2019
Prepare source for Tablespaces:
'' /u01/soft/xtts/backup
xttpreparesrc.sql for '' started at Sun Nov 3 17:06:41 2019
xttpreparesrc.sql for ended at Sun Nov 3 17:06:41 2019

--------------------------------------------------------------------
Done with prepare phase
--------------------------------------------------------------------
[oracle@rhel5 soft]$

在源端该准备脚本做这样几件事:
1、创建要迁移表空间中的数据文件的拷贝并将它们搬到 xtt.properties文件中定义的dfcopydir路径下。
2、验证表空间是否在线, 是否为读写模式, 并且不包含下线的数据文件。
3、在TMPDIR下还会生成以下文件:
a、xttplan.txt
b、rmanconvert.cmd

[oracle@rhel5 soft]$ ls -lrt
total 172
-rwxrwxr-x 1 oracle oinstall 52 May 22 2015 xttstartupnomount.sql
-rwxrwxr-x 1 oracle oinstall 11549 May 22 2015 xttprep.tmpl
-rwxrwxr-x 1 oracle oinstall 91722 May 22 2015 xttdriver.pl
-rwxrwxr-x 1 oracle oinstall 71 May 22 2015 xttdbopen.sql
-rwxrwxr-x 1 oracle oinstall 1390 May 22 2015 xttcnvrtbkupdest.sql
-rw-r--r-- 1 root root 26975 Nov 3 16:16 rman-xttconvert_2.0.zip
-rwxrwxr-x 1 oracle oinstall 262 Nov 3 16:25 xtt.properties
-rw-r--r-- 1 oracle oinstall 18 Nov 3 17:06 xttplan.txt
-rw-r--r-- 1 oracle oinstall 185 Nov 3 17:06 rmanconvert.cmd
-rw-r--r-- 1 oracle oinstall 11548 Nov 3 17:06 xttpreparesrc.sql
-rw-r--r-- 1 oracle oinstall 0 Nov 3 17:06 xttprepare.cmd


将源端的数据文件,传到目标端

source /oracle/xtts/backup/TEST_6.tf -----> target /u01/soft/xtts/backup

在目标端对来自源端的数据文件拷贝进行转换
source /oracle/xtts/backup/rmanconvert.cmd -----> target /oracle/soft
export TMPDIR=/oracle/soft

[oracle@12test soft]$ perl xttdriver.pl -c

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Performing convert
--------------------------------------------------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Error:
------

Argument Value Description
-----------------------------------------------------------------------------
target quoted-string connect-string for target database
catalog quoted-string connect-string for recovery catalog
auxiliary quoted-string connect-string for auxiliary database
nocatalog none if specified, then no recovery catalog
cmdfile quoted-string name of input command file
log quoted-string name of output message log file
trace quoted-string name of output debugging message log file
append none if specified, log is opened in append mode
debug optional-args activate debugging
msgno none show RMAN-nnnn prefix for all messages
send quoted-string send a command to the media manager
pipe string building block for pipe names
script string name of catalog script to execute
using list of args arguments for rman variables
timeout integer number of seconds to wait for pipe input
checksyntax none check the command file for syntax errors
-----------------------------------------------------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string.
Quotes are not required unless the string contains embedded white-space.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00556: could not open CMDFILE "/tmp/rmanconvert.cmd"

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


oracle@12test soft]$ perl xttdriver.pl -c

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Error:
------
Some failure occurred. Check /tmp/FAILED for more details
If you have fixed the issue, please delete /tmp/FAILED and run it
again OR run xttdriver.pl with -L option
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


看权限等成功
[oracle@12test soft]$ perl xttdriver.pl -c

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Performing convert
--------------------------------------------------------------------

--------------------------------------------------------------------
Converted datafiles listed in: /oracle/soft/xttnewdatafiles.txt
--------------------------------------------------------------------


转换完成
转换后的数据文件拷贝会出现在 xtt.properties文件中定义的参数storageondest下。
这时在目标的/space/oradata/tx9ab/test/下会生成一个TEST_6.xtf经转换后的数据文件拷贝。

[root@12test backup]# cd /u01/app/oracle/oradata/orcl
[root@12test orcl]# ls
control01.ctl control02.ctl pdbseed redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf TEST_6.xtf undotbs01.dbf users01.dbf
[root@12test orcl]# ls -la
总用量 2100368
drwxr-x---. 3 oracle oinstall 4096 11月 3 17:48 .
drwxr-x---. 3 oracle oinstall 4096 2月 27 2019 ..
-rw-r-----. 1 oracle oinstall 18726912 11月 3 17:50 control01.ctl
-rw-r-----. 1 oracle oinstall 18726912 11月 3 17:50 control02.ctl
drwxr-x---. 2 oracle oinstall 4096 2月 27 2019 pdbseed
-rw-r-----. 1 oracle oinstall 209715712 11月 3 16:03 redo01.log
-rw-r-----. 1 oracle oinstall 209715712 11月 3 16:03 redo02.log
-rw-r-----. 1 oracle oinstall 209715712 11月 3 17:50 redo03.log
-rw-r-----. 1 oracle oinstall 503324672 11月 3 17:43 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 849354752 11月 3 17:43 system01.dbf
-rw-r-----. 1 oracle oinstall 34611200 7月 3 22:02 temp01.dbf
-rw-r-----. 1 oracle oinstall 10493952 11月 3 17:48 TEST_6.xtf
-rw-r-----. 1 oracle oinstall 110108672 11月 3 17:48 undotbs01.dbf
-rw-r-----. 1 oracle oinstall 5251072 11月 3 16:03 users01.dbf
[root@12test orcl]#


######
在源端创造增量数据、做增量备份,然后传到目标端的, 在目标端对传过来的增量备份进行格式转换后,将增量数据应用到数据文件备份上。这个过程是可以多次重复的,这样备库上的数据文件拷贝,通过一次次应用增量数据就可以逐渐追上源库的生产数据。



SQL> conn jiacheng/jiacheng
Connected.
SQL> update xttstest set a=200;

1 row updated.

SQL> commit;

Commit complete.

SQL> select * from xttstest;

A
----------
200

SQL>

[oracle@rhel5 soft]$ perl xttd
xttdbopen.sql xttdriver.pl
[oracle@rhel5 soft]$ perl xttdriver.pl -i

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Backup incremental
--------------------------------------------------------------------
Prepare newscn for Tablespaces: 'TEST'
Prepare newscn for Tablespaces: ''
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 /oracle/soft/rmanincr.cmd

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Nov 3 17:54:40 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: TARGET (DBID=3402938556)

RMAN> set nocfau;
2> host 'echo ts::TEST';
3> backup incremental from scn 2328374
4> tag tts_incr_update tablespace 'TEST' format
5> '/oracle/xtts/backupformat/%U';
6>
executing command: SET NOCFAU
using target database control file instead of recovery catalog

ts::TEST
host command complete

Starting backup at 03-NOV-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=46 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/oracle/ap/oracle/oradata/target/test01.dbf
channel ORA_DISK_1: starting piece 1 at 03-NOV-19
channel ORA_DISK_1: finished piece 1 at 03-NOV-19
piece handle=/oracle/xtts/backupformat/05ufv8f0_1_1 tag=TTS_INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 03-NOV-19

Recovery Manager complete.


--------------------------------------------------------------------
Done backing up incrementals
--------------------------------------------------------------------
[oracle@rhel5 soft]$


上面的操作还会在TMPDIR目录下产生以下的文件
1、tsbkupmap.txt
2、incrbackups.txt

oracle@rhel5 soft]$ ls -lrt
total 200
-rwxrwxr-x 1 oracle oinstall 52 May 22 2015 xttstartupnomount.sql
-rwxrwxr-x 1 oracle oinstall 11549 May 22 2015 xttprep.tmpl
-rwxrwxr-x 1 oracle oinstall 91722 May 22 2015 xttdriver.pl
-rwxrwxr-x 1 oracle oinstall 71 May 22 2015 xttdbopen.sql
-rwxrwxr-x 1 oracle oinstall 1390 May 22 2015 xttcnvrtbkupdest.sql
-rw-r--r-- 1 root root 26975 Nov 3 16:16 rman-xttconvert_2.0.zip
-rwxrwxr-x 1 oracle oinstall 262 Nov 3 16:25 xtt.properties
-rw-r--r-- 1 oracle oinstall 0 Nov 3 17:36 xttprepare.cmd1572774141
-rw-r--r-- 1 oracle oinstall 18 Nov 3 17:42 xttplan.txt
-rw-r--r-- 1 oracle oinstall 185 Nov 3 17:42 rmanconvert.cmd
-rw-r--r-- 1 oracle oinstall 11548 Nov 3 17:42 xttpreparesrc.sql
-rw-r--r-- 1 oracle oinstall 20 Nov 3 17:54 xttplan.txt.new
-rw-r--r-- 1 oracle oinstall 0 Nov 3 17:54 xttprepare.cmd
-rw-r--r-- 1 oracle oinstall 11522 Nov 3 17:54 xttdetnewfromscnsrc.sql
-rw-r--r-- 1 oracle oinstall 152 Nov 3 17:54 rmanincr.cmd
-rw-r--r-- 1 oracle oinstall 25 Nov 3 17:54 tsbkupmap.txt
-rw-r--r-- 1 oracle oinstall 39 Nov 3 17:54 incrbackups.txt
[oracle@rhel5 soft]$


将增量备份和新生文件上传至目标端(略)

在源端对刚传过来的增量备份进行转换和应用


oracle@12test soft]$ perl xttdriver.pl -r

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Error:
------
Some failure occurred. Check /oracle/soft/FAILED for more details
If you have fixed the issue, please delete /oracle/soft/FAILED and run it
again OR run xttdriver.pl with -L option
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[oracle@12test soft]$ perl xttdriver.pl -r -L

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Start rollforward
--------------------------------------------------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Error:
------
/oracle/soft/xxttconv_05ufv8f0_1_1_6.sql execution failed
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Error:
------
Some failure occurred. Check /oracle/soft/FAILED for more details
If you have fixed the issue, please delete /oracle/soft/FAILED and run it
again OR run xttdriver.pl with -L option
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[oracle@12test soft]$ ls
FAILED xttcnvrtbkupdest.sql xtt.properties
incrbackups.txt xttdbopen.sql xttstartupnomount.sql
rmanconvert.cmd xttdriver.pl xxttconv_05ufv8f0_1_1_6.sql
rmanconvert.cmd.tar xttnewdatafiles.txt xxttroll_6.sql
rman-xttconvert_2.0.zip xttplan.txt
tsbkupmap.txt xttprep.tmpl
[oracle@12test soft]$ ls -la
总用量 200
drwxrwxr-x. 2 oracle oinstall 4096 11月 3 18:15 .
drwxrwxr-x. 3 oracle oinstall 4096 11月 3 16:28 ..
-rw-r--r--. 1 oracle oinstall 58 11月 3 18:15 FAILED
-rw-r--r--. 1 oracle oinstall 39 11月 3 17:58 incrbackups.txt
-rw-r--r--. 1 oracle oinstall 185 11月 3 17:42 rmanconvert.cmd
-rw-r--r--. 1 root root 10240 11月 3 17:43 rmanconvert.cmd.tar
-rw-r--r--. 1 root root 26975 11月 3 16:29 rman-xttconvert_2.0.zip
-rw-r--r--. 1 oracle oinstall 25 11月 3 17:58 tsbkupmap.txt
-rwxrwxr-x. 1 oracle oinstall 1390 5月 22 2015 xttcnvrtbkupdest.sql
-rwxrwxr-x. 1 oracle oinstall 71 5月 22 2015 xttdbopen.sql
-rwxrwxr-x. 1 oracle oinstall 91722 5月 22 2015 xttdriver.pl
-rw-r--r--. 1 oracle oinstall 49 11月 3 17:48 xttnewdatafiles.txt
-rw-r--r--. 1 oracle oinstall 20 11月 3 18:03 xttplan.txt
-rwxrwxr-x. 1 oracle oinstall 11549 5月 22 2015 xttprep.tmpl
-rwxrwxr-x. 1 oracle oinstall 263 11月 3 17:04 xtt.properties
-rwxrwxr-x. 1 oracle oinstall 52 5月 22 2015 xttstartupnomount.sql
-rw-r--r--. 1 oracle oinstall 1394 11月 3 18:15 xxttconv_05ufv8f0_1_1_6.sql
-rw-r--r--. 1 oracle oinstall 723 11月 3 18:15 xxttroll_6.sql
[oracle@12test soft]$ cat FAILED
/oracle/soft/xxttconv_05ufv8f0_1_1_6.sql execution failed

好几次失败,修改备份路径到stageondest下
cp 05ufv8f0_1_1 /u01/soft/xtts/backup

[oracle@12test soft]$ rm FAILED
[oracle@12test soft]$ perl xttdriver.pl -r

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Start rollforward
--------------------------------------------------------------------

--------------------------------------------------------------------
End of rollforward phase
--------------------------------------------------------------------
[oracle@12test soft]$

再做最后一次增量
目标端修改数据
SQL> conn jiacheng/jiacheng
Connected.
SQL> update xttstest set a=300;

1 row updated.

SQL> commit;

Commit complete.

SQL> select * from xttstest;

A
----------
300

[oracle@rhel5 soft]$ perl xttdriver.pl -i

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Backup incremental
--------------------------------------------------------------------
Prepare newscn for Tablespaces: 'TEST'
Prepare newscn for Tablespaces: ''
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 /oracle/soft/rmanincr.cmd

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Nov 3 18:31:33 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: TARGET (DBID=3402938556)

RMAN> set nocfau;
2> host 'echo ts::TEST';
3> backup incremental from scn 2328374
4> tag tts_incr_update tablespace 'TEST' format
5> '/oracle/xtts/backupformat/%U';
6>
executing command: SET NOCFAU
using target database control file instead of recovery catalog

ts::TEST
host command complete

Starting backup at 03-NOV-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=46 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/oracle/ap/oracle/oradata/target/test01.dbf
channel ORA_DISK_1: starting piece 1 at 03-NOV-19
channel ORA_DISK_1: finished piece 1 at 03-NOV-19
piece handle=/oracle/xtts/backupformat/06ufvak6_1_1 tag=TTS_INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 03-NOV-19

Recovery Manager complete.


--------------------------------------------------------------------
Done backing up incrementals
--------------------------------------------------------------------
[oracle@rhel5 soft]$


再将生成的增量和文件传过去应用

[oracle@12test soft]$ perl xttdriver.pl -r

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Start rollforward
--------------------------------------------------------------------

--------------------------------------------------------------------
End of rollforward phase
--------------------------------------------------------------------

刚才忘了做一步,所以还得再来一次最后的增量


QL> conn jiacheng/jiacheng
Connected.
SQL> insert into xttstest values(900);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from xttstest;

A
----------
300
900


这里将源库表空间设置为read only 保持scn不变,最后一次了
SQL> alter tablespace test read only;
alter tablespace test read only
*
ERROR at line 1:
ORA-01031: insufficient privileges


SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rhel5 backupformat]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Nov 3 18:40:55 2019

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, OLAP, Data Mining and Real Application Testing options

SQL> alter tablespace test read only;

Tablespace altered.

SQL>


再进行增量备份传过去应用
[oracle@rhel5 soft]$ perl xttdriver.pl -i

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Backup incremental
--------------------------------------------------------------------
Prepare newscn for Tablespaces: 'TEST'
Prepare newscn for Tablespaces: ''
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 /oracle/soft/rmanincr.cmd

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Nov 3 18:41:22 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: TARGET (DBID=3402938556)

RMAN> set nocfau;
2> host 'echo ts::TEST';
3> backup incremental from scn 2328374
4> tag tts_incr_update tablespace 'TEST' format
5> '/oracle/xtts/backupformat/%U';
6>
executing command: SET NOCFAU
using target database control file instead of recovery catalog

ts::TEST
host command complete

Starting backup at 03-NOV-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/oracle/ap/oracle/oradata/target/test01.dbf
channel ORA_DISK_1: starting piece 1 at 03-NOV-19
channel ORA_DISK_1: finished piece 1 at 03-NOV-19
piece handle=/oracle/xtts/backupformat/07ufvb6j_1_1 tag=TTS_INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 03-NOV-19

Recovery Manager complete.


--------------------------------------------------------------------
Done backing up incrementals
--------------------------------------------------------------------

目标端
root@12test soft]# ls -lrt
总用量 184
-rwxrwxr-x. 1 oracle oinstall 52 5月 22 2015 xttstartupnomount.sql
-rwxrwxr-x. 1 oracle oinstall 11549 5月 22 2015 xttprep.tmpl
-rwxrwxr-x. 1 oracle oinstall 91722 5月 22 2015 xttdriver.pl
-rwxrwxr-x. 1 oracle oinstall 71 5月 22 2015 xttdbopen.sql
-rwxrwxr-x. 1 oracle oinstall 1390 5月 22 2015 xttcnvrtbkupdest.sql
-rw-r--r--. 1 root root 26975 11月 3 16:29 rman-xttconvert_2.0.zip
-rwxrwxr-x. 1 oracle oinstall 263 11月 3 17:04 xtt.properties
-rw-r--r--. 1 oracle oinstall 185 11月 3 17:42 rmanconvert.cmd
-rw-r--r--. 1 root root 10240 11月 3 17:43 rmanconvert.cmd.tar
-rw-r--r--. 1 oracle oinstall 49 11月 3 17:48 xttnewdatafiles.txt
-rw-r--r--. 1 oracle oinstall 20 11月 3 18:03 xttplan.txt
-rw-r--r--. 1 oracle oinstall 1361 11月 3 18:36 xxttroll_6.sql
-rw-r--r--. 1 oracle oinstall 25 11月 3 18:43 tsbkupmap.txt
-rw-r--r--. 1 oracle oinstall 39 11月 3 18:43 incrbackups.txt


[oracle@12test soft]$ perl xttdriver.pl -r

--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------

--------------------------------------------------------------------
Start rollforward
--------------------------------------------------------------------

--------------------------------------------------------------------
End of rollforward phase
--------------------------------------------------------------------
[oracle@12test soft]$

-源端导出要迁移的表空间的Metadata
[oracle@rhel5 exp]$ exp \'/ as sysdba\' tablespaces=test transport_tablespace=y file=/oracle/exp/test_xtts.dmp

Export: Release 11.2.0.4.0 - Production on Sun Nov 3 18:48:25 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace TEST ...
. exporting cluster definitions
. exporting table definitions
. . exporting table XTTSTEST
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.


--在目标导入迁移的表空间的Metadata
[oracle@rhel5 exp]$


imp \'/ as sysdba\' tablespaces=test transport_tablespace=y file=/u01/soft/xtts/test_xtts.dmp datafiles=/u01/app/oracle/oradata/orcl/TEST_6.xtf

Import: Release 12.2.0.1.0 - Production on Sun Nov 3 18:59:23 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.


Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export client uses US7ASCII character set (possible charset conversion)
IMP-00403:

Warning: This import generated a separate SQL file "import_sys" which contains DDL that failed due to a privilege issue.

. importing SYS's objects into SYS
. importing SYS's objects into SYS
IMP-00017: following statement failed with ORACLE error 29342:
"BEGIN sys.dbms_plugts.checkUser('JIACHENG'); END;"
IMP-00003: ORACLE error 29342 encountered
ORA-29342: user JIACHENG does not exist in the database
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_PLUGTS", line 2524
ORA-06512: at line 1
IMP-00000: Import terminated unsuccessfully
[oracle@12test soft]$


由于12C PDB,尝试建个PDB试试
CREATE PLUGGABLE DATABASE pdb1
ADMIN USER padm IDENTIFIED BY oracle
ROLES = (dba)
FILE_NAME_CONVERT = ('pdbseed',
'pdb1')

在pdb里建上用户jiacheng


[oracle@12test xtts]$ imp jiacheng/[email protected]:1521/pdb1 tablespaces=test transport_tablespace=y file=/u01/soft/xtts/test_xtts.dmp datafiles=/u01/app/oracle/oradata/orcl/TEST_6.xtf

Import: Release 12.2.0.1.0 - Production on Sun Nov 3 19:25:45 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.


Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...

Warning: the objects were exported by SYS, not by you

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export client uses US7ASCII character set (possible charset conversion)
IMP-00403:

Warning: This import generated a separate SQL file "import_sys" which contains DDL that failed due to a privilege issue.

IMP-00003: ORACLE error 6550 encountered
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_PLUGTS.NEWTABLESPACE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
IMP-00000: Import terminated unsuccessfully

12c不能用imp 有重试expdp,监听设置好

[oracle@rhel5 expdp]$ expdp \'/ as sysdba\' directory=imp_dir TRANSPORT_TABLESPACES=y dumpfile=test_xtts.dmp

Export: Release 11.2.0.4.0 - Production on Sun Nov 3 19:52:18 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "SYS"."SYS_EXPORT_TRANSPORTABLE_01": "/******** AS SYSDBA" directory=imp_dir TRANSPORT_TABLESPACES=y dumpfile=test_xtts.dmp
ORA-39123: Data Pump transportable tablespace job aborted
ORA-39186: No tablespaces in the specified list exist.

Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" stopped due to fatal error at Sun Nov 3 19:52:22 2019 elapsed 0 00:00:02

[oracle@rhel5 expdp]$ expdp \'/ as sysdba\' directory=imp_dir TRANSPORT_TABLESPACES=test dumpfile=test_xtts.dmp

Export: Release 11.2.0.4.0 - Production on Sun Nov 3 19:53:05 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "SYS"."SYS_EXPORT_TRANSPORTABLE_01": "/******** AS SYSDBA" directory=imp_dir TRANSPORT_TABLESPACES=test dumpfile=test_xtts.dmp
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/PROCACT_INSTANCE
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
/oracle/expdp/test_xtts.dmp
******************************************************************************
Datafiles required for transportable tablespace TEST:
/oracle/ap/oracle/oradata/target/test01.dbf
Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at Sun Nov 3 19:53:19 2019 elapsed 0 00:00:13

[oracle@rhel5 expdp]$ ls
export.log test_xtts.dmp


[oracle@12test xtts]$ impdp jiacheng/[email protected]:1521/pdb1 directory=imp_dir TRANSPORT_TABLESPACES=test dumpfile=test_xtts.dmp

Import: Release 12.2.0.1.0 - Production on Sun Nov 3 19:59:42 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
UDI-00011: parameter dumpfile is incompatible with parameter transport_tablespaces

[oracle@12test xtts]$

[oracle@12test xtts]$
[oracle@12test xtts]$ impdp jiacheng/[email protected]:1521/pdb1 directory=imp_dir TRANSPORT_TABLESPACES=test dumpfile=test_xtts.dmp

Import: Release 12.2.0.1.0 - Production on Sun Nov 3 20:01:12 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
UDI-00011: parameter dumpfile is incompatible with parameter transport_tablespaces

[oracle@12test xtts]$ impdp jiacheng/[email protected]:1521/pdb1 directory=imp_dir dumpfile=test_xtts.dmp

Import: Release 12.2.0.1.0 - Production on Sun Nov 3 20:01:39 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
ORA-39002: invalid operation
ORA-39061: import mode FULL conflicts with export mode TRANSPORTABLE

impdp jiacheng/[email protected]:1521/pdb1 directory=imp_dir dumpfile=test_xtts.dmp logfile=test_xtts.log metrics=y transport_datafiles='/u01/app/oracle/oradata/orcl/TEST_6.xtf';
encryption_password=secret123word456

[oracle@12test orcl]$ impdp jiacheng/[email protected]:1521/pdb1 directory=imp_dir dumpfile=test_xtts.dmp logfile=test_xtts.log metrics=y transport_datafiles='/u01/app/oracle/oradata/orcl/TEST_6.xtf';

Import: Release 12.2.0.1.0 - Production on Sun Nov 3 20:06:48 2019

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
W-1 Startup took 0 seconds
W-1 Master table "JIACHENG"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
W-1 Source time zone is +08:00 and target time zone is +00:00.
Starting "JIACHENG"."SYS_IMPORT_TRANSPORTABLE_01": jiacheng/********@192.168.220.123:1521/pdb1 directory=imp_dir dumpfile=test_xtts.dmp logfile=test_xtts.log metrics=y transport_datafiles=/u01/app/oracle/oradata/orcl/TEST_6.xtf
W-1 Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
W-1 Completed 1 PLUGTS_BLK objects in 1 seconds
W-1 Processing object type TRANSPORTABLE_EXPORT/PROCACT_INSTANCE
W-1 Completed 1 PROCACT_INSTANCE objects in 0 seconds
W-1 Processing object type TRANSPORTABLE_EXPORT/TABLE
W-1 Completed 1 TABLE objects in 1 seconds
W-1 Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
W-1 Completed 1 PLUGTS_BLK objects in 0 seconds
Job "JIACHENG"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Sun Nov 3 20:06:51 2019 elapsed 0 00:00:03


SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;

TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
TEST READ ONLY


SQL> alter tablespace test read write;

Tablespace altered.

SQL> select TABLESPACE_NAME,STATUS from dba_tablespaces;

TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
TEST ONLINE


SQL> select * from jiacheng.xttstest;

A
----------
300
900

猜你喜欢

转载自www.cnblogs.com/nadian-li/p/13161493.html