当前位置:数据库 > Oracle >>

Oracle数据库迁移--->从Windows到Linux

Oracle数据库迁移--->从Windows到Linux
 
I did a practice to migrate the oracle database from windows to linux operation system. The following is the operational process step by step. I recorded it in my blog for the future reference.
 
从10g开始,RMAN新增了CONVERT的语法,使得数据库文件可以跨版本复制,从这个特性开始,操作系统以及平台不再是数据库物理文件的限制了。
Oracle支持的可转换的平台可以在V$TRANSPORTABLE_PLATFORM视图中查询:
SQL> SELECT * FROM V$TRANSPORTABLE_PLATFORM;
PLATFORM_ID PLATFORM_NAME                            ENDIAN_FORMAT
----------- ---------------------------------------- ---------------------------
-
          1 Solaris[tm] OE (32-bit)                  Big
          2 Solaris[tm] OE (64-bit)                  Big
          7 Microsoft Windows IA (32-bit)            Little
         10 Linux IA (32-bit)                        Little
          6 AIX-Based Systems (64-bit)               Big
          3 HP-UX (64-bit)                           Big
          5 HP Tru64 UNIX                            Little
          4 HP-UX IA (64-bit)                        Big
         11 Linux IA (64-bit)                        Little
         15 HP Open VMS                              Little
          8 Microsoft Windows IA (64-bit)            Little
PLATFORM_ID PLATFORM_NAME                            ENDIAN_FORMAT
----------- ---------------------------------------- ---------------------------
-
          9 IBM zSeries Based Linux                  Big
         13 Linux 64-bit for AMD                     Little
         16 Apple Mac OS                             Big
         12 Microsoft Windows 64-bit for AMD         Little
         17 Solaris Operating System (x86)           Little
         18 IBM Power Based Linux                    Big
17 rows selected.
Oracle支持将数据文件转换为上面这些平台上的数据文件格式。

下面是我做的实验:
source platform:
os: Windows
oracle version: 10.2.0.1.0

Target platform:
os:Linux
oracle version:10.2.0.1.0

Source database ( Windows platform), the following operations are done on Windows platform.
1, 最开始碰到的问题是要求进行CONVERT的数据库必须处于只读状态
c:\>sqlplus / as sysdba
SQL>shutdown immediate
SQL> startup open read only

2, Using RMAN to convert database 
C:\>rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 6 09:52:17 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: XE (DBID=2705070866)

RMAN> convert database new database Watson
2> skip offline
3> transport script 'd:/trans_srcipt.sql'
4> to platform 'Linux IA (32-bit)'
5> format 'd:\trans\%U';

Starting convert at 06-SEP-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=33 devtype=DISK

Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.ORACLECLRDIR 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=00003 name=C:\ORACLEXE\ORADATA\XE\SYSAUX.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-SYSAUX_FNO-3_01OJ5L2R
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name=C:\ORACLEXE\ORADATA\XE\SYSTEM.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-SYSTEM_FNO-1_02OJ5L3K
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00006 name=C:\ORACLEXE\ORADATA\XE\PMDB_LOB1.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-PMDB_NDX1_FNO-6_03OJ5L43
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00005 name=C:\ORACLEXE\ORADATA\XE\PMDB_DAT1.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-PMDB_DAT1_FNO-5_04OJ5L4I
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00007 name=C:\ORACLEXE\ORADATA\XE\PMDB_NDX1.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-PMDB_LOB1_FNO-7_05OJ5L5B
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00008 name=C:\ORACLEXE\ORADATA\XE\MMDB_DAT1.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-MMDB_DAT1_FNO-8_06OJ5L65
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00009 name=C:\ORACLEXE\ORADATA\XE\MMDB_LOB1.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-MMDB_NDX1_FNO-9_07OJ5L6K
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00010 name=C:\ORACLEXE\ORADATA\XE\MMDB_NDX1.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-MMDB_LOB1_FNO-10_08OJ5L73
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00004 name=C:\ORACLEXE\ORADATA\XE\USERS.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-USERS_FNO-4_09OJ5L7J
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=C:\ORACLEXE\ORADATA\XE\UNDO.DBF
converted datafile=D:\TRANS\DATA_D-XE_I-2705070866_TS-UNDO_FNO-2_0AOJ5L7Q
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07
Run SQL script D:\TRANS_SRCIPT.SQL on the target platform to create database
Edit init.ora file D:\TRANS\INIT_00OJ5L2R_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 06-SEP-13

RMAN>

Target database ( Linux platform) the following operations are done on Linux platform.
3,  transfer the folder trans and the TRANS_SRCIPT.SQL to Linux /home/oracle like the following
[oracle@even ~]$ ll
total 268
drwxr-xr-x 2 oracle oinstall   4096 Dec  5  2012 Desktop
-rw-r--r-- 1 oracle oinstall 251438 Sep 22  2011 rlwrap-0.37.tar.gz
-rw-r--r-- 1 oracle oinstall    809 Sep  4 09:55 sqlnet.log
drwxr-xr-x 2 oracle oinstall  4096 Sep  6  2013 trans
-rw-r--r-- 1 oracle oinstall  2995 Sep  6  2013 TRANS_SRCIPT.SQL

4,create the related directory
[oracle@even trans]$ mkdir -p /u01/app/oracle/oradata/Watson
[oracle@even trans]$ mkdir -p /u01/app/oracle/admin/Watson/{a,b,c,d,u}dump

5, edit the init parameter file
[oracle@even trans]$ vi INIT_00OJ5L2R_1_0.ORA
# Please change the values of the following parameters:
# Please change the values of the following parameters:
  control_files            = "D:\TRANS\CF_D-WATSON_ID-2705070866_00OJ5L2R"
  db_recovery_file_dest    = "D:\TRANS\flash_recovery_area"
  db_recovery_file_dest_size= 10737418240
  audit_file_dest          = "D:\TRANS\ADUMP"
  background_dump_dest     = "D:\TRANS\BDUMP"
  user_dump_dest           = "D:\TRANS\UDUMP"
  core_dump_dest           = "D:\TRANS\CDUMP"
  db_name                  = "WATSON"

# Please review the values of the following parameters:
  __shared_pool_size       = 201326592
  __large_pool_size        = 4194304
  __java_pool_size         = 4194304
  __streams_pool_size      = 0
  __db_cache_size          = 591396864
  remote_login_passwordfile= "EXCLUSIVE"
  dispatchers              = "(PROTOCOL=TCP) (SERVICE=XEXDB)"

# The values of the following parameters are from source database:
  sessions                 = 49
  sga_target               = 805306368
  compati
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,