Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Abdul Hafeez Awan   on May 22 In Java Category.

  
Question Answered By: Abhishek Singh   on May 22

Database Conversion

To convert a whole database to a different platform, both platforms must use the same endian format. The RMAN CONVERT DATABASE command automates the movement of an entire database from a source platform to a destination platform. The transported database contains the same data as the source database and also has, with a few exceptions, the same settings as the source database.

Files automatically transported to the destination platform include:

Data files that belong to permanent tablespaces

Unlike transporting tablespaces across platforms, transporting entire databases requires that certain types of blocks, such as blocks in undo segments, be reformatted to ensure compatibility with the destination platform. Even though the endian formats for the source and destination platforms are the same, the data files for a transportable database must undergo a conversion process. You cannot simply copy data files from one platform to another as you can when transporting tablespaces.

Initialization parameter file or server parameter file

If the database uses a text-based initialization parameter file, then RMAN transports it. If the database uses a server parameter file, then RMAN generates an initialization parameter file based on the server parameter file, transports it and creates a new server parameter file at the destination based on the settings in the initialization parameter file.

Usually, some parameters in the initialization parameter file require manual updating for the new database. For example, you may change the DB_NAME and parameters such as CONTROL_FILES that indicate the locations of files on the destination host.

You can convert the format of the data files either on the source platform or on the destination platform. The CONVERT DATABASE ON DESTINATION PLATFORM command does not convert the format of data files. Rather, it generates scripts that you can run manually to perform the conversion. The CONVERT SCRIPT parameter creates a convert script that you can manually execute at the destination host to convert data file copies in batch mode. The TRANSPORT SCRIPT parameter generates a transport script that contains SQL statements to create the new database on the destination platform.
Performing Cross-Platform Tablespace Conversion on the Source Host

See the list of CONVERT command prerequisites described in Oracle Database Backup and Recovery Reference. Meet all these prerequisites before doing the steps in this section.

For purposes of illustration, assume that you must transport tablespaces finance and hr from source database prod_source, which runs on a Sun Solaris host. You plan to transport them to destination database prod_dest running on a Linux PC. You plan to store the converted data files in the temporary directory /tmp/transport_linux/ on the source host.

To perform cross-platform tablespace conversion on the source host:

Start SQL*Plus and connect to the source database prod_source with administrator privileges.

Query the name for the destination platform in the V$TRANSPORTABLE_PLATFORM view.

The database has a list of its own internal names for each platform supporting cross-platform data transport. You may need the exact name of the source or destination platform as a parameter to the CONVERT command. Query V$TRANSPORTABLE_PLATFORM to get the platform names. The following example queries Linux platform names:

SELECT PLATFORM_ID, PLATFORM_NAME, ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM
WHERE UPPER(PLATFORM_NAME) LIKE '%LINUX%';

The PLATFORM_NAME for Linux on a PC is Linux IA (32-bit).

Place the tablespaces to be transported in read-only mode. For example, enter:

ALTER TABLESPACE finance READ ONLY;
ALTER TABLESPACE hr READ ONLY;

Choose a method for naming the output files.

You must use the FORMAT or DB_FILE_NAME_CONVERT arguments to the CONVERT command to control the names of the output files. The rules are listed in order of precedence:

Files that match any patterns provided in CONVERT ... DB_FILE_NAME_CONVERT clause are named based upon this pattern.

If you specify a FORMAT clause, then any file not named based on patterns provided in CONVERT ... DB_FILE_NAME_CONVERT clause is named based on the FORMAT pattern.

Note:
You cannot use CONVERT ... DB_FILE_NAME_CONVERT to generate output file names for the CONVERT command when the source and destination files have Oracle Managed File names.

Start RMAN and connect to the source database (not the destination database) as TARGET. For example, enter:

% rman
RMAN> CONNECT TARGET SYS@prod_source

Run the CONVERT TABLESPACE command to convert the data files into the endian format of the destination host.

In the following example, the FORMAT argument controls the name and location of the converted data files:

RMAN> CONVERT TABLESPACE finance,hr
2> TO PLATFORM 'Linux IA (32-bit)'
3> FORMAT '/tmp/transport_linux/%U';

The result is a set of converted data files in the /tmp/transport_linux/ directory, with data in the correct endian format for the Linux IA (32-bit) platform.

See Also:
Oracle Database Backup and Recovery Reference for the full semantics of the CONVERT command

Follow the rest of the general outline for transporting tablespaces:

Use the Oracle Data Pump Export utility to create the export dump file on the source host.

Move the converted data files and the export dump file from the source host to the desired directories on the destination host.

Plug the tablespace into the new database with the Import utility.

If applicable, place the transported tablespaces into read/write mode.

Performing Cross-Platform Data File Conversion on the Destination Host

See the list of CONVERT command prerequisites described in Oracle Database Backup and Recovery Reference. Meet these prerequisites before doing the steps in this section.
About Cross-Platform Data File Conversion on the Destination Host

Data file conversion necessitates that you choose a technique for naming the output files. You must use the FORMAT or DB_FILE_NAME_CONVERT arguments to the CONVERT command to control the naming of output files. The rules are listed in order of precedence:

Files that match any patterns provided in CONVERT ... DB_FILE_NAME_CONVERT clause are named based upon this pattern.

If you specify a FORMAT clause, then any file not named based on patterns provided in CONVERT ... DB_FILE_NAME_CONVERT clause is named based on the FORMAT pattern.

Note:
You cannot use CONVERT ... DB_FILE_NAME_CONVERT to generate output file names for the CONVERT command when both the source and destination files are Oracle Managed Files.

If the source and destination platforms differ, then you must specify the FROM PLATFORM parameter. View platform names by querying the V$TRANSPORTABLE_PLATFORM. The FROM PLATFORM value must match the format of the data files to be converted to avoid an error. If you do not specify FROM PLATFORM, then this parameter defaults to the value of the destination platform.
Using CONVERT DATAFILE to Convert Data File Formats

This section explains how to use the CONVERT DATAFILE command. The section assumes that you intend to transport tablespaces finance (data files fin/fin01.dbf and fin/fin02.dbf) and hr (data files hr/hr01.dbf and hr/hr02.dbf) from a source database named prod_source. The database runs on a Sun Solaris host. You plan to transport these tablespaces into a destination database named prod_dest, which runs on a Linux PC. You plan to perform conversion on the destination host.

When the data files are plugged into the destination database, you plan to store them in /orahome/dbs and preserve the current directory structure. That is, data files for the hr tablespace are stored in the /orahome/dbs/hr subdirectory, and data files for the finance tablespace are stored in the /orahome/dbs/fin directory.

To perform cross-platform data file conversion on the destination host:

Start SQL*Plus and connect to the source database prod_source with administrator privileges.

Query the name for the source platform in V$TRANSPORTABLE_PLATFORM.

The database has a list of its own internal names for each platform supporting cross-platform data transport. You may need the exact name of the source or destination platform as a parameter to the CONVERT command. For example, you can obtain the platform name of the connected database as follows:

SELECT PLATFORM_NAME
FROM V$TRANSPORTABLE_PLATFORM
WHERE PLATFORM_ID =
( SELECT PLATFORM_ID
FROM V$DATABASE );

For this scenario, assume that the PLATFORM_NAME for the source host is Solaris[tm] OE (64-bit).

Identify the tablespaces to be transported from the source database and place them in read-only mode.

For example, enter the following SQL statements to place finance and hr in read-only mode:

ALTER TABLESPACE finance READ ONLY;
ALTER TABLESPACE hr READ ONLY;

On the source host, use Data Pump Export to create the export dump file

In this example, the dump file is named expdat.dmp.

Make the export dump file and the data files to be transported available to the destination host.

You can use NFS to make the dump file and current database files (not copies) accessible. Alternatively, you can use an operating system utility to copy these files to the destination host.

In this example, you store the files in the /tmp/transport_solaris/ directory of the destination host. You preserve the subdirectory structure from the original location of the files, that is, the data files are stored as:

/tmp/transport_solaris/fin/fin01.dbf

/tmp/transport_solaris/fin/fin02.dbf

/tmp/transport_solaris/hr/hr01.dbf

/tmp/transport_solaris/hr/hr02.dbf

Start RMAN and connect to the destination database (not the source database) as TARGET. For example, enter the following command:

% rman
RMAN> CONNECT TARGET SYS@prod_dest

Execute the CONVERT DATAFILE command to convert the data files into the endian format of the destination host.

In this example, you use DB_FILE_NAME_CONVERT to control the name and location of the converted data files. You also specify the FROM PLATFORM clause.

RMAN> CONVERT DATAFILE
2> '/tmp/transport_solaris/fin/fin01.dbf',
3> '/tmp/transport_solaris/fin/fin02.dbf',
4> '/tmp/transport_solaris/hr/hr01.dbf',
5> '/tmp/transport_solaris/hr/hr02.dbf'
6> DB_FILE_NAME_CONVERT
7> '/tmp/transport_solaris/fin','/orahome/dbs/fin',
8> '/tmp/transport_solaris/hr','/orahome/dbs/hr'
9> FROM PLATFORM 'Solaris[tm] OE (64-bit)

The result is a set of converted data files in the /orahome/dbs/ directory that are named as follows:

/orahome/dbs/fin/fin01.dbf

/orahome/dbs/fin/fin02.dbf

/orahome/dbs/hr/hr01.dbf

/orahome/dbs/hr/hr02.dbf

Follow the rest of the general outline for transporting tablespaces:

Plug the tablespace into the new database with the Import utility.

If applicable, place the transported tablespaces into read-only mode.

Share: 

 
 
Didn't find what you were looking for? Find more on # file Or get search suggestion and latest updates.


Tagged: