XTTS测试

零、环境介绍
源端操作系统:CentOS7.6
目标操作系统:CentOS7.6
数据库版本:11.2.0.4—>19.3.0 PDB

一、迁移前准备

SQL> alter database enable block change tracking using file ‘/home/oracle/block_change_tracking.f’;

1、创建测试表空间

create tablespace tbs11 datafile '/u01/app/oracle/oradata/ora11g/tbs11_01.dbf' size 100m;
create user test identified by 123 default tablespace tbs11;
grant resource,connect,dba to test;
SQL> conn test/123
SQL> create table t1 as select * from dba_objects;  
SQL> create table t2 as select * from dba_tables;
SQL> create table t3 as select * from dict;
SQL> exec dbms_stats.gather_schema_stats('TEST');
SQL> select table_name,num_rows from user_tables;

TABLE_NAME                       NUM_ROWS

------------------------------ ----------

T3                                   2666
T2                                   2795
T1                                  86259

2、查看平台信息

SQL> set pagesize 200;
SQL> col platform_name for a36
SQL> select * from v$transportable_platform order by platform_name;

PLATFORM_ID PLATFORM_NAME                        ENDIAN_FORMAT

----------- ------------------------------------ --------------

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

20 rows selected.

3、检查字符集(源端和目标端应一致)

源端

SQL> col VALUE$ for a20;
SQL> col name for a30;
SQL>  select name,value$ from PROPS$ where name like '%CHARACTERSET%';
SQL> select name,value$ from PROPS$ where name like '%CHARACTERSET%';

NAME                           VALUE$

------------------------------ --------------------

NLS_CHARACTERSET               AL32UTF8
NLS_NCHAR_CHARACTERSET         UTF8

目标端

SQL> col VALUE$ for a20;
SQL> col name for a30;
SQL>  select name,value$ from PROPS$ where name like '%CHARACTERSET%';

NAME                           VALUE$

------------------------------ --------------------

NLS_NCHAR_CHARACTERSET         AL16UTF16
NLS_CHARACTERSET               AL32UTF8

SQL> 

4、检查表空间自包含(SYS用户)

SQL> EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('TBS11', TRUE);

二、XTTS迁移

1、解压XTTS

[oracle@test2 ~]$ cd /home/oracle/xtt/
[oracle@test2 xtt]$ unzip rman_xttconvert_v3.zip 
Archive:  rman_xttconvert_v3.zip
  inflating: xtt.properties          
  inflating: xttcnvrtbkupdest.sql    
  inflating: xttdbopen.sql           
  inflating: xttdriver.pl            
  inflating: xttprep.tmpl            
 extracting: xttstartupnomount.sql 

2、配置XTTS

[oracle@test2 xtt]$ mkdir stage_source
[oracle@test2 xtt]$ mkdir stage_dest



tablespaces=TBS11    --注意要大写
platformid=13
dfcopydir=/home/oracle/xtt/stage_source
backupformat=/home/oracle/xtt/stage_source
stageondest=/home/oracle/xtt/stage_dest
storageondest=/u01/app/oracle/oradata/xtt
backupondest=/home/oracle/xtt/stage_dest

tablespaces=xtts 
platformid=13
dfcopydir=/backup/xtts/full     -- 源端datafile convert 保存路径,产生的是datafile copy 。
backupformat=/backup/xtts/inc    -- 源端备份保存路径(含增量备份) .源库上备份放置的地方,这个目录必须有足够的空闲磁盘空间来放置0级备份及所有之后产生的增量备份
stageondest=/backup/xtts/full    --目标端备份文件存放路径 .目标系统上用来放置从源库上传输过来的备份的位置
storageondest=/u01/app/oracle/oradata/testogg   -- 目标端的数据文件保存位置
backupondest=/backup/xtts/inc     --目标端增量备份集存放路径
[oracle@test1 ~]$ mkdir xtt


[oracle@test2 xtt]$ scp * oracle@test1:/home/oracle/xtt


[oracle@test2 xtt]$ export TMPDIR=/home/oracle/xtt
[oracle@test1 ~]$ export TMPDIR=/home/oracle/xtt


[oracle@test1 ~]$ cd $ORACLE_HOME/dbs
[oracle@test1 dbs]$ ls
hc_testdb.dat  init.ora  lkTESTDB  orapwtestdb  spfiletestdb.ora
[oracle@test1 dbs]$ vi inittmp.ora
db_name='ORCL'
compatible ='11.2.0'
export ORACLE_SID=tmp

[oracle@test2 xtt]$ /u01/app/oracle/product/11.2.0/db_1/perl/bin/perl  xttdriver.pl -p



#scp  /home/oracle/xtt/xttplan.txt test1:/home/oracle/xtt/
scp  /home/oracle/xtt/stage_source/* test1:/home/oracle/xtt/stage_dest/
scp  /home/oracle/xtt/rmanconvert.cmd test1:/home/oracle/xtt/rmanconvert.cmd



/u01/app/oracle/product/19.3.0/db/perl/bin/perl  xttdriver.pl -c

SQL> conn test/123;
Connected.
SQL> create table t4 as select * from dba_segments;

Table created.


/u01/app/oracle/product/11.2.0/db_1/perl/bin/perl  xttdriver.pl -i


scp `cat incrbackups.txt` test1:/home/oracle/xtt/stage_dest
scp  /home/oracle/xtt/xttplan.txt test1:/home/oracle/xtt
scp  /home/oracle/xtt/tsbkupmap.txt test1:/home/oracle/xtt




/u01/app/oracle/product/19.3.0/db/perl/bin/perl xttdriver.pl -r


SQL> conn / as sysdba
Connected.
SQL> alter tablespace tbs11 read only;

Tablespace altered.

SQL> 

 /u01/app/oracle/product/11.2.0/db_1/perl/bin/perl  xttdriver.pl -i

3.XTTS迁移

create public database link ttslink connect to test identified by Oracle123 using '//test2:1521/ora11g';

SQL>alter session set container=pdb1
SQL>  create directory xtt as '/home/oracle';
SQL> grant read,write on directory xtt to lys;
SQL> create user test identified by 123 ;
SQL> grant,connect,resource to test;
SQL> create public database link ttslink connect to test identified by Oracle123 using '//test2:1521/ora11g';
SQL>  select count(*) from t1@ttslink;



impdp lys/lys@pdb1 directory=xtt logfile=tts_imp.log network_link=ttslink transport_full_check=no transport_tablespaces=TBS11 transport_datafiles='/u01/app/oracle/oradata/xtt/TBS11_5.dbf';



[oracle@test1 ~]$ rman target /
RMAN> validate pluggable database pdb1 check logical;
[oracle@test1 ~]$ sqlplus test/123@pdb1
SQL> select table_name,num_rows from user_tables;
TABLE_NAME                                 NUM_ROWS

---------------------------------------- ----------

T5
T4
T3                                             2666
T2                                             2795
T1                                            86259

三、问题

错误1:

Error:
------

Make sure srcdir dstdir srclink is not defined with prepare

写绝对路径
[oracle@test2 xtt]$ /u01/app/oracle/product/11.2.0/db_1/perl/bin/perl xttdriver.pl -p

错误2:

执行完,没有报错,但没有备份文件生成

tablespaces指示错误,注意表空间要大写

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南風_入弦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值