Loading…

ASM WEB TECH

Click the button below to start exploring our website and learn more about our awesome company
Start exploring

Oracle Database Migration From Windows to Linux Using RMAN

This post describes the procedure required to Oracle Database Migration from Windows to Linux using the RMAN Convert Database command.

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

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

  1. Runutlirp.sqland utlrp.sql for recompile all Pl/SQL modules.
    12. Verify & Compare the database on Linux1. 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(‘LinuxIA(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 ‘ alpi’

transport script ‘D:\ORACLE\SCRIPT\alpi.sql

to platform ‘Linux IA (32-bit)’

db_file_name_convert ‘D:\ORACLE\ORADATA\alpi\’ ‘                                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 theinit.ora file generated by the “CONVERT DATABASE” command or you can create your own pfile using the SQL statement “create pfile from spfile”.

  1. 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.
  2. Edit init.ora or pfile for new database:
    Open theinit.orafile 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.
  3. 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.
  4. Execute the Script:
    SET ORACLE_SID= alpi
    sqlplus / as sysdba
    SQL>@d:\oracle\alpi.sql
    On the completion of the script, the database would be open and ready for use.
  5. 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
  6. Run utlirp.sql and utlrp.sqlon the target platform to recompile all PL/SQL modules.
  7. 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;

Contact us to find out what our years of experience, proven track record and platform of innovative solutions can offer your business today, tomorrow and for decades to come.

10 thoughts on “Oracle Database Migration From Windows to Linux Using RMAN

  1. There are some attention-grabbing cut-off dates on this article however I don’t know if I see all of them center to heart. There is some validity but I’ll take maintain opinion till I look into it further. Good article , thanks and we would like extra! Added to FeedBurner as well

  2. Somebody necessarily lend a hand to make seriously posts I’d state. This is the first time I frequented your website page and so far? I amazed with the analysis you made to create this particular put up amazing. Magnificent process!

  3. Hiya, I’m really glad I’ve found this info. Nowadays bloggers publish just about gossips and net and this is really irritating. A good blog with interesting content, that is what I need. Thanks for keeping this web site, I will be visiting it. Do you do newsletters? Cant find it.

  4. Thanks for the marvelous posting! I actually enjoyedreading it, you will be a great author. I will ensure that I bookmark your blogand will eventually come back very soon. I want to encourage you to definitely continue your great work, have a nice day!

  5. Pingback: WOW Blog

Leave a Reply