【TTS】基于RMAN迁移AIX平台数据库到Linux(第二篇)

继热文

1.1  判断平台支持并确定字节序

如果传输表空间集到不同的平台,则要确定对于源和目标平台这种跨平台表空间被支持,也要确定每个平台的字节序,如果平台具有相同的字节序,则不需要进行转化,否则必须做一个表空间集转化,在源端或目标端都可以进行转换。

SQL>col platform_name for a40

SQL>select tp.platform_name, tp.endian_format

  2    from v$transportable_platform tp

  3   where tp.platform_name in ('Linux x86 64-bit', 'AIX-Based Systems(64-bit)');

 

PLATFORM_NAME                            ENDIAN_FORMAT

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

AIX-BasedSystems (64-bit)               Big

Linuxx86 64-bit                         Little

 

可以看到source端的字节序为Big,而target端的字节序为Little,所以需要进行字节序的转换,前边说过在源端或目标端都可以进行转换,这里我们选择在目标端来进行转换。

1.2  判断表空间集是否自包含

Indicates whether a full or partial dependency check isrequired. If TRUE, treats all IN and OUT pointers(dependencies) and capturesthem as violations if they are not self-contained in the transportable set.

oracle@ZDMTRAIN2:/oracle$sqlplus / as sysdba

SYS@oraSKY>exec sys.dbms_tts.transport_set_check('TEST_USER1,USERS,XPADDATA',true);

PL/SQLprocedure successfully completed.

 

SYS@oraSKY>col violations for a70

SYS@oraSKY>select * from sys.transport_set_violations;

norows selected

 

结论:此时这个表空间集已经不再违背自包含的条件,可以确定为一个可传输表空间集。在实际生产环境中也是如此检查的,若是全库迁移,得把需要迁移的表空间修改为自包含的。

1.3   产生可传输表空间集

1.3.1  rman备份source

当然,如果已经有全库备份了就可以省略这个步骤。

 

oracle@ZDMTRAIN2:/oracle$mkdir -p /lxm/oracle_bk/

oracle@ZDMTRAIN2:/oracle$rman target /

connectedto target database: ORASKY (DBID=98202371)

RMAN> backup  as compressedbackupset  format  '/lxm/oracle_bk/full_%n_%T_%t_%s.bak'database include current controlfile plus archivelog delete input ;

Startingbackup at 2017-02-17 17:14:34

usingchannel ORA_DISK_1

channelORA_DISK_1: starting compressed archived log backup set

channelORA_DISK_1: specifying archived log(s) in backup set

inputarchived log thread=1 sequence=29 RECID=4 STAMP=936206156

channelORA_DISK_1: starting piece 1 at 2017-02-17 17:15:56

channelORA_DISK_1: finished piece 1 at 2017-02-17 17:15:57

piecehandle=/lxm/oracle_bk/full_ORASKYxx_20170217_936206156_14.baktag=TAG20170217T171556 comment=NONE

channelORA_DISK_1: backup set complete, elapsed time: 00:00:01

channelORA_DISK_1: deleting archived log(s)

archivedlog file name=/oracle/app/oracle/product/11.2.0/db/dbs/arch1_29_1268916931.dbfRECID=4 STAMP=936206156

Finishedbackup at 2017-02-17 17:15:57

1.3.2   transporttablespace 生成文件

oracle@ZDMTRAIN2:/oracle/transportdest$df -g

oracle@ZDMTRAIN2:/oracle/transportdest$

oracle@ZDMTRAIN2:/oracle/app$df -g         

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

/dev/hd4           6.00      2.29  62%    12356     3% /

《《《《。。。。。。。。篇幅原因,有省略。。。。。。。。》》》》

/dev/Tlv_fta       8.00     7.74    4%     2627    1% /fta

/dev/fslv100       0.12     0.12    1%        9    1% /zling

/dev/lxmlv       20.00     19.73    2%      18     1% /lxm

22.188.189.42:/privatebk   8000.00  7954.59    1%     4381    1% /privatebk

 

oracle@ZDMTRAIN2:/oracle$rman target /

connectedto target database: ORASKY (DBID=98202371)

RMAN>transport tablespace TEST_USER1,USERS,XPADDATA tablespace destination'/lxm/transportdest' auxiliary destination '/lxm/transportdest';

usingtarget database control file instead of recovery catalog

RMAN-05026:WARNING: presuming following set of tablespaces applies to specifiedpoint-in-time

 

Listof tablespaces expected to have UNDO segments

TablespaceSYSTEM

TablespaceUNDOTBS1

 

Creatingautomatic instance, with SID='wmch'

initializationparameters used for automatic instance:

db_name=ORASKY

db_unique_name=wmch_tspitr_ORASKY

compatible=11.2.0.0.0

db_block_size=8192

db_files=200

sga_target=280M

processes=50

db_create_file_dest=/lxm/transportdest

log_archive_dest_1='location=/lxm/transportdest'

#Noauxiliary parameter file used

startingup automatic instance ORASKY

 

Oracleinstance started

 

TotalSystem Global Area     292278272 bytes

 

FixedSize                     2220880 bytes

VariableSize                100666544 bytes

DatabaseBuffers             184549376 bytes

RedoBuffers                   4841472 bytes

Automaticinstance created

RunningTRANSPORT_SET_CHECK on recovery set tablespaces

TRANSPORT_SET_CHECKcompleted successfully

 

contentsof Memory Script:

{

#set requested point in time

setuntil  scn 8915883;

#restore the controlfile

restoreclone controlfile;

#mount the controlfile

sqlclone 'alter database mount clone database';

#archive current online log

sql'alter system archive log current';

}

executingMemory Script

 

executingcommand: SET until clause

 

Startingrestore at 2017-02-17 18:07:39

allocatedchannel: ORA_AUX_DISK_1

channelORA_AUX_DISK_1: SID=80 device type=DISK

 

channelORA_AUX_DISK_1: starting datafile backup set restore

channelORA_AUX_DISK_1: restoring control file

channelORA_AUX_DISK_1: reading from backup piece/lxm/oracle_bk/full_ORASKYxx_20170217_936208508_21.bak

channelORA_AUX_DISK_1: piece handle=/lxm/oracle_bk/full_ORASKYxx_20170217_936208508_21.baktag=TAG20170217T175351

channelORA_AUX_DISK_1: restored backup piece 1

channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

outputfile name=/lxm/transportdest/ORASKY/controlfile/o1_mf_dbflvdrg_.ctl

Finishedrestore at 2017-02-17 18:07:41

 

sqlstatement: alter database mount clone database

 

sqlstatement: alter system archive log current

 

contentsof Memory Script:

{

#set requested point in time

setuntil  scn 8915883;

#set destinations for recovery set and auxiliary set datafiles

setnewname for clone datafile  1 to new;

setnewname for clone datafile  3 to new;

setnewname for clone datafile  2 to new;

setnewname for clone tempfile  1 to new;

setnewname for datafile  22 to

 "/lxm/transportdest/o1_mf_test_use_%u_.dbf";

setnewname for datafile  14 to

 "/lxm/transportdest/o1_mf_xpaddata_%u_.dbf";

#switch all tempfiles

switchclone tempfile all;

#restore the tablespaces in the recovery set and the auxiliary set

restoreclone datafile  1, 3, 2, 22, 4, 5, 6, 7,8, 9, 10, 11, 12, 13, 14;

switchclone datafile all;

}

executingMemory Script

executingcommand: SET until clause

executingcommand: SET NEWNAME

….

renamedtempfile 1 to /lxm/transportdest/ORASKY/datafile/o1_mf_temp_%u_.tmp in controlfile

Startingrestore at 2017-02-17 18:07:49

usingchannel ORA_AUX_DISK_1

 

channelORA_AUX_DISK_1: starting datafile backup set restore

channelORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

channelORA_AUX_DISK_1: restoring datafile 00001 to/lxm/transportdest/ORASKY/datafile/o1_mf_system_%u_.dbf

channelORA_AUX_DISK_1: restoring datafile 00003 to/lxm/transportdest/ORASKY/datafile/o1_mf_undotbs1_%u_.dbf

channelORA_AUX_DISK_1: restoring datafile 00002 to/lxm/transportdest/ORASKY/datafile/o1_mf_sysaux_%u_.dbf

channelORA_AUX_DISK_1: restoring datafile 00022 to/lxm/transportdest/o1_mf_test_use_%u_.dbf

channelORA_AUX_DISK_1: restoring datafile 00014 to/lxm/transportdest/o1_mf_xpaddata_%u_.dbf

channelORA_AUX_DISK_1: reading from backup piece/lxm/oracle_bk/full_ORASKYxx_20170217_936208432_20.bak

channelORA_AUX_DISK_1: piece handle=/lxm/oracle_bk/full_ORASKYxx_20170217_936208432_20.baktag=TAG20170217T175351

channelORA_AUX_DISK_1: restored backup piece 1

channelORA_AUX_DISK_1: restore complete, elapsed time: 00:03:09

Finishedrestore at 2017-02-17 18:11:04

 

datafile1 switched to datafile copy

inputdatafile copy RECID=16 STAMP=936209464 filename=/lxm/transportdest/ORASKY/datafile/o1_mf_system_dbflvvqx_.dbf

datafile3 switched to datafile copy

inputdatafile copy RECID=17 STAMP=936209464 filename=/lxm/transportdest/ORASKY/datafile/o1_mf_undotbs1_dbflvvr9_.dbf

datafile2 switched to datafile copy

inputdatafile copy RECID=18 STAMP=936209464 filename=/lxm/transportdest/ORASKY/datafile/o1_mf_sysaux_dbflvvr1_.dbf

datafile22 switched to datafile copy

inputdatafile copy RECID=19 STAMP=936209464 file name=/lxm/transportdest/o1_mf_test_use_dbflvw0f_.dbf

datafile14 switched to datafile copy

inputdatafile copy RECID=30 STAMP=936209464 file name=/lxm/transportdest/o1_mf_xpaddata_dbflvy06_.dbf

 

contentsof Memory Script:

{

#set requested point in time

setuntil  scn 8915883;

#online the datafiles restored or switched

sqlclone "alter database datafile  1online";

sqlclone "alter database datafile  3online";

…;

sqlclone "alter database datafile  14online";

#recover and open resetlogs

recoverclone database tablespace "TEST_USER1", "USERS", "XPADDATA","SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;

alterclone database open resetlogs;

}

executingMemory Script

 

executingcommand: SET until clause

 

sqlstatement: alter database datafile  1online

sqlstatement: alter database datafile  14online

 

Startingrecover at 2017-02-17 18:11:06

usingchannel ORA_AUX_DISK_1

 

startingmedia recovery

 

channelORA_AUX_DISK_1: starting archived log restore to default destination

channelORA_AUX_DISK_1: restoring archived log

archivedlog thread=1 sequence=36

channelORA_AUX_DISK_1: reading from backup piece/lxm/oracle_bk/full_ORASKYxx_20170217_936208510_22.bak

channelORA_AUX_DISK_1: piece handle=/lxm/oracle_bk/full_ORASKYxx_20170217_936208510_22.baktag=TAG20170217T175510

channelORA_AUX_DISK_1: restored backup piece 1

channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01

archivedlog file name=/lxm/transportdest/1_36_1268916931.dbf thread=1 sequence=36

channelclone_default: deleting archived log(s)

archivedlog file name=/lxm/transportdest/1_36_1268916931.dbf RECID=11 STAMP=936209471

mediarecovery complete, elapsed time: 00:00:00

Finishedrecover at 2017-02-17 18:11:12

 

databaseopened

 

contentsof Memory Script:

{

#make read only the tablespace that will be exported

sqlclone 'alter tablespace  TEST_USER1 readonly';

sqlclone 'alter tablespace  USERS readonly';

sqlclone 'alter tablespace  XPADDATA readonly';

#create directory for datapump export

sqlclone "create or replace directory STREAMS_DIROBJ_DPDIR as ''

/lxm/transportdest''";

}

executingMemory Script

sqlstatement: alter tablespace  TEST_USER1read only

sqlstatement: alter tablespace  USERS readonly

sqlstatement: alter tablespace  XPADDATAread only

sqlstatement: create or replace directory STREAMS_DIROBJ_DPDIR as''/lxm/transportdest''

Performingexport of metadata...

   EXPDP> Starting"SYS"."TSPITR_EXP_wmch": 

   EXPDP> Processing object typeTRANSPORTABLE_EXPORT/PLUGTS_BLK

   EXPDP> Processing object typeTRANSPORTABLE_EXPORT/TABLE

   EXPDP> Processing object typeTRANSPORTABLE_EXPORT/INDEX/INDEX

   EXPDP> Processing object typeTRANSPORTABLE_EXPORT/INDEX_STATISTICS

   EXPDP> Processing object typeTRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

   EXPDP> Master table"SYS"."TSPITR_EXP_wmch" successfully loaded/unloaded

   EXPDP>******************************************************************************

   EXPDP> Dump file set forSYS.TSPITR_EXP_wmch is:

   EXPDP>  /lxm/transportdest/dmpfile.dmp

   EXPDP>******************************************************************************

   EXPDP> Datafiles required fortransportable tablespace TEST_USER1:

   EXPDP>  /lxm/transportdest/o1_mf_test_use_dbflvw0f_.dbf

   EXPDP> Datafiles required for transportabletablespace USERS:

   EXPDP>  /lxm/transportdest/o1_mf_users_dbflvvv1_.dbf

   EXPDP> Datafiles required fortransportable tablespace XPADDATA:

   EXPDP>  /lxm/transportdest/o1_mf_xpaddata_dbflvw2j_.dbf

  …

   EXPDP>  /lxm/transportdest/o1_mf_xpaddata_dbflvy06_.dbf

   EXPDP> Job "SYS"."TSPITR_EXP_wmch"successfully completed at 18:13:03

Exportcompleted

 

/*

   The following command may be used to importthe tablespaces.

   Substitute values for and.

   impdp directory= dumpfile= 'dmpfile.dmp' transport_datafiles=/lxm/transportdest/o1_mf_test_use_dbflvw0f_.dbf,/lxm/transportdest/o1_mf_users_dbflvvv1_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvw2j_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvw2s_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvw3p_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvwhy_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvwpy_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvwrv_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvx6o_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvxgk_.dbf, /lxm/transportdest/o1_mf_xpaddata_dbflvxjw_.dbf,/lxm/transportdest/o1_mf_xpaddata_dbflvy06_.dbf

*/

 

---------执行过程查看文件的大小

 

root@ZDMTRAIN2:/#df -g

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

《《《《。。。。。。。。篇幅原因,有省略。。。。。。。。》》》》

/dev/fslv100       0.12     0.12    1%        9    1% /zling

/dev/lxmlv       20.00      5.78   72%      43     1% /lxm

22.188.189.42:/privatebk   8000.00  7954.59    1%     4381    1% /privatebk

22.188.189.42:/publicbk   8000.00   186.82   98% 21670216    34% /publicbk

ZTDNETAP3:/nfs   1240.00    25.15   98%   509154    8% /nfs

22.188.129.202:/nfs   1240.00    25.15   98%   509154    8% /nfs

完成后文件大小:

root@ZDMTRAIN2:/lxm/transportdest#df -g

Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on

《《《《。。。。。。。。篇幅原因,有省略。。。。。。。。》》》》

/dev/Tlv_fta       8.00     7.74    4%     2627    1% /fta

/dev/fslv100       0.12     0.12    1%        9    1% /zling

/dev/lxmlv       20.00     19.29    4%      36     1% /lxm

22.188.189.42:/privatebk   8000.00  7954.59    1%     4381    1% /privatebk

22.188.189.42:/publicbk   8000.00   186.82   98% 21670216    34% /publicbk

/dev/Tlv_zca       4.00     4.00    1%       17    1% /zca

/dev/Tlv_tt       10.00      9.05  10%       18     1% /tt

ZTINIMSERVER:/sharebkup   5500.00  1629.20   71%  2455829    1% /sharebkup

ZTDNETAP3:/nfs   1240.00    25.15   98%   509154    8% /nfs

22.188.129.202:/nfs   1240.00    25.15   98%   509154    8% /nfs

root@ZDMTRAIN2:/lxm/transportdest#

至此,已和源库没有任何关系。

接下来还有第三篇,敬请期待。

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

ITPUB BLOGhttp://blog.itpub.net/26736162

本文地址:http://blog.itpub.net/26736162/viewspace-1987971/

本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b) 

QQ:642808185 若加QQ请注明您所正在读的文章标题

于 2016-01-26 10:00~2016-02-06 19:00 在中行完成

<版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任!>

你可能感兴趣的:(【TTS】基于RMAN迁移AIX平台数据库到Linux(第二篇))