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.
The following is the example of creating the target database Oracle 11.1 on Linux from the source database Oracle 10.2 on Windows. The source database SID is DBVT, duplicate database SID is DBVTDUPL and the target database SID is ORCL.
- Prepare the DBVTDUPL instance
- Create necessary directories (adump, bdump, cdump, udump etc.)
- Create a password file using the orapwd utility.
- Create the DBVTDUPL database init file from the DBVT database's init file and change the parameters appropriately (paths, db_name, etc.).
- Create a Windows service with oradim utility.
Start the DBVTDUPL instance and create spfile from the pfile and exit the SQL*Plus.
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 bytesSQL> 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 optionse:\app\oracle\product\10.2.0>
Duplicate the database.
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 Scriptdatabase opened
Finished Duplicate Db at 13-JUN-13Recovery Manager complete.
e:\app\oracle\product\10.2.0>
Pick a self-contained set of tablespaces
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.
- Generate a transportable tablespace set:
Make all tablespaces in the set read-only.
SQL> alter tablespace users read only;
Tablespace altered.
SQL>
Export the metadata using Data Pump utility.
e:\app\oracle\product\10.2.0> EXPDP system/oracle DUMPFILE=ttsexp.dmp DIRECTORY=dpump_dir TRANSPORT_TABLESPACES = users
Convert all the datafiles composing the tablespaces to be transported.
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-13RMAN>
- Move both the converted datafiles and metadata export file to the target server
- Create the target database if not already exists and create all the schemas to be imported from the source database.
Import the tablespace set
[oracle@ora11-1 dpdump]$ impdp system/oracle@orcl dumpfile=TTSEXP.DMP directory=DATA_PUMP_DIR
transport_datafiles=/u01/app/oracle/admin/orcl/dpdump/USERS01.DBFSet the imported tablespaces back to READ/WRITE mode:
SQL> alter tablespace users read write;
Return back to the page Using the Database Backups and finish the Dbvisit Replicate setup process.