 |
|
Oracle
Transportable Database Secrets
Oracle Tips by Burleson Consulting |
This
is an excerpt from "Oracle 10g New Features for Administrators" by
Ahmed Baraka.
• The RMAN CONVERT DATABASE command is used to
automate the movement of an entire database from one platform (the
source platform) to another (the destination platform).
• The source and destination platform must share the
same endian format.
Note: If the source and destination platform
have different endian format, you can create a new database on a
destination platform manually, and transport needed tablespaces from
the source database using cross-platform transportable tablespace.
A. Preparing for CONVERT DATABASE: Using the
DBMS_TDB Package
A.1 Using DBMS_TDB.CHECK_DB to Check Database State
DBMS_TDB.CHECK_DB checks whether a database can be
transported to a desired destination platform, and whether the
current state of the database permits transport.
It is a function that returns TRUE if the source
database can be transported using CONVERT DATABASE, and FALSE
otherwise.
It has the following parameters:
TARGET_PLATFORM_NAME - The name of the destination
platform, as it appears inV$DB_TRANSPORTABLE_PLATFORM.
SKIP_OPTION - Specifies which, if any, parts of the
database to skip when checking whether the database can be
transported. Supported values (of type NUMBER) are:
o SKIP_NONE (or 0), which checks all tablespaces
o SKIP_OFFLINE (or 2), which skips checking
datafiles in offline tablespaces
o SKIP_READONLY (or 3), which skips checking
datafiles in read-only tablespaces
Set SERVEROUTPUT to ON to see output includes why
the database cannot be transported.
SET SERVEROUTPUT
ON
DECLARE
DB_READY BOOLEAN;
BEGIN
DB_READY := DBMS_TDB.CHECK_DB('Microsoft
Windows IA (32-bit)',DBMS_TDB.SKIP_READONLY);
END;
A.2 Using DBMS_TDB.CHECK_EXTERNAL to Identify
External Objects
DBMS_TDB.CHECK_EXTERNAL must be used to identify any
external tables, directories or BFILEs. RMAN cannot automate the
transport of such files.
SET SERVEROUTPUT
ON
DECLARE
EXTERNAL BOOLEAN;
BEGIN
/* value of external is ignored */
EXTERNAL := DBMS_TDB.CHECK_EXTERNAL;
END;
B. Using the RMAN CONVERT DATABASE Command
1. Open the database in READ ONLY mode then use the
RMAN command CONVERT DATABASE as follows:
CONVERT DATABASE
NEW DATABASE 'newdb'
TRANSPORT SCRIPT '/tmp/convertdb/transcript'
TO PLATFORM 'Microsoft Windows IA (32-bit)'
DB_FILE_NAME_CONVERT '/disk1/oracle/dbs'
'/tmp/convertdb'
Alternatively, you can use ON TARGET PLATFORM clause
makes the datafile conversion on the target database.
This means RMAN will generate the appropriate
conversion scripts to be run on the target server to perform the
datafile conversion there.
CONVERT DATABASE
ON TARGET PLATFORM
NEW DATABASE 'newdb'
CONVERT SCRIPT '/tmp/convertdb/newdb.cnv'
TRANSPORT SCRIPT '/tmp/convertdb/transcript'
DB_FILE_NAME_CONVERT = '/disk1/oracle/dbs'
'/tmp/convertdb'
Note: CONVERT DATABASE ON TARGET PLATFORM does
not produce converted datafile copies.
2. Copy all of the files produced to the destination
host and place the datafiles in the desired locations on the
destination host.
3. If the path to the datafiles is different on the
destination, then edit, if any, the conversion script and the
transport script to refer to the new datafile locations.
CONVERT DATAFILE
'/tmp/SYSTEM01.DBF'
FROM PLATFORM 'Microsoft Windows IA (32-bit)'
FORMAT
'/u01/app/oracle/oradata/newdb/system01.dbf'
4. Edit the PFILE to change any settings for the
destination database.
5. Execute the transport script in SQL*Plus to
create the new database on the destination host.
SQL> @transcript
6. Open the database using RESETLOGS option ALTER
DATABASE OPEN RESETLOGS;
7. Execute some maintenance code:
ALTER TABLESPACE
TEMP
ADD TEMPFILE
'/u01/app/oracle/oradata/newdb/temp01.tmp'
MAXSIZE 32767M
SIZE 202375168 AUTOEXTEND ON NEXT 655360
SHUTDOWN IMMEDIATE;
STARTUP UPGRADE
PFILE='/u01/../newdb/INIT_RPTREPOS.ORA'
SQL> @@ ?/rdbms/admin/utlirp.sql
SHUTDOWN IMMEDIATE;
SQL> STARTUP
PFILE='/u01/../newdb/INIT_RPTREPOS.ORA'
@@ ?/rdbms/admin/utlrp.sql
8. Change the internal database identifier using
DBNEWID Utility
 |
If you like Oracle tuning, see the
book "Oracle
Tuning: The Definitive Reference", with 950 pages of tuning
tips and scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |