Oracle® Database Backup and Recovery Reference 11g Release 2 (11.2) Part Number E10643-06 |
|
|
PDF · Mobi · ePub |
Use the
CONVERT
command to convert a tablespace, data file, or database to the format of a destination platform in preparation for transport across different platforms.
In Oracle Database 10g and later releases, CONVERT DATAFILE
or CONVERT TABLESPACE
is required in the following scenarios:
Transporting data files between platforms for which the value in V$TRANSPORTABLE_PLATFORM.ENDIAN_FORMAT
differs.
Transporting tablespaces with undo segments (typically SYSTEM
and UNDO
tablespaces, but also tablespaces using rollback segments) between platforms, regardless of whether the ENDIAN_FORMAT
is the same or different. Typically, the SYSTEM
and UNDO
tablespaces are converted only when converting the entire database.
Other platform specific data files, (like when converting to or from the hp Tru64 operating system), require additional data file conversion .
One use of CONVERT
is to transport a tablespace into a database stored in ASM. Native operating system commands such as Linux cp
and Windows COPY
cannot read from or write to ASM disk groups.
See Also:
Oracle Database Backup and Recovery User's Guide for a complete discussion of the use ofCONVERT DATAFILE
, CONVERT TABLESPACE
, and CONVERT DATABASE
The platforms must be supported by the CONVERT
command. Query V$TRANSPORTABLE_PLATFORM
to determine the supported platforms. Cross-platform tablespace transport is only supported when both the source and destination platforms are contained in this view.
Both source and destination databases must be running with initialization parameter COMPATIBLE
set to 10.0.0 or higher. Note the following compatibility prerequisites:
If COMPATIBLE
is less than 11.0.0, then read-only tablespaces or existing transported tablespaces must have been made read/write at least once before they can be transported to a different platform. You can open a tablespace read/write and then immediately make it read-only again.
If COMPATIBLE
is 11.0.0 or higher, then the preceding read/write tablespace restriction does not apply. However, any existing transported tablespaces must have the 10.0 format, that is, they were made read/write with COMPATIBLE
set to 10.0 before they were transported.
CONVERT TABLESPACE Prerequisites
You can only use CONVERT TABLESPACE
when connected as TARGET
to the source database and converting tablespaces on the source platform.
The source database must be mounted or open. The tablespaces to be converted must be read-only at the time of the conversion. The state of the destination database is irrelevant when converting tablespaces on the source database.
CONVERT DATAFILE Prerequisites
You can only use CONVERT DATAFILE
when connected as TARGET
to the destination database and converting data file copies on the destination platform.
If you run a CONVERT DATAFILE
script generated by CONVERT DATABASE ON DESTINATION
, then the destination database instance must be started with the NOMOUNT
option. If you are not running a CONVERT DATAFILE
script generated by CONVERT DATABASE ON DESTINATION
, then the destination database can be started, mounted, or open.
The state of the source database is irrelevant when converting data file copies on the destination database. However, if you run a CONVERT DATAFILE
script as part of a database conversion on the destination database, and if the script is directly accessing the data files on the source database (for example, through an NFS mount), then the source database must be open read-only.
When converting a tablespace on the destination host, you must use CONVERT DATAFILE
rather than CONVERT TABLESPACE
because the target database cannot associate the data files with tablespaces during the conversion. After you have converted the data files required for a tablespace, you can transport them into the destination database.
CONVERT DATABASE Prerequisites
You can only use CONVERT DATABASE
when connected as TARGET
to the source database, which must be opened read-only. The state of the destination database is irrelevant when executing CONVERT DATABASE
, even if you run CONVERT DATABASE ON DESTINATION
.
Because CONVERT DATABASE
uses the same mechanism as CONVERT TABLESPACE
and CONVERT DATAFILE
to convert the data files, the usage notes and restrictions for tablespaces and data files also apply.
The primary additional prerequisite for CONVERT DATABASE
is that the source and target platforms must share the same endian format. For example, you can transport a database from Microsoft Windows to Linux for x86 (both little-endian), or from HP-UX to AIX (both big-endian), but not from Solaris to Linux x86. You can create a new database on a target platform manually, however, and transport individual tablespaces from the source database with CONVERT TABLESPACE
or CONVERT DATAFILE
.
Even if the endian formats for the source and destination platform are the same, the data files for a transportable database must undergo a conversion on either the source or destination host. Unlike transporting tablespaces across platforms, where conversion is not necessary if the endian formats are the same, transporting an entire database requires that certain types of blocks, such as blocks in undo segments, be converted to ensure compatibility with the destination platform.
Input files are not altered by CONVERT
because the conversion is not performed in place. Instead, RMAN writes converted files to a specified output destination.
CONVERT
does not process user data types that require endian conversions. To transport objects between databases that are built on underlying types that store data in a platform-specific format, use the Data Pump Import and Export utilities.
Before Oracle Database 10g, CLOBs in a variable-width character set such as UTF8
were stored in an endian-dependent fixed width format. The CONVERT
command does not perform conversions on these CLOBs. Instead, RMAN captures the endian format of each LOB column and propagates it to the target database. Subsequent reads of this data by the SQL layer interpret the data correctly based on either endian format and write it out in an endian-independent way if the tablespace is writeable. CLOBs created in Oracle Database 10g and later releases are stored in character set AL16UTF16
, which is platform-independent.
See Also:
Oracle Database Administrator's Guide to learn how to transport tablespacesconvert::=
(transportOptionList::=, convertOptionList::=)
skipSpec::=
(fileNameConversionSpec::=, formatSpec::=)
formatSpec::=
This clause specifies the objects to be converted: data files, tablespaces, or database.
Syntax Element | Description |
---|---|
DATABASE |
Converts the data files to the format of the destination platform and ensures the creation of other required database files.
You use Depending on the situation, you can use
When using
|
transportOptionList |
Specifies options that control the transport.
See Also: |
[ convertOptionList ] DATAFILE ' filename ' convertOptionList |
Specifies the name of a data file to be transported into a destination database (see Example 2-54).
The Use You can use SELECT NAME FROM V$DATAFILE_COPY WHERE CONVERTED_FILE='YES'; The
|
TABLESPACE tablespace_name convertOptionList |
Specifies the name of a tablespace in the source database that you intend to transport into the destination database on a different platform (see Example 2-53).
Specify this option to produce data files for the specified tablespaces in the format of a different destination platform. You can then transport the converted files to the destination platform. You can only use Use The Note: To convert the data files of a tablespace on the source host, use |
convertOptionList |
Specifies options that control the conversion.
See Also: |
This clause specifies options for the data files, tablespaces, or database to be transported.
Syntax Element | Description |
---|---|
NEW DATABASE database_name |
Specifies the DB_NAME for the new database produced by the CONVERT DATABASE command. |
ON DESTINATION PLATFORM |
Generates a convert script of CONVERT DATAFILE commands (see CONVERT SCRIPT parameter) that you can run on the destination host to create the database.
Note: When this option is specified, This option is useful for avoiding the overhead of the conversion on the source platform, or in cases in which you do not know the destination platform. For example, you may want to publish a transportable tablespace to be used by recipients with many different target platforms. When you run |
CONVERT SCRIPT script_name |
Specifies the location of the file to contain the convert script generated by CONVERT DATABASE ... ON TARGET PLATFORM .
If not specified, the convert script is not generated. |
skipSpec |
Specifies that CONVERT DATABASE should skip inaccessible, offline, or read-only data files during the conversion process. |
SKIP UNNECESSARY DATAFILES |
Specifies that only data files with undo segments are converted by the command. If converting at the destination platform then the generated CONVERT script only includes data files with undo segments. Data files without undo segments do not need to be converted and can be copied directly from the source database to the destination database. If the command is converting from or to hp Tru64, data files with ASSM segment headers must also be converted. |
TRANSPORT SCRIPT script_name |
Specifies the location of the file to contain the transport script generated by CONVERT DATABASE . If omitted, the transport script is not generated. |
This subclause specifies which files are excluded from the conversion.
This subclause specifies input and output options for the conversion.
You can use either the FORMAT
or fileNameConversionSpec
arguments to control the names of the output files generated by the CONVERT
command. If you do not specify either, then the rules governing the location of the output files are the same as those governing the output files from a BACKUP
AS COPY
operation. These rules are described in the backupTypeSpec
entry.
Syntax Element | Description |
---|---|
fileNameConversionSpec |
A set of string pairs. Whenever any of the input file names contains one of the first halves of a pair, anywhere in the file name, it is replaced with the second half of the same pair. You can use as many pairs of replacement strings as required. You can use single or double quotation marks.
See Also: "Duplication with Oracle Managed Files" to learn about restrictions related to ASM and Oracle Managed Files |
FORMAT formatSpec |
Specifies the name template for the output files. See the BACKUP AS COPY command for the format values that are valid here.
If the database to which RMAN is connected as You can use As shown in Example 2-55, you can use |
FROM PLATFORM ' platform ' |
Specifies the name of the source platform. If not specified, the default is the platform of the database to which RMAN is connected as TARGET .
The specified platform must be listed in the SELECT PLATFORM_NAME, ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM WHERE UPPER(PLATFORM_NAME) LIKE 'LINUX%'; |
PARALLELISM integer |
Specifies the number of channels to be used to perform the operation. If not used, then channels allocated or configured for disk determine the number of channels. |
TO PLATFORM ' platform ' |
Specifies the name of the destination platform. If not specified, the default is the platform of the database to which RMAN is connected as TARGET .
The specified platform must be listed in the SELECT PLATFORM_NAME, ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM WHERE UPPER(PLATFORM_NAME) LIKE 'LINUX%'; |
Example 2-53 Converting Tablespaces on the Source Platform
Suppose you must convert tablespaces finance
and hr
in source database prodlin
to the platform format of destination database prodsun
. The finance
tablespace includes data files /disk2/orahome/fin/fin01.dbf
and /disk2/orahome/fin/fin02.dbf
. The hr
tablespace includes data files /disk2/orahome/fin/hr01.dbf
and /disk2/orahome/fin/hr02.dbf
.
The prodlin
database runs on Linux host lin01
. You query V$DATABASE
and discover that platform name is Linux IA (32-bit)
and uses a little-endian format. The prodsun
database runs on Solaris host sun01
. You query V$TRANSPORTABLE_PLATFORM
and discover that the PLATFORM_NAME
for the Solaris host is Solaris[tm] OE (64-bit)
, which uses a big-endian format.
You plan to convert the tablespaces on the source host and store the converted data files in /tmp/transport_to_solaris/
on host lin01
. The example assumes that you have set COMPATIBLE
is to 10.0 or greater on the source database.
On source host lin01
, you start the RMAN client and run the following commands:
CONNECT TARGET SYS@prodlin
target database Password: password
connected to target database: PRODLIN (DBID=39525561)
SQL 'ALTER TABLESPACE finance READ ONLY';
SQL 'ALTER TABLESPACE hr READ ONLY';
CONVERT TABLESPACE finance, hr
TO PLATFORM 'Solaris[tm] OE (64-bit)'
FORMAT '/tmp/transport_to_solaris/%U';
The result is a set of converted data files in the /tmp/transport_to_solaris/
directory, with data in the right endian-order for the Solaris 64-bit platform.
From this point, you can follow the rest of the general outline for tablespace transport. Use the Data Pump Export utility to create the file of structural information, move the structural information file and the converted data files from /tmp/transport_to_solaris/
to the desired directories on the destination host, and plug the tablespace into the new database with the Data Pump Import utility.
Example 2-54 Converting Data Files on the Destination Platform
This example assumes that you want to convert the finance
and hr
tablespaces from database prodsun
on host sun01
into a format usable by database prodlin
on destination host lin01
. You temporarily store the unconverted data files in directory /tmp/transport_from_solaris/
on destination host lin01
and perform the conversion with CONVERT DATAFILE
. When you transport the data files into the destination database, they are stored in /disk2/orahome/dbs
.
The example assumes that you did the following steps in preparation for the tablespace transport:
You used the Data Pump Export utility to create the structural information file (named, in our example, expdat.dmp
).
You made the finance
and hr
tablespaces read-only on the source database.
You used an operating system utility to copy expdat.dmp
and the unconverted data files to be transported to the destination host lin01
in the /tmp/transport_from_solaris
directory. The data files are stored as:
/tmp/transport_from_solaris/fin/fin01.dbf
/tmp/transport_from_solaris/fin/fin02.dbf
/tmp/transport_from_solaris/hr/hr01.dbf
/tmp/transport_from_solaris/hr/hr02.dbf
You queried the name for the source platform in V$TRANSPORTABLE_PLATFORM
and discovered that the PLATFORM_NAME
is Solaris[tm] OE (64-bit)
.
Note the following considerations when performing the conversion:
Identify the data files by file name, not by tablespace name. Until the data files are plugged in, the local instance has no way of knowing the intended tablespace names.
The FORMAT
argument controls the name and location of the converted data files.
When converting on the destination host, you must specify the source platform with the FROM
argument. Otherwise, RMAN assumes that the source platform is the same as the platform of the host performing the conversion.
You start the RMAN client and connect to the destination database prodlin
as TARGET
. The following CONVERT
command converts the data files to be transported to the destination host format and deposits the results in /disk2/orahome/dbs
:
CONNECT TARGET SYS@prodlin
target database Password: password
connected to target database: PRODLIN (DBID=39525561)
CONVERT DATAFILE
'/tmp/transport_from_solaris/fin/fin01.dbf',
'/tmp/transport_from_solaris/fin/fin02.dbf',
'/tmp/transport_from_solaris/hr/hr01.dbf',
'/tmp/transport_from_solaris/hr/hr02.dbf'
DB_FILE_NAME_CONVERT
'/tmp/transport_from_solaris/fin','/disk2/orahome/dbs/fin',
'/tmp/transport_from_solaris/hr','/disk2/orahome/dbs/hr'
FROM PLATFORM 'Solaris[tm] OE (64-bit)';
The result is that the following data files have been converted to the Linux format:
/disk2/orahome/dbs/fin/fin01.dbf
/disk2/orahome/dbs/fin/fin02.dbf
/disk2/orahome/dbs/hr/hr01.dbf
/disk2/orahome/dbs/hr/hr02.dbf
From this point, follow the rest of the general outline for tablespace transport. Use Data Pump Import to plug the converted tablespaces into the new database, and make the tablespaces read/write if applicable.
Example 2-55 Copying Data Files to and from ASM with CONVERT DATAFILE
This example illustrates copying data files into ASM from normal storage. The generated files are not considered data file copies that belong to the target database, so LIST DATAFILECOPY
does not display them.
Use CONVERT DATAFILE
without specifying a source or destination platform. Specify ASM disk group +DATAFILE
for the output location, as shown here:
RMAN> CONVERT DATAFILE '/disk1/oracle/dbs/my_tbs_f1.df', '/disk1/oracle/dbs/t_ax1.f' FORMAT '+DATAFILE'; Starting conversion at 29-MAY-05 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/disk1/oracle/dbs/t_ax1.f converted datafile=+DATAFILE/asmv/datafile/sysaux.280.559534477 channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:16 channel ORA_DISK_1: starting datafile conversion input filename=/disk1/oracle/dbs/my_tbs_f1.df converted datafile=+DATAFILE/asmv/datafile/my_tbs.281.559534493 channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:04 Finished conversion at 29-MAY-05
The following example illustrates copying the data files of a tablespace out of ASM storage to directory /tmp
, with uniquely generated file names.
RMAN> CONVERT TABLESPACE tbs_2 FORMAT '/tmp/tbs_2_%U.df'; Starting conversion at 03-JUN-05 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=20 devtype=DISK channel ORA_DISK_1: starting datafile conversion input datafile fno=00006 name=+DATAFILE/tbs_21.f converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-6_11gm2fq9.df channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile conversion input datafile fno=00007 name=+DATAFILE/tbs_22.f converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-7_12gm2fqa.df channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile conversion input datafile fno=00019 name=+DATAFILE/tbs_25.f converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-19_13gm2fqb.df channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile conversion input datafile fno=00009 name=+DATAFILE/tbs_23.f converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-9_14gm2fqc.df channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile conversion input datafile fno=00010 name=+DATAFILE/tbs_24.f converted datafile=/tmp/tbs_2_data_D-L2_I-2786301554_TS-TBS_2_FNO-10_15gm2fqd.df channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01 Finished conversion at 03-JUN-05
Example 2-56 Transporting a Database to a Different Platform
The arguments to CONVERT DATABASE
vary depending on whether you plan to convert the data files on the source or destination platform. For a description of the conversion process on source and destination platforms and extended examples, refer to Oracle Database Backup and Recovery User's Guide. Read that discussion in its entirely before attempting a database conversion.
Assume that you want to transport database prod
on a Linux host to a Windows host. You decide to convert the data files on the source host rather than on the destination host. The following example connects RMAN to the prod
database on the Linux host and uses CONVERT DATABASE NEW DATABASE
to convert the data files and generate the transport script:
CONNECT TARGET SYS@lin01
target database Password: password
connected to target database: PROD (DBID=39525561)
CONVERT DATABASE
NEW DATABASE 'prodwin'
TRANSPORT SCRIPT '/tmp/convertdb/transportscript'
TO PLATFORM 'Microsoft Windows IA (32-bit)'
DB_FILE_NAME_CONVERT '/disk1/oracle/dbs','/tmp/convertdb';
In the following variation, you want to transport a database running on a Linux host to a Windows host, but you want to convert the data files on the destination host rather than the source host. The following example connects RMAN to the prod
database on the Linux host and executes CONVERT DATABASE ON DESTINATION PLATFORM
:
CONNECT TARGET SYS@lin01
target database Password: password
connected to target database: PROD (DBID=39525561)
CONVERT DATABASE
ON DESTINATION PLATFORM
CONVERT SCRIPT '/tmp/convertdb/convertscript.rman'
TRANSPORT SCRIPT '/tmp/convertdb/transportscript.sql'
NEW DATABASE 'prodwin'
FORMAT '/tmp/convertdb/%U';
The CONVERT DATABASE ON DESTINATION PLATFORM
command, which is executed on a Linux database, generates a convert script that can be run on the Windows host to convert the data files to the Windows format. The CONVERT DATABASE
command also generates a transport script.
Example 2-57 Transporting a Database to a Different Platform and Storage Type
In this scenario, you have a database prod
on a Solaris host named sun01
that you want to move to an AIX host named aix01
. The Solaris data files are stored in a non-ASM file system, but you want to store the data files in ASM on the AIX host.
The following example connects to sun01
and runs CONVERT DATABASE
to generate the necessary scripts:
CONNECT TARGET SYS@sun01
target database Password: password
connected to target database: PROD (DBID=39525561)
CONVERT DATABASE
ON DESTINATION PLATFORM
CONVERT SCRIPT '/tmp/convert_newdb.rman'
TRANSPORT SCRIPT '/tmp/transport_newdb.sql'
NEW DATABASE 'prodaix'
DB_FILE_NAME_CONVERT '/u01/oradata/DBUA/datafile','+DATA';
The convert script contains statements of the following form, where your_source_platform stands for your source platform:
CONVERT DATAFILE '/u01/oradata/DBUA/datafile/o1_mf_system_2lg3905p_.dbf'
FROM PLATFORM 'your_source_platform'
FORMAT '+DATA/o1_mf_system_2lg3905p_.dbf';
To reduce downtime for the conversion, you can use NFS rather than copying data files over the network or restoring a backup. For example, you could mount the Solaris files system on the AIX host as /net/solaris/oradata
. In this case, you would edit the convert script to reference the NFS-mounted directory as the location of the source data files to convert, putting the commands into the following form:
CONVERT DATAFILE '/net/solaris/oradata/DBUA/datafile/o1_mf_system_2lg3905p_.dbf'
FROM PLATFORM 'your_source_platform'
FORMAT '+DATA/o1_mf_system_2lg3905p_.dbf';
You then connect RMAN to the destination database instance, in this case the instance on host aix01
, and convert the data files (during the conversion the database at host sun01 should remain in open read only mode). Afterward, you connect SQL*Plus to the database instance on aix01
and run the transport script to create the database.