Convertdatabase heterogeneous and same-byte migration

Source: Internet
Author: User
Tags oracle database security guide windows x86
Recently, some projects require heterogeneous migration. The source platform is windows64bit and needs to be migrated to linux64bit. The database platform is oracle10.2.0.464bit. The main migration method to be discussed here is the convertdatabase of oraclerman. The official document provides a brief description: RestrictionsonCONVERTDATABASETheprimary

Recently, some projects require heterogeneous migration. The source platform is 64-bit for windows and 64-bit for linux. The database platform is 64-bit for oracle 10.2.0.4, the migration method discussed here is oracle rman's convert database. The official document provides a brief description: Restrictions on convert database The primary

Recently, some projects require heterogeneous migration. The source platform is 64-bit for windows and 64-bit for linux. The database platform is 64-bit for oracle 10.2.0.4, the migration method discussed here is oracle rman's convert database.

The official document provides a brief description:
Restrictions on CONVERT DATABASE

The primary additional restriction on transporting entire databases is that the source and target platform must share the same endian format. For example, while you can transport a database from Microsoft Windows to Linux for x86 (both little-endian), or from HP-UX to AIX (both big-endian), you cannot transport a whole database from Solaris to Linux to x86 using this feature. You can, however, create a new database on a target platform manually, and transport inpidual tablespaces from the source database using the RMAN CONVERT TABLESPACE or CONVERT DATAFILE commands.

Oracle 10 Gb has convert database, which can be converted to the oracle database of the same byte. However, if it is a different byte, convert database cannot be completed. At this time, only tts can be used to migrate individual tablespaces.

Convert database has the following notes:
Also note that some parts of the database are not transported directly:
? Redo log files and control files from the source database are not transported. new control files and redo log files are created for the target database during the transport process, and an open resetlogs is saved med once the new database is created.

?the output for the CONVERT DATABASE command, but users must copy the BFILEs themselves and fix their locations on the target platform.

?Datafiles for locally managed temporary tablespaces are not transported. The temporary tablespaces are re-created at the target platform by running the transport script.

?External tables and directories are not transported. RMAN provides a list of affected objects as part of the output of the CONVERT DATABASE command, but users must redefine these on the target platform. See Oracle Database Administrator's Guide for more information on managing external tables and directories.

? Password files are not transported. if a password file was used with the source database, the output of convert database except des a list of all usernames and their associated privileges. create a new password file on the target database using this information. see Oracle Database Security Guide for more information on managing password files.
The following small fish simulated a migration based on official materials

1. view the platform's byte sequence
SQL> select * from v $ transportable_platform order by 3;

PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ---------------------------------------- -------------------------
---
6 AIX-Based Systems (64-bit) Big
18 IBM Power Based Linux Big
2 Solaris[tm] OE (64-bit) Big
4 HP-UX IA (64-bit) Big
16 Apple Mac OS Big
1 Solaris[tm] OE (32-bit) Big
9 IBM zSeries Based Linux Big
3 HP-UX (64-bit) Big
17 Solaris Operating System (x86) Little
20 Solaris Operating System (x86-64) Little
12 Microsoft Windows x86 64-bit Little
13 Linux x86 64-bit Little
8 Microsoft Windows IA (64-bit) Little
19 HP IA Open VMS Little
11 Linux IA (64-bit) Little
5 HP Tru64 UNIX Little
10 Linux IA (32-bit) Little
7 Microsoft Windows IA (32-bit) Little
15 HP Open VMS Little

19 rows selected.

2. Shut down the database and start it to the read only status.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size 2066080 bytes
Variable Size 385878368 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14708736 bytes
Database mounted.
SQL> alter database open read only;

Database altered.

3. Check whether the current environment can be convert database
SQL> set serveroutput on;
SQL> declare
2 db_ready boolean;
3 begin
4 db_ready: =
5 dbms_tdb.check_db ('linux x86 64-bit ', dbms_tdb.skip_readonly );
6 end;
7/

PL/SQL procedure successfully completed.

If dbms_tdb.check_db does not have any warning, migration is supported.

SQL> DECLARE
2 external BOOLEAN;
3 BEGIN
4 /* value of external is ignored, but with SERVEROUTPUT set to ON
5 * dbms_tdb.check_external displays report of external objects
6 * on console */
7 external := DBMS_TDB.CHECK_EXTERNAL;
8 END;
9 /
The following directories exist in the database:
SYS.DATA_PUMP_DIR, SYS.ORACLE_OCM_CONFIG_DIR, SYS.ADMIN_DIR, SYS.WORK_DIR

PL/SQL procedure successfully completed.

Check whether external tables, directory, and bfile exist. Here, only the system directory exists and can be created later.

4 convert database. This script can be executed on the source or target.
C: \ Users \ Administrator> rman target/
RMAN> convert database
2> new database '10gnew'
3> transport script 'd: \ transport \ transportscript. SQL'
4> to platform 'linux x86 64-bit'
5> db_file_name_convert 'f: \ oracle \ product \ 10.2.0 \ oradata \ ora10g' d: \ transport'
;

Starting convert at 09-MAY-14
using channel ORA_DISK_1

Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.ORACLE_OCM_CONFIG_DIR found in the database
Directory SYS.ADMIN_DIR found in the database
Directory SYS.WORK_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=F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORA10G\SYSTEM01.D
BF
converted datafile=D:\TRANSPORT\SYSTEM01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00003 name=F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORA10G\SYSAUX01.D
BF
converted datafile=D:\TRANSPORT\SYSAUX01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORA10G\UNDOTBS01.
DBF
converted datafile=D:\TRANSPORT\UNDOTBS01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00004 name=F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORA10G\USERS01.DB
F
converted datafile=D:\TRANSPORT\USERS01.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Run SQL script D:\TRANSPORT\TRANSPORTSCRIPT.SQL on the target platform to create
database
Edit init.ora file F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00P7S8VO_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 plat
form
To change the internal database identifier, use DBNEWID Utility
Finished backup at 09-MAY-14

The script has the following meanings:
New database specifies the New database name
Transport script is a generated database script, including creating control files, specifying pfile files, opening open resetlogs, creating temp datafile, and running scripts to compile invalid objects.
To_platform specifies the Target Platform
Db_file_name_convert specifies the data file location before and after conversion

5. The datafiles generated by the Mobile convert database are sent to the target database.

6. Modify the d: \ transport \ transportscript. SQL script based on the actual file storage location of the target database.

Let's take a look at the generated script file:
-- The following commands will create a new control file and use it
-- To open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- Be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT PFILE='F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00P7S8VO_1_0.ORA'
CREATE CONTROLFILE REUSE SET DATABASE "10GNEW" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCH_D-10GNEW_ID-4165993973_S-1_T-1_A-847121848_00P7S8VO' SIZE 50M,
GROUP 2 'F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCH_D-10GNEW_ID-4165993973_S-2_T-1_A-847121848_00P7S8VO' SIZE 50M,
GROUP 3 'F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\ARCH_D-10GNEW_ID-4165993973_S-3_T-1_A-847121848_00P7S8VO' SIZE 50M
DATAFILE
'D:\TRANSPORT\SYSTEM01.DBF',
'D:\TRANSPORT\UNDOTBS01.DBF',
'D:\TRANSPORT\SYSAUX01.DBF',
'D:\TRANSPORT\USERS01.DBF'
CHARACTER SET ZHS16GBK
;

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\DATA_D-10GNEW_I-4165993973_TS-TEMP_FNO-1_00P7S8VO'
SIZE 20971520 AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--

set echo off
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prompt * Your database has been created successfully!
prompt * There are many things to think about for the new database. Here
prompt * is a checklist to help you stay on track:
prompt * 1. You may want to redefine the location of the directory objects.
prompt * 2. You may want to change the internal database identifier (DBID)
prompt * or the global database name for this database. Use the
prompt * NEWDBID Utility (nid).
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SHUTDOWN IMMEDIATE
STARTUP UPGRADE PFILE='F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00P7S8VO_1_0.ORA'
@@ ?/rdbms/admin/utlirp.sql
SHUTDOWN IMMEDIATE
STARTUP PFILE='F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00P7S8VO_1_0.ORA'
-- The following step will recompile all PL/SQL modules.
-- It may take serveral hours to complete.
@@ ?/rdbms/admin/utlrp.sql
set feedback 6;

7. Compile the pfile file. You also need to write the specified parameters according to the directory, which will not be listed here.

After the 8pfile and datafile files are stored in the specified location, you can directly run the preceding edited transportscript. SQL script.

SQL> CONNECT / AS SYSDBA
SQL> @transportscript

When a control file is created at the beginning:
ORA-01130: database file version 10.2.0.3.0 incompatible with ORACLE version 10.2.0.0.0

This is because the parameter file does not specify compatible, and oracle reads the default 10.2.0. After the compatible = 10.2.0.3.0 parameter is re-specified, the transportscript is executed again. The SQL script is normal.

Note that oracle's convert database can only be used to migrate the platform of the same byte. If the byte order is different, you can only use tools such as tts and logic replication gg to migrate the database.

Original article address: convert database heterogeneous same-byte migration, thanks to the original author for sharing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.