可以是在源库转换也可以是在目标库转换
How To Use RMAN CONVERT DATABASE on Source Host for Cross Platform. Migration [ID 413586.1] | |||||
| |||||
Modified 13-SEP-2010 Type HOWTO Status PUBLISHED |
In this Document
5 end;
6 /
PL/SQL procedure successfully completed.
3) Use DBMS_TDB.CHECK_EXTERNAL to identify any external tables, directories or BFILEs. RMAN cannot automate the transport of such files as mentioned above.
SQL> set serveroutput on
SQL> declare
2 external boolean;
3 begin
4 external := dbms_tdb.check_external;
5 end;
6 /
The following directories exist in the database:
SYS.DATA_PUMP_DIR
PL/SQL procedure successfully completed.
If there are no external objects, then this procedure completes with no output. If there are external objects, however, the output will be somewhat similar to above.
SQL> declare
2 external boolean;
3 begin
4 external := dbms_tdb.check_external;
5 end;
6 /
The following directories exist in the database:
SYS.DATA_PUMP_DIR
PL/SQL procedure successfully completed.
4) When the database is ready for transport, the RMAN CONVERT DATABASE command is run (when the source database is READ ONLY), specifying a destination platform. and how to name the output files. RMAN produces the following files needed to move the database to the destination system:
a) A complete copy of the datafiles of the database, ready to be transported
b) A PFILE for use with the new database on the destination platform, containing settings used in the PFILE/SPFILE from the source database.
c) A transport script, which contains SQL statements used to create the new database on the destination platform
C:\>rman target / nocatalog
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Feb 2 17:05:35 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=3926158280)
using target database control file instead of recovery catalog
RMAN> CONVERT DATABASE NEW DATABASE 'LinDB10g'
2> TRANSPORT SCRIPT. 'D:\oracle\oradata\dbTransport\transport.sql'
3> TO PLATFORM. 'Linux IA (32-bit)'
4> DB_FILE_NAME_CONVERT '+DG_DATA/ora10g/datafile' 'D:\oracle\oradata\dbTransport';
Starting convert at 02-FEB-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=90 devtype=DISK
Directory SYS.DATA_PUMP_DIR found in the database
User SYS with SYSDBA and SYSOPER privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name=+DG_DATA/ora10g/datafile/system.257.609084887
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\SYSTEM.257.609084887
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=+DG_DATA/ora10g/datafile/undotbs1.258.609084933
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\UNDOTBS1.258.609084933
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00003 name=+DG_DATA/ora10g/datafile/sysaux.259.609084957
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\SYSAUX.259.609084957
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00004 name=+DG_DATA/ora10g/datafile/users.260.609084973
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\USERS.260.609084973
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07
Run SQL script. D:\ORACLE\ORADATA\DBTRANSPORT\TRANSPORT.SQL on the target platform. to create database
Edit init.ora file D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00I92IKQ_1_0.ORA. This PFILE will be used to create
the database on the target platform
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
Finished backup at 02-FEB-07
Check the output related to the transport script. and the parameter file for the new database at the end above. When CONVERT DATABASE completes, the source database may be opened read-write again.
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Feb 2 17:05:35 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=3926158280)
using target database control file instead of recovery catalog
RMAN> CONVERT DATABASE NEW DATABASE 'LinDB10g'
2> TRANSPORT SCRIPT. 'D:\oracle\oradata\dbTransport\transport.sql'
3> TO PLATFORM. 'Linux IA (32-bit)'
4> DB_FILE_NAME_CONVERT '+DG_DATA/ora10g/datafile' 'D:\oracle\oradata\dbTransport';
Starting convert at 02-FEB-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=90 devtype=DISK
Directory SYS.DATA_PUMP_DIR found in the database
User SYS with SYSDBA and SYSOPER privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name=+DG_DATA/ora10g/datafile/system.257.609084887
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\SYSTEM.257.609084887
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=+DG_DATA/ora10g/datafile/undotbs1.258.609084933
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\UNDOTBS1.258.609084933
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00003 name=+DG_DATA/ora10g/datafile/sysaux.259.609084957
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\SYSAUX.259.609084957
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00004 name=+DG_DATA/ora10g/datafile/users.260.609084973
converted datafile=D:\ORACLE\ORADATA\DBTRANSPORT\USERS.260.609084973
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07
Run SQL script. D:\ORACLE\ORADATA\DBTRANSPORT\TRANSPORT.SQL on the target platform. to create database
Edit init.ora file D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00I92IKQ_1_0.ORA. This PFILE will be used to create
the database on the target platform
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
Finished backup at 02-FEB-07
5) Now copy the above files to the destination host. i.e. the converted datafiles, transport.sql script. and the pfile generated.
6) The PFILE generated by RMAN will have following sections:
a) Parameters that need to be changed for the destination host environment
b) Other parameters which are same as the source database parameters
Edit the PFILE moved on the destination host to change the environment specific parameters.
7) Now edit the TRANSPORT sql script. to reflect the new path for datafiles in the CREATE CONTROLFILE section of the script. Also change all references to the INIT.ORA in the script. to the new path and name of the INIT.ORA modified above.
8) Once the PFILE and TRANSPORT sql scripts are suitably modified invoke SQLPLUS on the destination host after setting the Oracle environment parameters and then run TRANSPORT.sql as:
[oracle@test-br ora10g]$ export ORACLE_HOME=/u01/oracle/product/ora10g
[oracle@test-br ora10g]$ export ORACLE_SID=LinDB10g
[oracle@test-br ora10g]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@test-br ora10g]$ cd /u01/oracle/oradata/LinDB10g
[oracle@test-br LinDB10g]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Feb 3 01:55:46 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> @TRANSPORT.SQL
ORACLE instance started.
Total System Global Area 201326592 bytes
Fixed Size 1218484 bytes
Variable Size 67110988 bytes
Database Buffers 125829120 bytes
Redo Buffers 7168000 bytes
Control file created.
Database altered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Your database has been created successfully!
* There are many things to think about for the new database. Here
* is a checklist to help you stay on track:
* 1. You may want to redefine the location of the directory objects.
* 2. You may want to change the internal database identifier (DBID)
* or the global database name for this database. Use the
* NEWDBID Utility (nid).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Total System Global Area 201326592 bytes
Fixed Size 1218484 bytes
Variable Size 67110988 bytes
Database Buffers 125829120 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
...
...
...
SQL> select COUNT(*) "ERRORS DURING RECOMPILATION" from utl_recomp_errors;
ERRORS DURING RECOMPILATION
---------------------------
0
SQL>
SQL>
SQL> Rem =====================================================================
SQL> Rem Run component validation procedure
SQL> Rem =====================================================================
SQL>
SQL> SET serveroutput on
SQL> EXECUTE dbms_registry_sys.validate_components;
PL/SQL procedure successfully completed.
SQL> SET serveroutput off
SQL>
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
SQL> set feedback 6;
SQL>
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
--------- ----------
LINDB10G READ WRITE
When the transport script. finishes, the creation of the new database is complete.
[oracle@test-br ora10g]$ export ORACLE_SID=LinDB10g
[oracle@test-br ora10g]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@test-br ora10g]$ cd /u01/oracle/oradata/LinDB10g
[oracle@test-br LinDB10g]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Feb 3 01:55:46 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> @TRANSPORT.SQL
ORACLE instance started.
Total System Global Area 201326592 bytes
Fixed Size 1218484 bytes
Variable Size 67110988 bytes
Database Buffers 125829120 bytes
Redo Buffers 7168000 bytes
Control file created.
Database altered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Your database has been created successfully!
* There are many things to think about for the new database. Here
* is a checklist to help you stay on track:
* 1. You may want to redefine the location of the directory objects.
* 2. You may want to change the internal database identifier (DBID)
* or the global database name for this database. Use the
* NEWDBID Utility (nid).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Total System Global Area 201326592 bytes
Fixed Size 1218484 bytes
Variable Size 67110988 bytes
Database Buffers 125829120 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
...
...
...
SQL> select COUNT(*) "ERRORS DURING RECOMPILATION" from utl_recomp_errors;
ERRORS DURING RECOMPILATION
---------------------------
0
SQL>
SQL>
SQL> Rem =====================================================================
SQL> Rem Run component validation procedure
SQL> Rem =====================================================================
SQL>
SQL> SET serveroutput on
SQL> EXECUTE dbms_registry_sys.validate_components;
PL/SQL procedure successfully completed.
SQL> SET serveroutput off
SQL>
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
SQL> set feedback 6;
SQL>
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
--------- ----------
LINDB10G READ WRITE
References
NOTE:243304.1 - 10g : Transportable Tablespaces Across Different PlatformsNOTE:414878.1 - Cross-Platform. Migration on Destination Host Using Rman Convert Database
Oracle® Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2)
Related Products
|
Cancel |
转载于:http://blog.itpub.net/15779287/viewspace-678416/