oracle小知识点13--rman convert转换表空间字节顺序

rman convert可实现不同字节顺序endian_format的表空间转换,用于不同字节顺序endian_format的跨平台表空间传输.

os: centos 6.6
db version:11.2.0.4.0

以下测试:
[oracle@ct6605 ~]$ sqlplus / as sysdba
##列出支持转换的平台及字节顺序
    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
    */

##convert tablespace
    #convert tablespace必须在源数据库执行
    #转换只是跨平台不同endian_format传输的一部分,其它tts的步骤这里省略
    [oracle@ct6605 ~]$ sqlplus / as sysdba
    #将要转换的表空间只读
    SQL> alter tablespace test read only;

    #转换为'AIX-Based Systems (64-bit)'平台使用的表空间
    [oracle@ct6605 ct66]$ rman target /
    RMAN> convert tablespace 'TEST'
    to platform 'AIX-Based Systems (64-bit)'
    db_file_name_convert '/u02/oradata/ct66','/home/oracle';

##convert datafile
    #convert datafile必须在目标库执行
    #配合上rman transport在源库生成导入元数据和数据文件,convert datafile在目标库执行,这样可以免去源库表空间read only
    [oracle@ct6605 ct66]$ rman target /
    #转换为'Linux x86 64-bit'平台使用的数据文件
    RMAN> convert datafile
    '/home/oracle/test01.dbf'
    to platform 'Linux x86 64-bit'
    from platform 'AIX-Based Systems (64-bit)'
    db_file_name_convert '/home/oracle','/home/oracle/test';

##convert database
    #convert database是只支持相同字节顺序endian_format

    #convert database可在源库也可在目标库执行

    #源库和目标库的版本要相同
 
    [oracle@ct6605 ~]$ sqlplus / as sysdba
    #启动数据库到read only模式
    SQL> shutdown immediate;
    SQL> statup open read only;
    
    #使用dbms_tdb.check_db检查是否支持转换
    SQL> declare
      b_support boolean;
    begin
      b_support := dbms_tdb.check_db('Linux x86 64-bit', 0);
      dbms_output.put_line(case b_support when true then 'support' else
                           'nonsupport' end);
    end;
    /

    /*
    support
    */
    
    #使用dbms_tdb.check_external检查需要手工处理的部分
    SQL> declare
      b_external boolean;
    begin
      b_external := dbms_tdb.check_external;
    end;
    /

    /*
    The following directories exist in the database:
    SYS.HOME_DUMP, SYS.TSPITR_DIROBJ_DPDIR, SYS.XMLDIR, SYS.ORACLE_OCM_CONFIG_DIR2, SYS.ORACLE_OCM_CONFIG_DIR, SYS.DATA_PUMP_DIR
    */

    [oracle@ct6605 ct66]$ rman target /
    #开始转换数据库
    #下面是在源库转换的数据库,也可以通过convert database on target platform上目标库上转换.
    #在目标库转换,convert database on target platform命令也是在源库执行,用来产生转换脚本.
    # convert database on target platform命令 要加上 convert script 参数生成转换文件脚本.

    RMAN> convert database new database ct66new
    transport script '/home/oracle/initdb.sql'
    to platform 'Linux x86 64-bit'
    db_file_name_convert '/u02/oradata/ct66','/home/oracle';

    /*
    Starting conversion at source at 08-JAN-16
    using channel ORA_DISK_1

    Directory SYS.HOME_DUMP found in the database
    Directory SYS.TSPITR_DIROBJ_DPDIR found in the database
    Directory SYS.XMLDIR found in the database
    Directory SYS.ORACLE_OCM_CONFIG_DIR2 found in the database
    Directory SYS.ORACLE_OCM_CONFIG_DIR found in the database
    Directory SYS.DATA_PUMP_DIR found in the database

    User SYS with SYSDBA and SYSOPER privilege found in password file
    channel ORA_DISK_1: starting datafile conversion
    input datafile file number=00001 name=/u02/oradata/ct66/system01.dbf
    converted datafile=/home/oracle/system01.dbf
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:35
    channel ORA_DISK_1: starting datafile conversion
    input datafile file number=00002 name=/u02/oradata/ct66/sysaux01.dbf
    converted datafile=/home/oracle/sysaux01.dbf
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
    channel ORA_DISK_1: starting datafile conversion
    input datafile file number=00003 name=/u02/oradata/ct66/undotbs01.dbf
    converted datafile=/home/oracle/undotbs01.dbf
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03
    channel ORA_DISK_1: starting datafile conversion
    input datafile file number=00005 name=/u02/oradata/ct66/test01.dbf
    converted datafile=/home/oracle/test01.dbf
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting datafile conversion
    input datafile file number=00004 name=/u02/oradata/ct66/users01.dbf
    converted datafile=/home/oracle/users01.dbf
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    Edit init.ora file /u01/app/oracle/product/11.2.0/db_1/dbs/init_00qqs7jp_1_0.ora. This PFILE will be used to create the database on the target platform
    #利用产生的/home/oracle/initdb.sql脚本在目标库执行,并通过utlirp.sql重新编译对象
    #/home/oracle/initdb.sql要根据实际的情况做相应的修改,或者手动执行里面的内容
    Run SQL script /home/oracle/initdb.sql on the target platform to create database
    To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the target platform
    To change the internal database identifier, use DBNEWID Utility
    Finished conversion at source at 08-JAN-16
    */
    
   

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28539951/viewspace-1974015/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28539951/viewspace-1974015/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值