Skip to content

RMAN CONVERT

    Using RMAN CONVERT, Converting Tablespaces on the Source Platform

    Suppose you must convert tablespaces finance and hr in source database prodlin to the platform format of destination database prodsun. The finance tablespace includes data files /disk2/orahome/fin/fin01.dbf and /disk2/orahome/fin/fin02.dbf. The hr tablespace includes data files /disk2/orahome/fin/hr01.dbf and /disk2/orahome/fin/hr02.dbf.

    The prodlin database runs on Linux host lin01. You query V$DATABASE and discover that platform name is Linux IA (32-bit) and uses a little-endian format. The prodsun database runs on Solaris host sun01. You query V$TRANSPORTABLE_PLATFORM and discover that the PLATFORM_NAME for the Solaris host is Solaris[tm] OE (64-bit), which uses a big-endian format.

    You plan to convert the tablespaces on the source host and store the converted data files in /tmp/transport_to_solaris/ on host lin01. The example assumes that you have set COMPATIBLE is to 10.0 or greater on the source database.

    On source host lin01, you start the RMAN client and run the following commands, where SBU is any user with the SYSBACKUP privilege:

    CONNECT TARGET "[email protected] AS SYSBACKUP"
    
    target database Password: password
    connected to target database: PRODLIN (DBID=39525561)
    
    ALTER TABLESPACE finance READ ONLY;
    ALTER TABLESPACE hr READ ONLY;
    CONVERT TABLESPACE finance, hr
      TO PLATFORM 'Solaris[tm] OE (64-bit)'
      FORMAT '/tmp/transport_to_solaris/%U';
    

    The result is a set of converted data files in the /tmp/transport_to_solaris/ directory, with data in the right endian-order for the Solaris 64-bit platform.

    From this point, you can follow the rest of the general outline for tablespace transport. Use the Data Pump Export utility to create the file of structural information, move the structural information file and the converted data files from /tmp/transport_to_solaris/ to the desired directories on the destination host, and plug the tablespace into the new database with the Data Pump Import utility.

    Using RMAN CONVERT, Converting Data Files on the Destination Platform

    This example assumes that you want to convert the finance and hr tablespaces from database prodsun on host sun01 into a format usable by database prodlin on destination host lin01. You temporarily store the unconverted data files in directory /tmp/transport_from_solaris/ on destination host lin01 and perform the conversion with CONVERT DATAFILE. When you transport the data files into the destination database, they are stored in /disk2/orahome/dbs.

    The example assumes that you have carried out the following steps in preparation for the tablespace transport:

    • You used the Data Pump Export utility to create the structural information file (named, in our example, expdat.dmp).
    • You made the finance and hr tablespaces read-only on the source database.
    • You used an operating system utility to copy expdat.dmp and the unconverted data files to be transported to the destination host lin01 in the /tmp/transport_from_solaris directory. The data files are stored as:
      • /tmp/transport_from_solaris/fin/fin01.dbf
      • /tmp/transport_from_solaris/fin/fin02.dbf
      • /tmp/transport_from_solaris/hr/hr01.dbf
      • /tmp/transport_from_solaris/hr/hr02.dbf
    • You queried the name for the source platform in V$TRANSPORTABLE_PLATFORM and discovered that the PLATFORM_NAME is Solaris[tm] OE (64-bit).

    Note the following considerations when performing the conversion:

    • Identify the data files by file name, not by tablespace name. Until the data files are plugged in, the local instance has no way of knowing the intended tablespace names.
    • The FORMAT argument controls the name and location of the converted data files.
    • When converting on the destination host, you must specify the source platform with the FROM argument. Otherwise, RMAN assumes that the source platform is also the platform of the host performing the conversion.

    You start the RMAN client and connect to the destination database prodlin as TARGETsbu is a user who is granted the SYSBACKUP privilege. The following CONVERT command converts the data files to be transported to the destination host format and deposits the results in /disk2/orahome/dbs:

    CONNECT TARGET "[email protected] AS SYSBACKUP"
    
    target database Password: password
    connected to target database: PRODLIN (DBID=39525561)
    
    CONVERT DATAFILE
       '/tmp/transport_from_solaris/fin/fin01.dbf',
       '/tmp/transport_from_solaris/fin/fin02.dbf',
       '/tmp/transport_from_solaris/hr/hr01.dbf',
       '/tmp/transport_from_solaris/hr/hr02.dbf'
       DB_FILE_NAME_CONVERT
            '/tmp/transport_from_solaris/fin','/disk2/orahome/dbs/fin',
            '/tmp/transport_from_solaris/hr','/disk2/orahome/dbs/hr'
       FROM PLATFORM 'Solaris[tm] OE (64-bit)';

    The result is that the following data files have been converted to the Linux format:

    • /disk2/orahome/dbs/fin/fin01.dbf
    • /disk2/orahome/dbs/fin/fin02.dbf
    • /disk2/orahome/dbs/hr/hr01.dbf
    • /disk2/orahome/dbs/hr/hr02.dbf

    From this point, follow the rest of the general outline for tablespace transport. Use Data Pump Import to plug the converted tablespaces into the new database, and make the tablespaces read/write if applicable.

    Copying Data Files to and from ASM with CONVERT DATAFILE

    This example illustrates copying data files into ASM from normal storage. The generated files are not considered data file copies that belong to the target database, so LIST DATAFILECOPY does not display them.

    Use CONVERT DATAFILE without specifying a source or destination platform. Specify ASM disk group +DATAFILE for the output location, as shown here:

    RMAN> CONVERT DATAFILE '/disk1/oracle/dbs/my_tbs_f1.df', 
       '/disk1/oracle/dbs/t_ax1.f'
       FORMAT '+DATAFILE';
     
    Starting conversion at 29-MAY-13
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting datafile conversion
    input filename=/disk1/oracle/dbs/t_ax1.f
    converted datafile=+DATAFILE/asmv/datafile/sysaux.280.559534477
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:16
    channel ORA_DISK_1: starting datafile conversion
    input filename=/disk1/oracle/dbs/my_tbs_f1.df
    converted datafile=+DATAFILE/asmv/datafile/my_tbs.281.559534493
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:04
    Finished conversion at 29-MAY-13
     

    The following example illustrates copying the data files of a tablespace out of ASM storage to directory /tmp, with uniquely generated file names.

    RMAN> CONVERT TABLESPACE tbs_2 FORMAT '/tmp/tbs_2_%U.df';
     
    Starting conversion at 03-JUN-13
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=20 devtype=DISK
    channel ORA_DISK_1: starting datafile conversion
    input datafile fno=00006 name=+DATAFILE/tbs_21.f
    converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-6_11gm2fq9.df
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting datafile conversion
    input datafile fno=00007 name=+DATAFILE/tbs_22.f
    converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-7_12gm2fqa.df
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting datafile conversion
    input datafile fno=00019 name=+DATAFILE/tbs_25.f
    converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-19_13gm2fqb.df
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting datafile conversion
    input datafile fno=00009 name=+DATAFILE/tbs_23.f
    converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-9_14gm2fqc.df
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    channel ORA_DISK_1: starting datafile conversion
    input datafile fno=00010 name=+DATAFILE/tbs_24.f
    converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-10_15gm2fqd.df
    channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
    Finished conversion at 03-JUN-13

    Transporting a Database to a Different Platform

    The arguments to CONVERT DATABASE vary depending on whether you plan to convert the data files on the source or destination platform. For a description of the conversion process on source and destination platforms and extended examples, refer to Oracle Database Backup and Recovery User’s Guide. Read that discussion in its entirely before attempting a database conversion.

    Assume that you want to transport database prod on a Linux host to a Windows host. You decide to convert the data files on the source host rather than on the destination host. The following example connects RMAN to the PROD database on the Linux host and uses CONVERT DATABASE NEW DATABASE to convert the data files and generate the transport script:

    CONNECT TARGET "[email protected] AS SYSBACKUP"
    
    target database Password: password
    connected to target database: PROD (DBID=39525561)
    
    CONVERT DATABASE
      NEW DATABASE 'prodwin'
      TRANSPORT SCRIPT '/tmp/convertdb/transportscript'
      TO PLATFORM 'Microsoft Windows IA (32-bit)'
        DB_FILE_NAME_CONVERT '/disk1/oracle/dbs','/tmp/convertdb';
    

    In the following variation, you want to transport a database running on a Linux host to a Windows host, but you want to convert the data files on the destination host rather than the source host. sbu is a user who is granted the SYSBACKUP privilege. The following example connects RMAN to the prod database on the Linux host and executes CONVERT DATABASE ON DESTINATION PLATFORM:

    CONNECT TARGET "[email protected] AS SYSBACKUP"
    
    target database Password: password
    connected to target database: PROD (DBID=39525561)
    
    CONVERT DATABASE
      ON DESTINATION PLATFORM
      CONVERT SCRIPT '/tmp/convertdb/convertscript.rman'
      TRANSPORT SCRIPT '/tmp/convertdb/transportscript.sql'
      NEW DATABASE 'prodwin'
      FORMAT '/tmp/convertdb/%U';
    

    The CONVERT DATABASE ON DESTINATION PLATFORM command, which is executed on a Linux database, generates a convert script that can be run on the Windows host to convert the data files to the Windows format. The CONVERT DATABASE command also generates a transport script.

    Transporting a Database to a Different Platform and Storage Type

    In this scenario, you have a database prod on a Solaris host named sun01 that you want to move to an AIX host named aix01. The Solaris data files are stored in a non-ASM file system, but you want to store the data files in ASM on the AIX host.

    The following example connects to sun01 and runs CONVERT DATABASE to generate the necessary scripts:

    CONNECT TARGET "[email protected] AS SYSBACKUP"
    
    target database Password: password
    connected to target database: PROD (DBID=39525561)
    
    CONVERT DATABASE
      ON DESTINATION PLATFORM
      CONVERT SCRIPT '/tmp/convert_newdb.rman'
      TRANSPORT SCRIPT '/tmp/transport_newdb.sql'
      NEW DATABASE 'prodaix'
      DB_FILE_NAME_CONVERT '/u01/oradata/DBUA/datafile','+DATA';
    

    The convert script contains statements of the following form, where your_source_platform stands for your source platform:

    CopyCONVERT DATAFILE '/u01/oradata/DBUA/datafile/o1_mf_system_2lg3905p_.dbf'
      FROM PLATFORM 'your_source_platform'
      FORMAT '+DATA/o1_mf_system_2lg3905p_.dbf';
    

    To reduce downtime for the conversion, you can use NFS rather than copying data files over the network or restoring a backup. For example, you could mount the Solaris files system on the AIX host as /net/solaris/oradata. In this case, you would edit the convert script to reference the NFS-mounted directory as the location of the source data files to convert, putting the commands into the following form:

    CONVERT DATAFILE '/net/solaris/oradata/DBUA/datafile/o1_mf_system_2lg3905p_.dbf'
      FROM PLATFORM 'your_source_platform'
      FORMAT '+DATA/o1_mf_system_2lg3905p_.dbf';
    

    You then connect RMAN to the destination database instance, in this case the instance on host aix01, and convert the data files. During the conversion, the database at host sun01 remains in open read only mode. Afterward, you connect SQL*Plus to the database instance on aix01 and run the transport script to create the database.

    Also See:

    Oracle RMAN