RMAN Cross-Platform Database Migration: Windows to Linux

MiCORE Solutions
3 min readJul 27, 2021

RMAN cross-platform database transport is ability to migrate the entire database from one operating system platform to another, so long as the two endian formats are the same. In this post, we provide a step-by-step guide for using RMAN to perform cross-platform Oracle database migration from Windows to Linux.

When converting the database from one operating system platform to the other, the endian format in both platforms must be same. Make sure of this with the below view:

select * from
v$transportable_platform
order by
2;

Bring database to the mount mode and open it with the read only option.

SQL>
shutdown immediate
SQL>
startup mount
SQL>
alter database
open read only;
Database altered.
SQL>

Use dbms_tdb.check_db function to check whether the database can be transported to a target platform, and the dbms_tdb.check_external function to check for existence of external objects, directories and BFILEs.

SQL>
set
serveroutput on
SQL>
declare
2 v_return boolean;
3 begin
4 v_return:=dbms_tdb.check_db(‘linux ia (32-bit)’);
5 end;
6 /
PL/SQL procedure successfully completed.

If nothing was returned, that means the database is ready to be transported to the destination platform.

Now we will check external tables existence, as these objects will not be created in the transportable database.

SQL>
declare
2 v_return boolean;
3 begin
4 v_return:=dbms_tdb.check_external;
5 end;
6 /
the following directories exist in the database:
sys.data_pump_dir, sys.admin_dir, sys.work_dir, sys.ora_dump

PL/SQL procedure successfully completed.

Run the convert database command to convert the whole database to the Linux platform. RMAN convert does not do any changes, it will just create a .sql file to convert the database to the destination platform.

RMAN> convert database new database ‘linuxdb’
2> transport script ‘c:\test\transport.sql’
3> db_file_name_convert ‘C:\oracle\product\10.2.0\oradata\windb’
‘c:\test’
4> to platform ‘Linux IA (32-bit)’;
Starting convert at 07-APR-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
<…..output trimmed …..>
<…..output trimmed …..>
channel ORA_DISK_1: datafile conversion complete, elapsed time:
00:00:01
Run SQL script C:\test\transport.sql on the target platform to create
database
Edit init.ora file
C:\ORACLE\product\10.2.0\db_1\database\init_00lahuto_1_0.ora.
This PFILE will be used to create the database on the target platform
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the
target plat
form
To change the internal database identifier, use dbnewid Utility
Finished backup at 07-APR-10
RMAN>

While performing the convert database command, RMAN does not convert and transfer redo log files, controlfiles, password files and temporary tablespaces to the destination platform.

RMAN converted all datafiles to the destination platform type. Now copy the parameter file transport.sql script, which is located at the $ORACLE_HOME/dbs directory, that is used to create the database and all datafiles to the destination host.

Perform the following prerequisite actions on the destination host before running the transport.sql.

Create dump directories:

[oracle@localhost ~]$ cd $ORACLE_HOME/admin
[oracle@localhost ~]$ mkdir linuxdb
[oracle@localhost ~]$ cd linuxdb/
[oracle@localhost linuxdb]$ mkdir adump bdump cdump udump
[oracle@localhost ~]$ cd $ORACLE_HOME/oradata
[oracle@localhost ~]$ mkdir linuxdb

Move all datafiles to the necessary folder. Edit parameter file and convert paths from Windows syntax to the Linux syntax:

control_files = “/u01/oracle/product/10.2.0/db_1/oradata/linuxdb/control01.ctl”
db_recovery_file_dest =
“/u01/oracle/product/10.2.0/db_1/flash_recovery_area”
db_recovery_file_dest_size= 2147483648
audit_file_dest =
“/u01/oracle/product/10.2.0/db_1/admin/linuxdb/adump”
background_dump_dest =
“/u01/oracle/product/10.2.0/db_1/admin/linuxdb/bdump”
user_dump_dest =
“/u01/oracle/product/10.2.0/db_1/admin/linuxdb/udump”
core_dump_dest =
“/u01/oracle/product/10.2.0/db_1/admin/linuxdb/cdump”
db_name = “LINUXDB”

Edit transport.sql script and correct paths of datafiles, controlfiles and trace directories.

Now check all changes made above once more, export the ORACLE_SID environment variable and run the transport.sql command from SQL*Plus:

SQL>@
transport.sql

By running this sql file, Oracle performs the following steps:

  • Creates spfile from the provided pfile (that was generated by RMAN)
  • Creates controlfiles and opens the database with resetlogs option
  • Creates temporary tablespace
  • Brings the database down, starts it using the upgrade mode and run utlirp.sql.This script recompiles all PL/SQL objects in the format required by the target database platform.
  • Runs the utlrp.sql file which recompiles all PL/SQL objects with invalid status.

After all the above steps are complete, the Oracle database can be used successfully via Linux platform.

--

--

MiCORE Solutions

MiCoreSolutions helps you design, develop, implement, and monitor databases for your business & help you to make the most of your ROI.