0% found this document useful (0 votes)
186 views

Database Migration From Windows To Linux Using RMAN: List of Steps Needed To Complete The Migration

The document describes migrating an Oracle database from Windows to Linux using RMAN Convert Database. It outlines checking the endian format compatibility between source and target platforms, starting the database in read-only mode, and using RMAN to generate output files for the target database. The converted datafiles and scripts are then copied to Linux, and the scripts are edited to change Windows paths to Linux paths before being executed on the Linux system.

Uploaded by

Drishti Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
186 views

Database Migration From Windows To Linux Using RMAN: List of Steps Needed To Complete The Migration

The document describes migrating an Oracle database from Windows to Linux using RMAN Convert Database. It outlines checking the endian format compatibility between source and target platforms, starting the database in read-only mode, and using RMAN to generate output files for the target database. The converted datafiles and scripts are then copied to Linux, and the scripts are edited to change Windows paths to Linux paths before being executed on the Linux system.

Uploaded by

Drishti Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Both Windows and Linux platforms have the same endian format, which makes

possible to transfer the whole database, making the migration process very
straightforward and simple.

To migrate between platforms that have a different endian format, Cross Platform
Transportable Tablespaces (XTTS) needs to be used instead.

List of Steps Needed to Complete the Migration


The migration process is simple, but as it has several steps it is convenient to be
familiar with them before running it.

1. Check platform compatibility between source and target OS

2. Start the database in read only mode

3. Check database readiness for transport from Windows to Linux using


DBMS_TDB.CHECK_DB

4. Check if there are any external objects

5. Execute the Rman Convert database command

6. Copy converted datafiles, generated Transport Script and Parameter File to Linux

7. Edit the init.ora for the new database

8. Edit the Transport Script and Parameter File changing the windows paths to Linux
Paths

9. Execute the Transport Script

10.Change the Database ID

11.Check database integrity

Database Migration from Windows to Linux Using RMAN


Database: Oracle 10.2.0.4
Platform: Windows to Linux
Overview: To Migrate database first step is check the endian format. Endian format indicates the
order, in which, sequence of bytes are stored in computer memory. There are 2 endian format named
"Little Endian" and "Big Endian". Linux, Windows use "Little Endian" byte order whereas Solaris,
HPUX, Apple Mac use "Big Endian" byte order. If it is same endian format migration is some how easy
or straight forward.
SQL> Select * from v$transportable_platform order by platform_id;
Check the Version of database:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
Check other database details:
SQL> Select name from v$datafile;
NAME
---------------------------------------
D:\ORACLE\ORADATA\MUJAZORC\SYSTEM01.DBF
D:\ORACLE\ORADATA\MUJAZORC\UNDOTBS01.DBF
D:\ORACLE\ORADATA\MUJAZORC\DRSYS01.DBF
D:\ORACLE\ORADATA\MUJAZORC\INDX01.DBF
D:\ORACLE\ORADATA\MUJAZORC\TOOLS01.DBF
D:\ORACLE\ORADATA\MUJAZORC\USERS01.DBF
D:\ORACLE\ORADATA\MUJAZORC\XDB01.DBF
D:\ORACLE\ORADATA\MUJAZORC\MUJ_HRMS01.DBF
D:\ORACLE\ORADATA\MUJAZORC\MUJ_FIN01.DBF
D:\ORACLE\ORADATA\MUAJZREG_IT\MUJ_REG_DBF01.DBF
D:\ORACLE\ORADATA\KAFAFIN\KAFA_FIN01.DBF
SQL> select name from v$controlfile;
NAME
------------------------------
D:\ORACLE\ORADATA\MUJAZORC\CONTROL01.CTL
D:\ORACLE\ORADATA\MUJAZORC\CONTROL02.CTL
D:\ORACLE\ORADATA\MUJAZORC\CONTROL03.CTL
SQL> select member from v$logfile;
MEMBER
------------------------------
D:\ORACLE\ORADATA\MUJAZORC\REDO01.LOG
D:\ORACLE\ORADATA\MUJAZORC\REDO02.LOG
D:\ORACLE\ORADATA\MUJAZORC\REDO03.LOG
Create some object for further verification
Create table date1 (today_date date);
Insert into date1 (select sysdate from dual);
Steps:
1. Check platform compatibility between Source and target OS
2. Start the database in read only mode
3. Check database readiness for transport from Windows to Linux using DBMS_TDB.CHECK_DB
4. Check if there are any external objects
5. Execute the RMAN Convert database command
6. Copy Converted datafiles, Generated Script and Pfile to Linux
7. Edit the Pfile for the new database (Linux)
8. Edit the Transport Script and Pfile changing the windows paths to Linux Paths.
9. Execute the Transport Script on Linux
10. Change the DBID
11. Run utlirp.sql and utlrp.sql for recompile all Pl/SQL modules.
12. Verify & Compare the database on Linux

1. Check platform Compatibility between source and target OS:


First we need to check the platforms to be sure they have the same endian format, also we need to
save the PLATFORM_NAME string to use it later as part of the convert database syntax in RMAN.
SQL> select * from v$transportable_platform where PLATFORM_NAME='Microsoft
Windows IA (64-bit)' or PLATFORM_NAME like 'Linux%' order by platform_id;
PLATFORM_ID PLATFORM_NAME ENDIAN_FOR
----------- ------------------ ----------
8 Microsoft Windows IA (64-bit) Little
10 Linux IA (32-bit) Little
11 Linux IA (64-bit) Little
13 Linux x86 64-bit Little
2. Start the database in read only mode:
shutdown immediate;
startup mount;
Alter database open read only;
3. Check database readiness for transport from Windows to Linux:
Before converting the database, we have to be make sure that whether a database can be
transported to a desired destination platform, and whether the current state of the database permits
transport. We check this using "DBMS_TDB.CHECK_DB" procedure.
If this procedure returns "FALSE" then the output includes the reason why the database cannot be
transported like target platform has a different endian format, database is not open read-only, there
are active transactions in the database, database compatibility version is below 10 etc.
SQL> set serveroutput on
SQL> declare
db_ready boolean;
begin
db_ready := dbms_tdb.check_db('Linux IA (64-bit)');
end;
/
PL/SQL procedure successfully completed.
Note: If database is not open in read-only mode, then the above procedure may return error like
Database is not open READ ONLY. Please open database READ ONLY and retry.
4. Check if there are any external objects:
If there is any external objects take note of them, they will need to be taken care manually because
RMAN cannot automate the transport of such objects. "DBMS_TDB.CHECK_EXTERNAL" must be
used to identify any external tables, directories or BFILEs.
SQL> set serveroutput on
SQL> declare
external boolean;
begin
external := dbms_tdb.check_external;
end;
/
5. Using the RMAN CONVERT DATABASE:
After all the pre-requisites have been performed successfully, we can use the RMAN CONVERT
DATABASE command to generate the output files for the target database. While executing the
CONVERT DATABASE command, we need to specify the new database name, the destination
platform, path to save the transport script and optionally a path, where to save the output files.
Note: If you omit the "DB_FILE_NAME_CONVERT" clause, the output files are created in
"C:\ORACLE_HOME\database" folder.
C:\>rman target /
RMAN> CONVERT DATABASE NEW DATABASE ' MUJAZORC'
transport script 'D:\ORACLE\SCRIPT\Mujscript.sql'
to platform 'Linux IA (64-bit)'
db_file_name_convert 'D:\ORACLE\ORADATA\MUJAZORC\' '
D:\ORACLE\SCRIPT\';
Starting convert at 13-SEP-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=161 devtype=DISK
.
.
User SYS with SYSDBA and SYSOPER privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name= D:\ORACLE\ORADATA\MUJAZORC\SYSTEM01.DBF
converted datafile=D:\ORACLE\SCRIPT\SYSTEM01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:41
input datafile fno=00002 name= D:\ORACLE\ORADATA\MUJAZORC\UNDOTBS01.DBF
converted datafile=D:\ORACLE\SCRIPT\UNDOTBS01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:28
.
.
At the end of the convert process RMAN does display information about how to complete the
conversion on the target platform. You can use the init.ora file generated by the "CONVERT
DATABASE" command or you can create your own pfile using the SQL statement "create pfile
from spfile".
6. Copy Converted Datafiles, Generated Script and Pfile to the Linux Machine:
Now copy these converted datafiles, transport script and Pfile on the Linux server. Do not forget to
create necessary folder on linux machine such as adump, bdump, udump, cdump,
flash_recovery_area.
7. Edit init.ora or pfile for new database:
Open the init.ora file generated by RMAN. The first section of pfile must be updated, others are
optional. Change all the absolute path of windows environment to absolute path of Linux environment.
8. Edit The Script:
Before running the transport script on the target Linux server we need to edit it to set the correct paths
for pfile, datafiles, logfiles and tempfiles. Update all the paths as per your Linux environment.
9. Execute the Script:
SET ORACLE_SID= mujazlnx
sqlplus / as sysdba
SQL>@d:\oracle\mujscript.sql
On the completion of the script, the database would be open and ready for use.
10. Change DBID:
DBNEWID is a database utility that can change the internal database identifier (DBID). Changing the
DBID is necessary when you want to use an RMAN catalog to backup a cloned instance. RMAN
identifies instances using the DBID, preventing the original and cloned instance being managed by
the same catalog. For more information: How to change DBID & DBNAME
11. Run utlirp.sql and utlrp.sql on the target platform to recompile all PL/SQL modules.
12. Verify & Compare database details with before details:
SQL> Select * from date1;
SQL> select tablespace_name from dba_tablespaces;
SQL> select file_name from dba_data_files;
SQL> SELECT COMP_NAME,STATUS FROM DBA_REGISTRY;

This article describes the procedure to migrate a database


from Windows to Linux using the "RMAN Convert Database"
command.

In my environment , both Windows and Linux platforms have the


same endian format, which makes possible to transfer the whole
database, making the migration process very straightforward
and simple.

To migrate between platforms that have a different endian


format, Cross Platform Transportable Tablespaces needs to be
used instead, which would not be discussed in this article.

Endian Format is a term that describe the order, in which,


sequence of bytes are stored in computer memory. There are 2
endian format named "Little Endian" and "Big Endian". Linux,
Windows use "Little Endian" byte order whereas Solaris, HPUX,
Apple Mac use "Big Endian" byte order.

In Oracle 10g and onwards , following SQL should tell you


which operating systems follow which byte order:

select * from v$transportable_platform order by platform_id;

The Windows Database:

SQL> select * from v$version;

BANNER
--------------------------------------------------------------
--
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 -
64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SQL> select name from v$datafile;

NAME
----------------------------------------------------
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DB F
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DB F

SQL> select name from v$controlfile;

NAME
----------------------------------------------------
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CT L
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CT L
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CT L

SQL> select member from v$logfile;

MEMBER
------------------------------------------------
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG
List of Steps Needed to Complete the Migration:

The migration process is simple, but as it has several steps


it is convenient to be familiar with them before running it:

1. Check platform compatibility between source and target OS


2. Start the database in read only mode
3. Check database readiness for transport from Windows to
Linux using DBMS_TDB.CHECK_DB
4. Check if there are any external objects
5. Execute the RMAN Convert database command
6. Copy converted datafiles, generated Transport Script and
Parameter File to Linux
7. Edit the init.ora for the new database
8. Edit the Transport Script and Parameter File changing the
windows paths to Linux Paths
9. Execute the Transport Script
10. Change the Database ID
11. Check database integrity

1. Check platform compatibility between source and target OS:

First we need to check the platforms to be sure they have the


same endian format, also we need to save the
PLATFORM_NAME string to use it later as part of the convert
database syntax in RMAN.

SQL> select * from v$transportable_platform where


PLATFORM_NAME='Microsoft Windows IA (64-bit)' or PLATFORM_NAME
like 'Linux%' order by platform_id;

PLATFORM_ID PLATFORM_NAME ENDIAN_FOR


----------- ----------------------------------------
----------
8 Microsoft Windows IA (64-bit) Little
10 Linux IA (32-bit) Little
11 Linux IA (64-bit) Little
13 Linux x86 64-bit Little

2. Start the database in read only mode:

SQL> shutdown immediate;


SQL> startup mount;
SQL> alter database open read only;

3. Check database readiness for transport from Windows to


Linux:

Before converting the database, we have to be make sure that


whether a database can be transported to a desired destination
platform, and whether the current state of the database
permits transport. We check this using "DBMS_TDB.CHECK_DB"
procedure.

If this procedure returns "FALSE" then the output includes the


reason why the database cannot be transported like target
platform has a different endian format, database is not open
read-only, there are active transactions in the database,
database compatibility version is below 10 etc.

SQL> set serveroutput on


SQL> declare
2 db_ready boolean;
3 begin
4 db_ready := dbms_tdb.check_db('Linux IA (64-bit)');
5 end;
6 /
PL/SQL procedure successfully completed.

If database is not open in read-only mode, then the above


procedure may return error like "Database is not open READ
ONLY. Please open database READ ONLY and retry."

4. Check if there are any external objects:

If there is any external objects take note of them, they will


need to be taken care manually because RMAN cannot automate
the transport of such objects. "DBMS_TDB.CHECK_EXTERNAL" must
be used to identify any external tables, directories or
BFILEs.

SQL> set serveroutput on


SQL> declare
2 external boolean;
3 begin
4 external := dbms_tdb.check_external;
5 end;
6 /
The following external tables exist in the database:
SH.SALES_TRANSACTIONS_EXT
The following directories exist in the database:
SYS.DATA_PUMP_DIR, SYS.ORACLE_OCM_CONFIG_DIR, SYS.ADMIN_DIR,
SYS.WORK_DIR,
SYS.DATA_FILE_DIR, SYS.LOG_FILE_DIR, SYS.MEDIA_DIR,
SYS.XMLDIR, SYS.SUBDIR
The following BFILEs exist in the database:
PM.PRINT_MEDIA

PL/SQL procedure successfully completed.

5. Using the RMAN CONVERT DATABASE Command:

After all the pre-requisites have been performed successfully,


we can use the RMAN CONVERT DATABASE command to generate the
output files for the target database.

While executing the CONVERT DATABASE command, we need to


specify the new database name, the destination platform, path
to save the transport script and optionally a path, where to
save the output files using "DB_FILE_NAME_CONVERT". If you
omit the "DB_FILE_NAME_CONVERT" clause, the output files are
created in "$ORACLE_HOME\database" folder.

If you are using Oracle Managed Files(OMF), then RMAN itself


generate and display the new file names on the output of the
convert database command.

C:\Users\dell>rman target /

RMAN> CONVERT DATABASE NEW DATABASE 'orcllnx'


2> transport script 'C:\oracle\trans\script.sql'
3> to platform 'Linux IA (64-bit)'
4> db_file_name_convert
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\' 'C:\ORACLE\TRANS\';

Starting convert at 09-JAN-12


using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
.
.
.
User SYS with SYSDBA and SYSOPER privilege found in password
file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001
name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM0 1.DBF
converted datafile=C:\ORACLE\TRANS\SYSTEM01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed
time: 00:00:25
.
.
.
Run SQL script C:\ORACLE\TRANS\SCRIPT.SQL on the target
platform to create database
Edit init.ora file
C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00N0BG 62_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 platform
To change the internal database identifier, use DBNEWID
Utility
Finished backup at 09-JAN-12

Note that at the end of the convert process RMAN does display
information about how to complete the conversion on the target
platform.

You can use the init.ora file generated by the "CONVERT


DATABASE" command or you can create your own pfile using the
SQL statement "create pfile from spfile". I am going with the
init.ora, generated by RMAN.

6. Copy Converted Datafiles, Generated Transport Script and


Parameter File to the Linux:

Now copy these converted datafiles, transport script and


parameter file on the Linux server using FTP or any other
utility you use.

Also create the necessary folders on Linux server for new


database.

[oracle]$ mkdir -p /u01/app/oracle/admin/orcllnx/adump


[oracle]$ mkdir -p /u01/app/oracle/admin/orcllnx/bdump
[oracle]$ mkdir -p /u01/app/oracle/admin/orcllnx/cdump
[oracle]$ mkdir -p /u01/app/oracle/admin/orcllnx/udump
[oracle]$ mkdir -p /u01/app/oracle/oradata/orcllnx
[oracle]$ mkdir -p /u01/app/oracle/flash_recovery_area

7. Edit init.ora for new database:

Open the init.ora file generated by RMAN using a editor you


preferred. You will notice that the init.ora file is divided
into 3 sections as denoted by the following comment:

# Please change the values of the following parameters:


# Please review the values of the following parameters:
# The values of the following parameters are from source
database:

The first section must be updated, others are optional. Change


all the absolute path of windows environment to absolute path
of Linux environment.
8. Edit The Transport Script:

Before running the transport script on the target Linux server


we need to edit it to set the correct paths for pfile,
datafiles, logfiles and tempfiles. Update all the paths as per
your Linux environment.

9. Execute the Transport Script:

[oracle]$ export ORACLE_SID=orcllnx


[oracle]$ sqlplus / as sysdba
SQL> @script.sql

On the completion of the script, the database would be open


and ready for use.

10. Change database identifier:

DBNEWID is a database utility that can change the internal


database identifier (DBID). It is run when the database is
mounted.

[oracle]$ sqlplus / as sysdba


SQL> startup mount;
SQL> exit

[oracle]$ nid TARGET=/ # ORACLE_SID must be set

After completing the above command, open the database with


RESETLOGS option.

[oracle]$ sqlplus / as sysdba


SQL> startup mount;
SQL> alter database open resetlogs;

11. Check database integrity:

SQL> select tablespace_name from dba_tablespaces;


SQL> select file_name from dba_data_files;

Checking component status after transport:

SQL> SELECT COMP_NAME,STATUS FROM DBA_REGISTRY;

You might also like