Transportable Database from Linux to Windows

TRANSPORTABLE DATABASE LINUX TO WINDOWS:

Overview
TDB requires that data files be converted to the target platform format. The data file conversion can occur on either the source system or the target system.
When performing a source system conversion, TDB creates a second copy of all data files on the source system in the format of the target system.
The converted data files must then be transferred to the
proper location on the target system.
Using TDB to migrate a database to a new platform of the same endian format consists of the following
High-level steps:
1. Check prerequisites
2. Prepare for the platform migration
3. Start the database in READ ONLY mode
4. Verify the database is ready for migration
5. Run the RMAN CONVERT DATABASE command
6. Move necessary files to the target system
7. Complete the migration

 

Implementation:
– Check Prerequisites

Source Database :- (Linux Platform 64-bit)

Check the platform name of current database:

Check the endian format of current platform
Note that ENDIAN format is little

 Check that endian format of the target platform i.e. Windows IA(64-bit) is also little
 So the database can be transported

 

Startup database in READ ONLY mode

 Make a folder to hold converted datafiles

$mkdir /home/oracle/demonew

RMAN Transportable Database Method :-

Execute DBMS_TDB.CHECK_EXTERNAL function to identify any external tables, directories, or BINARY FILEs.RMAN cannot transport of these files, so you must copy the files manually and re-create the database directories.

Below PL SQL script will help to see database to transportable or not.

SET SERVEROUTPUT ON;
DECLARE
b BOOLEAN;
BEGIN
b := DBMS_TDB.CHECK_DB(‘Microsoft Windows IA (64-bit)’,DBMS_TDB.SKIP_READONLY);
if b
then
dbms_output.put_line(‘YES your database can be transported to Windows platform’);
else
dbms_output.put_line(‘NO your database cannot be transported to WIndows Platform’);
end if;
end;
/

Run the RMAN CONVERT DATABASE Command
The CONVERT DATABASE command specified in the example creates
  – a transport script named /home/oracle/demonew/transportdb.sql which contains SQL statements used to create the new database on the destination platform,
  – a PFILE init_demonew.ora in file /home/oracle/demonew  for use with the new database on the destination platform, containing settings used  from the source database.
Several entries at the top of the PFILE should be edited when the database is moved to the destination platform
  – a copy of all data files in the =/home/oracle/demonew  directory in the format of the target platform ‘Microsoft Windows IA (64-bit)

 

Edit init.ora file /home/oracle/demonew/INIT_DEMONEW.ora.
This PFILE will be used to create the database on the target platform
Run SQL script /home/oracle/demonew/transportdb.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

Target Database :- (Windows Platform 64-bit)

Make folders on target windows host
c:\>mkdir c:\app\administrator\oradata\demonew
      mkdir c:\app\administrator\admin\demonew\adump”
Copy all the files in /home/oracle/demonew folder to c:\app\administrator\oradata\demonew
   i.e. datafiles
        Pfile
        transport script
Move PFILE to $ORACLE_HOME/database 
i.e. c:\app\administrator\product\12.1.0\dbhome_1\dbs
C:\>  copy   c:\app\test\oradata\newdb\INIT_DEMONEW.ora                                                       c:\app\test\oradata\12.1.0\dbhome_1\dbs\INIT_DEMONEW.ora
create a service for newdb on windows
c:\>oradim -new -sid DEMONEW
Execute the transport script in SQL*Plus to create the new database on the destination host.

  • Edit the PFILE to change DB_NAME and necessary directories to create database in TARGET side.
  • Change  control_files, audit_file_dest,db_name parameters as below:
  • Run the TRANSPORTDB.SQL file in SQL plus to create new database on TARGET side.It will create control files and redo log files and open database with resetlogs.After open resetlogs,it will also run utlrp.sql and utlirp.sql on target side.

I am attaching the  transportdb.sql.

  • Check the database status and invalid objects count.
  • Check the data is transported to the new database.

 

Catch Me On:- Hariprasath Rajaram

LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/ Facebook:https://www.facebook.com/HariPrasathdba                      FB Group:https://www.facebook.com/groups/894402327369506/             FB Page :https://www.facebook.com/dbahariprasath/?               Twitter :https://twitter.com/hariprasathdba

Migrate a Non-Container Database (CDB) to a Pluggable Database (PDB) in Oracle Database 12c Release 2 (12.2)

Migration:

DBMS_PDB package permits to generate an XML metadata file from a non-CDB 12c database, Its like a unplug a Pluggable database.

Step 1 : Check the database its properly up and running.shutdown the non-CDB and start it in read-only mode.

[oracle@ram ~]$ export ORACLE_SID=hari
[oracle@ram ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Oct 16 22:54:03 2018

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select name,open_mode from v$database;

NAME         OPEN_MODE
--------- --------------------
HARI         READ WRITE

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup open read only;
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size 8620224 bytes
Variable Size 452986688 bytes
Database Buffers 788529152 bytes
Redo Buffers 8155136 bytes
Database mounted.
Database opened.

In the non-DBC database using the DBMS_PDB_DESCRIBE procedure  creates an XML file in the same way that the unplug operation does for a PDB.

Step 2 : Shutdown the non-CDB database.

SQL> begin dbms_pdb.describe(pdb_descr_file => '/u01/app/oracle/oradata/HARI/tmp/hari.xml');
2 end;
3 /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

Step 3 : Connect to an existing CDB

Step 4 : Create a new PDB using that xml file which we described already in  the non-CDB database. Remember to configure the FILE_NAME_CONVERT parameter to convert the existing files to the new location.

[oracle@ram ~]$ export ORACLE_SID=Petonas
[oracle@ram ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Oct 16 23:46:58 2018

Copyright (c) 1982, 2016, Oracle. All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> create pluggable database pdb5new using '/u01/app/oracle/oradata/HARI/tmp/hari.xml'
2 copy file_name_convert = ('/u01/app/oracle/oradata/HARI/datafile/','/u01/app/oracle/oradata/PETONAS/datafile/pdb5new/');


Pluggable database created.

Step 5 : Switch to the PDB container and run the “$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql” script to clean up the new PDB, removing any items that should not be present in a PDB.

SQL> alter session set container=pdb5new;

Session altered.

SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql;

step 6 : Startup the PDB and check the open mode

SQL> alter session set container=pdb5new;

Session altered.

SQL> alter pluggable database open;

Pluggable database altered.

SQL> select name ,open_mode from v$pdbs;

NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB5NEW
READ WRITE


SQL> col name for a15
SQL> /

NAME             OPEN_MODE
--------------- ----------
PDB5NEW          READ WRITE


The non-cdb database has been converted to CDB now successfully.

 

Catch Me On:- Hariprasath Rajaram

Telegram:https://t.me/joinchat/I_f4DhGF_Zifr9YZvvMkRg
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba