Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

For the complex, heterogeneous environments it may be necessary to convert Oracle files to the target OS format. To minimize the outage of the source database we will create a duplicate database on the same host as the source database first and then this duplicate database will be used for the creation of the target database. 

...

  1. Prepare the DBVTDUPL instance
    1. Create necessary directories (adump, bdump, cdump, udump etc.)
    2. Create a password file using the orapwd utility.
    3. Create the DBVTDUPL database init file from the DBVT database's init file and change the parameters appropriately (paths, db_name, etc.).
    4. Create a Windows service with oradim utility.
    5. Start the DBVTDUPL instance and create spfile from the pfile and exit the SQL*Plus.

      Panel
      bgColorccc
      e:\app\oracle\product\10.2.0>set ORACLE_SID=dbvtdupl
      e:\app\oracle\product\10.2.0>sqlplus /nolog
      SQL*Plus: Release 10.2.0.3.0 - Production on Thu Jun 13 08:45:22 2013
      Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
      SQL> conn / as sysdba
      Connected to an idle instance.

      SQL> startup nomount
      ORACLE instance started.
      Total System Global Area 817889280 bytes
      Fixed Size 1293216 bytes
      Variable Size 239076448 bytes
      Database Buffers 570425344 bytes
      Redo Buffers 7094272 bytes

      SQL> create spfile from pfile;
      File created.
      SQL> exit
      Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
      With the Partitioning, OLAP and Data Mining options
      e:\app\oracle\product\10.2.0>
  2. Duplicate the database.

    Panel
    bgColorccc
    e:\app\oracle\product\10.2.0>set ORACLE_SID=dbvtdupl
    e:\app\oracle\product\10.2.0>rman target=sys/oracle@dbvt auxiliary /
    Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jun 13 08:46:07 2013
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    connected to target database: DBVT (DBID=1173696140)
    connected to auxiliary database: DBVTDUPL (not mounted)
    RMAN> duplicate target database to dbvtdupl until scn 811782
    2> DB_FILE_NAME_CONVERT=(dbvt,dbvtdupl)
    3> logfile
    4> 'e:\app\oracle\product\10.2.0\oradata\dbvtdupl\REDO01.log' size 50M,
    5> 'e:\app\oracle\product\10.2.0\oradata\dbvtdupl\REDO02.log' size 50M,
    6> 'e:\app\oracle\product\10.2.0\oradata\dbvtdupl\REDO03.log' size 50M;

    Starting Duplicate Db at 13-JUN-13
    using target database control file instead of recovery catalog
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: sid=157 devtype=DISK
    ...
    contents of Memory Script:
    {
    Alter clone database open resetlogs;
    }
    executing Memory Script
    database opened
    Finished Duplicate Db at 13-JUN-13
    Recovery Manager complete.
    e:\app\oracle\product\10.2.0>
  3. Pick a self-contained set of tablespaces

    Panel
    bgColorccc
    e:\app\oracle\product\10.2.0>set ORACLE_SID=dbvtdupl
    e:\app\oracle\product\10.2.0>sqlplus /nolog
    SQL*Plus: Release 10.2.0.3.0 - Production on Thu Jun 13 10:12:12 2013
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
     
    SQL> conn / as sysdba
    Connected.

    SQL> begin
    2 DBMS_TTS.TRANSPORT_SET_CHECK('USERS', TRUE);
    3 end;
    4 /
    PL/SQL procedure successfully completed.
     
    SQL> SELECT * FROM TRANSPORT_SET_VIOLATIONS;
    no rows selected
    SQL>

    The TRANSPORT_SET_VIOLATIONS view is empty, so the picked set of tablespaces is self-contained.
     

  4. Generate a transportable tablespace set:
    1. Make all tablespaces in the set read-only.

      Panel
      bgColorccc
      SQL> alter tablespace users read only;
      Tablespace altered.
      SQL>
    2. Export the metadata using Data Pump utility.

      Panel
      bgColorccc
      e:\app\oracle\product\10.2.0> EXPDP system/oracle DUMPFILE=ttsexp.dmp DIRECTORY=dpump_dir TRANSPORT_TABLESPACES = users
    3. Convert all the datafiles composing the tablespaces to be transported.

      Panel
      bgColorccc
      e:\app\oracle\product\10.2.0>rman target /
      Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jun 13 10:49:24 2013
      Copyright (c) 1982, 2005, Oracle. All rights reserved.
      connected to target database: DBVTDUPL (DBID=3681752573)
       
      RMAN> convert tablespace users
      2> to platform 'Linux IA (64-bit)'
      3> format 'e:\tmp\%U';
       
      Starting backup at 13-JUN-13
      using target database control file instead of recovery catalog
      allocated channel: ORA_DISK_1
      channel ORA_DISK_1: sid=142 devtype=DISK
      channel ORA_DISK_1: starting datafile conversion
      input datafile fno=00004 name=E:\APP\ORACLE\PRODUCT\10.2.0\ORADATA\DBVTDUPL\USERS01.DBF
      converted datafile=E:\TMP\DATA_D-DBVTDUPL_I-3681752573_TS-USERS_FNO-4_01OC30GF
      channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
      Finished backup at 13-JUN-13
       
      RMAN>
  5. Move both the converted datafiles and metadata export file to the target server
  6. Create the target database if not already exists and create all the schemas to be imported from the source database.
  7. Import the tablespace set

    Panel
    bgColorccc
    [oracle@ora11-1 dpdump]$ impdp system/oracle@orcl dumpfile=TTSEXP.DMP directory=DATA_PUMP_DIR
    transport_datafiles=/u01/app/oracle/admin/orcl/dpdump/USERS01.DBF
  8. Set the imported tablespaces back to READ/WRITE mode:

    Panel
    bgColorccc

    SQL> alter tablespace users read write;

...