RMAN Convert database from Linux to Windows

Check Endian format for the source and target OS versions:

SQL> select * from v$db_transportable_platform;

PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
———– ————————————————–
7 Microsoft Windows IA (32-bit) Little
10 Linux IA (32-bit) Little
5 HP Tru64 UNIX Little
11 Linux IA (64-bit) Little
15 HP Open VMS Little
8 Microsoft Windows IA (64-bit) Little
13 Linux x86 64-bit Little
12 Microsoft Windows x86 64-bit Little
17 Solaris Operating System (x86) Little
19 HP IA Open VMS Little
20 Solaris Operating System (x86-64) Little
21 Apple Mac OS (x86-64) Little

12 rows selected.

SQL> select platform_name from v$database;

PLATFORM_NAME
————————————————————-
Linux x86 64-bit

Preparing to Convert database:

SQL> set serveroutput on
SQL> declare
2 db_ready boolean;
begin
3 4 /* db_ready is ignored, but with SERVEROUTPUT set to ON any
5 * conditions preventing transport will be output to console */
6 db_ready := dbms_tdb.check_db(‘Microsoft Windows IA (32-bit)’,
7 dbms_tdb.skip_none);
8 end;
9 /
Database is not open in READ-ONLY mode. Open the database in READ-ONLY mode and
retry.

PL/SQL procedure successfully completed.
SQL> ALTER DATABASE OPEN READ ONLY;

Database altered.

SQL> set serveroutput on
SQL> declare
db_ready boolean;
2 3 begin
/* db_ready is ignored, but with SERVEROUTPUT set to ON any
4 5 * conditions preventing transport will be output to console */
6 db_ready := dbms_tdb.check_db(‘Microsoft Windows IA (32-bit)’,
7 dbms_tdb.skip_none);
8 end;
9 /

PL/SQL procedure successfully completed.
Using DBMS_TDB .CHECK_EXTERNAL to Identify External Objects:
SQL> declare
external boolean;
begin
/* value of external is ignored, but with SERVEROUTPUT set to ON
* dbms_tdb.check_external displays report of external objects
* on console */
external := dbms_tdb.check_external;
end; 2 3 4 5 6 7 8
9 /
The following directories exist in the database:
SYS.ORACLE_OCM_CONFIG_DIR, SYS.DATA_PUMP_DIR, SYS.EXPDP

PL/SQL procedure successfully completed.

RMAN convert from Source platform:

RMAN> CONVERT DATABASE NEW DATABASE ‘PDMTMP2’
2> transport script ‘/ofaroot/MISC/transportscript’
3> to platform ‘Microsoft Windows IA (32-bit)’
db_file_name_convert ‘/oradata/’ ‘/ofaroot/MISC/’
;4> 5>

Starting conversion at source at 23-DEC-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=193 device type=DISK

Directory SYS.ORACLE_OCM_CONFIG_DIR found in the database
Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.EXPDP found in the database
channel ORA_DISK_1: starting datafile conversion
input datafile file number=00004 name=/oradata/users01.dbf
converted datafile=/ofaroot/MISC/users01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:03:15
channel ORA_DISK_1: starting datafile conversion
input datafile file number=00001 name=/oradata/system.dbf
converted datafile=/ofaroot/MISC/system.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting datafile conversion
input datafile file number=00002 name=/oradata/sysaux.dbf
converted datafile=/ofaroot/MISC/sysaux.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=/oradata/undotbs1.dbf
converted datafile=/ofaroot/MISC/undotbs1.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03
Edit init.ora file /apps/oracle/product/11.2.0.3/dbs/init_00qpgua4_1_0.ora. This PFILE will be used to create the database on the target platform
Run SQL script /ofaroot/MISC/transportscript 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 23-DEC-15
Transport script output:

[oracle@VM1]$ cat transportscript
— The following commands will create a new control file and use it
— to open the database.
— Data used by Recovery Manager will be lost.
— The contents of online logs will be lost and all backups will
— be invalidated. Use this only if online logs are damaged.

— After mounting the created controlfile, the following SQL
— statement will place the database in the appropriate
— protection mode:
— ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT PFILE=’/apps/oracle/product/11.2.0.3/dbs/init_00qpgua4_1_0.ora’
CREATE CONTROLFILE REUSE SET DATABASE “PDMTMP2” RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/apps/oracle/product/11.2.0.3/dbs/arch_D-PDMTMP2_id-2935319874_S-778_T-1_A-847714242_03qpgua4’ SIZE 100M BLOCKSIZE 512,
GROUP 2 ‘/apps/oracle/product/11.2.0.3/dbs/arch_D-PDMTMP2_id-2935319874_S-779_T-1_A-847714242_04qpgua4’ SIZE 100M BLOCKSIZE 512,
GROUP 3 ‘/apps/oracle/product/11.2.0.3/dbs/arch_D-PDMTMP2_id-2935319874_S-777_T-1_A-847714242_05qpgua4’ SIZE 100M BLOCKSIZE 512
DATAFILE
‘/ofaroot/MISC/system.dbf’,
‘/ofaroot/MISC/sysaux.dbf’,
‘/ofaroot/MISC/undotbs1.dbf’,
‘/ofaroot/MISC/users01.dbf’
CHARACTER SET AL32UTF8
;

— Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

— Commands to add tempfiles to temporary tablespaces.
— Online tempfiles have complete space information.
— Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE ‘/apps/oracle/product/11.2.0.3/dbs/data_D-PDMTMP2_I-2935319874_TS-TEMP_FNO-1_06qpgua4′
SIZE 524288000 AUTOEXTEND OFF;
— End of tempfile additions.

set echo off
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prompt * Your database has been created successfully!
prompt * There are many things to think about for the new database. Here
prompt * is a checklist to help you stay on track:
prompt * 1. You may want to redefine the location of the directory objects.
prompt * 2. You may want to change the internal database identifier (DBID)
prompt * or the global database name for this database. Use the
prompt * NEWDBID Utility (nid).
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SHUTDOWN IMMEDIATE
STARTUP UPGRADE PFILE=’/apps/oracle/product/11.2.0.3/dbs/init_00qpgua4_1_0.ora’
@@ ?/rdbms/admin/utlirp.sql
SHUTDOWN IMMEDIATE
STARTUP PFILE=’/apps/oracle/product/11.2.0.3/dbs/init_00qpgua4_1_0.ora’
— The following step will recompile all PL/SQL modules.
— It may take serveral hours to complete.
@@ ?/rdbms/admin/utlrp.sql
set feedback 6;
RMAN convert on TARGET Platform:

RMAN> CONVERT DATABASE ON TARGET PLATFORM
CONVERT SCRIPT ‘/ofaroot/MISC/convertscript.rman’
2> 3> TRANSPORT SCRIPT ‘/ofaroot/MISC/transportscripttarget.sql’
4> new database ‘PDMTMP1’
5> FORMAT ‘/ofaroot/MISC/%U’;

Starting conversion at source at 23-DEC-15
using channel ORA_DISK_1

Directory SYS.ORACLE_OCM_CONFIG_DIR found in the database
Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.EXPDP found in the database
channel ORA_DISK_1: starting to check datafiles
input datafile file number=00004 name=/oradata/users01.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile file number=00001 name=/oradata/system.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile file number=00002 name=/oradata/sysaux.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile file number=00003 name=/oradata/undotbs1.dbf
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
Edit init.ora file /ofaroot/MISC/init_00qpgv1f_1_0.ora. This PFILE will be used to create the database on the target platform
Run RMAN script /ofaroot/MISC/convertscript.rman on target platform to convert datafiles
Run SQL script /ofaroot/MISC/transportscripttarget.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 23-DEC-15
[oracle@VM1]$ cat convertscript.rman
STARTUP NOMOUNT PFILE = ‘/ofaroot/MISC/init_00qpgv1f_1_0.ora’;
RUN {
CONVERT
FROM PLATFORM ‘Linux x86 64-bit’
PARALLELISM 1
DATAFILE ‘/oradata/users01.dbf’ FORMAT ‘/ofaroot/MISC/data_D-PDMTMP_I-2935319874_TS-USERS_FNO-4_05qpgv1f’
DATAFILE ‘/oradata/system.dbf’ FORMAT ‘/ofaroot/MISC/data_D-PDMTMP_I-2935319874_TS-SYSTEM_FNO-1_06qpgv1f’
DATAFILE ‘/oradata/sysaux.dbf’ FORMAT ‘/ofaroot/MISC/data_D-PDMTMP_I-2935319874_TS-SYSAUX_FNO-2_07qpgv1f’
DATAFILE ‘/oradata/undotbs1.dbf’ FORMAT ‘/ofaroot/MISC/data_D-PDMTMP_I-2935319874_TS-UNDOTBS1_FNO-3_08qpgv1f’
; }

Ref: https://docs.oracle.com/cd/B19306_01/backup.102/b14191/dbxptrn.htm#CHDEICED

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s