DEV Community

Cover image for Oracle Database Migration from Windows to Linux Using RMAN Transportable Tablespace
Arvind Toorpu
Arvind Toorpu

Posted on

Oracle Database Migration from Windows to Linux Using RMAN Transportable Tablespace

Oracle Database Migration from Windows to Linux Using RMAN Transportable Tablespace

Migrating an Oracle database between different operating systems can often feel daunting. However, with the right tools and steps, this process can be more manageable than it seems. In this article, we will walk through migrating an Oracle database from Windows to Linux using the RMAN Transportable Tablespace feature - one of the most efficient methods for such a task.

Prerequisites

Oracle Database installed on both Windows and Linux servers. Network connectivity between the two servers. Sufficient disk space on both servers. Basic understanding of RMAN and Oracle database administration.

Step-by-Step Migration
Prepare the Source Database (Windows)

First, we need to ensure the source database is in READ ONLY mode. This step is crucial to prevent any changes during the migration process.

SQL> ALTER DATABASE OPEN READ ONLY;

Enter fullscreen mode Exit fullscreen mode

Identify the Tablespaces to be Transported

Identify the tablespaces that you want to transport. For this example, we will transport the sales_data tablespace.

SQL> SELECT tablespace_name FROM dba_tablespaces;

Enter fullscreen mode Exit fullscreen mode

Generate the Transportable Tablespace Set
Use RMAN to create the transportable tablespace set, including metadata files and datafiles.

rman target / 

RMAN> TRANSPORT TABLESPACE sales_data  
TABLESPACE DESTINATION '/tmp/transport_tbs'  
EXPORT LOG '/tmp/transport_tbs/tts_export.log';
Enter fullscreen mode Exit fullscreen mode

This command creates the datafiles and a transportable tablespace set in the specified destination.

Transfer Files to the Destination Server (Linux)
Using a secure copy tool like scp, transfer the files to the target Linux server.

scp /tmp/transport_tbs/* oracle@linux_server:/tmp/transport_tbs/

Enter fullscreen mode Exit fullscreen mode

Prepare the Target Database (Linux)
Create the necessary directories and ensure the target database is up and running.


SQL> CREATE TABLESPACE sales_data DATAFILE '/u01/app/oracle/oradata/sales_data01.dbf' SIZE 100M;
Enter fullscreen mode Exit fullscreen mode

Import Metadata
Use Data Pump to import the metadata into the target database.

impdp system/password DIRECTORY=dpump_dir1 DUMPFILE=sales_data.dmp 
TRANSPORT_DATAFILES='/u01/app/oracle/oradata/sales_data01.dbf';
Enter fullscreen mode Exit fullscreen mode

Make the Tablespaces Read/Write
Once the import is complete, make the tablespace read/write.

SQL> ALTER TABLESPACE sales_data READ WRITE;

Enter fullscreen mode Exit fullscreen mode

Verify the Migration
Confirm the tablespace and data have been transported correctly by querying the objects.

SQL> SELECT * FROM dba_tablespaces WHERE tablespace_name='SALES_DATA'; 

SQL> SELECT * FROM sales.orders WHERE ROWNUM  EXEC DBMS_TTS.TRANSPORT_SET_CHECK('sales_data', TRUE);
Enter fullscreen mode Exit fullscreen mode

Convert the Endianness (if required)
Use RMAN to convert the data files if the source and target platforms have different endian formats.

    RMAN> CONVERT DATAFILE '/tmp/transport_tbs/sales_data01.dbf'
    TO PLATFORM="Linux x86 64-bit"
    FROM PLATFORM="Windows NT (32-bit)"
    DB_FILE_NAME_CONVERT ('/tmp/transport_tbs', '/u01/app/oracle/oradata');
Enter fullscreen mode Exit fullscreen mode

Import Metadata as detailed above
Following these steps, you can efficiently migrate your Oracle database from Windows to Linux using the RMAN Transportable Tablespace feature, ensuring minimal downtime and data integrity.

Conclusion:
Database migration might seem a strenuous process, but with Oracle RMAN Transportable Tablespace, it becomes structured and manageable. Adapting this guide to your specific scenarios will help in achieving this transition smoothly. If you encounter any issues, Oracle's documentation and community forums are excellent resources for troubleshooting and additional guidance.

Top comments (0)