ITPub博客

首页 > 数据库 > Oracle > 10g到11g的数据库迁移实验

10g到11g的数据库迁移实验

原创 Oracle 作者:nathanzhn 时间:2014-04-08 16:00:55 0 删除 编辑


用rman来实现,实现跨库跨服务器的迁移
10g服务器:192.168.182.133 Oracle 10.2.0.1.0 RHEL 4 32bit

11g服务器:
服务器192.168.182.131 OEL5.8_32 Oracle 11.2.0.1.0 32bit
[oracle@oelr5u8-1 admin]$ uname -a
Linux oelr5u8-1.localdomain 2.6.32-300.10.1.el5uek #1 SMP Wed Feb 22 17:22:40 EST 2012 i686 i686 i386 GNU/Linux

SYS@PROD>select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

将服务器192.168.182.133上的10g库PROD2迁移至服务器192.168.182.131上的11g数据库PROD4

1. Preparations
1.1 setup auxiliary instance
1.1.1 orapwd
on 131-源库服务器
cd $ORACLE_HOME/dbs
orapwd file=orapwPROD4 password=oracle

1.1.2 export ORACLE_SID=PROD4
on 131

1.1.3 mkdir
on 131
mkdir -p /u01/app/oracle/admin/PROD4/{a,b,c,u}dump
mkdir -p /u01/app/oracle/oradata/PROD4/

1.1.4 pfile
on 133-目标库服务器
cd $ORACLE_HOME/dbs
sqlplus / as sysdba
create pfile from spfile;

scp initPROD2.ora oelr5u8-1:/u01/app/oracle/product/11.2.0/db_1/dbs/initPROD4.ora

on 131
cd cd $ORACLE_HOME/dbs
vi initPROD4.ora
PROD2.__db_cache_size=167772160
PROD2.__java_pool_size=4194304
PROD2.__large_pool_size=4194304
PROD2.__shared_pool_size=100663296
PROD2.__streams_pool_size=0
*.aq_tm_processes=1
*.audit_file_dest='/u01/app/oracle/admin/PROD2/adump'
*.background_dump_dest='/u01/app/oracle/admin/PROD2/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/PROD2/control01.ctl','/u01/app/oracle/oradata/PROD2/control02.ctl','/u01/app/oracle/oradata/PROD2/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/PROD2/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='PROD2'
*.dispatchers=''
*.job_queue_processes=10
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.session_cached_cursors=200
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/PROD2/udump'

改为符合辅助实例和11g数据库的要求

PROD4.__db_cache_size=167772160
PROD4.__java_pool_size=4194304
PROD4.__large_pool_size=4194304
PROD4.__shared_pool_size=100663296
PROD4.__streams_pool_size=0
*.aq_tm_processes=1
*.audit_file_dest='/u01/app/oracle/admin/PROD4/adump'
*.control_files='/u01/app/oracle/oradata/PROD4/control01.ctl','/u01/app/oracle/oradata/PROD4/control02.ctl','/u01/app/oracle/oradata/PROD4/control03.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='PROD4'
*.dispatchers=''
*.job_queue_processes=10
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.session_cached_cursors=200
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
## for auxiliary instance
DB_FILE_NAME_CONVERT='PROD2','PROD4'
LOG_FILE_NAME_CONVERT='PROD2','PROD4'

1.1.5 startup nomount on auxiliary instance
on 131

export ORACLE_SID=PROD4
sqlplus / as sysdba
create spfile from pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initPROD4.ora';

1.1.6 setup listener and tnsnames
on 133
vi tnsnames.ora
add:
PROD4_oelr5u8-1=
  (description=
    (address=(protocol=tcp)(host=oelr5u8-1)(port=1521))
    (connect_data=
      (server=dedicated)
      (service_name=PROD4)
    )
  )
 
on 131
vi listener.ora
add into sid_list_listener:
(sid_desc=
      (global_dbname=PROD4)
      (oracle_home=/u01/app/oracle/product/11.2.0/db_1)
      (sid_name=PROD4
    )
   
lsnrctl start

vi tnsnames.ora
PROD2_odd-oelr4u8 =
  (description =
    (address = (protocol = tcp)(host = odd-oelr4u8)(port = 1521))
    (connect_data =
      (server = dedicated)
      (service_name = PROD2)
    )
  )
 
1.2 check target database's backup
on 133
ensure that archive log mode is on

rman target /
list backup of database;
note: cannot use backup as compressed backupset... errors will be reported when duplicating

2. duplicate

 rman target sys/oracle@PROD2 auxiliary sys/oracle@PROD4_oelr5u8-1

Recovery Manager: Release 10.2.0.1.0 - Production on Sat Apr 5 15:37:35 2014

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

connected to target database: PROD2 (DBID=1490667694)
connected to auxiliary database: PROD4 (not mounted)

RMAN> duplicate target database to PROD4;

Starting Duplicate Db at 05-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=9 devtype=DISK

contents of Memory Script:
{
   set until scn  768912;
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/PROD4/system01.dbf";
   set newname for datafile  2 to
 "/u01/app/oracle/oradata/PROD4/undotbs01.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/PROD4/sysaux01.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/PROD4/users01.dbf";
   set newname for datafile  5 to
 "/u01/app/oracle/oradata/PROD4/mgmt.dbf";
   set newname for datafile  6 to
 "/u01/app/oracle/oradata/PROD4/mgmt_ecm_depot1.dbf";
   set newname for datafile  7 to
 "/u01/app/oracle/oradata/PROD4/catalog_tbs01.dbf";
   restore
   check readonly
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 05-APR-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/PROD4/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/PROD4/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/PROD4/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/PROD4/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/PROD4/mgmt.dbf
restoring datafile 00006 to /u01/app/oracle/oradata/PROD4/mgmt_ecm_depot1.dbf
restoring datafile 00007 to /u01/app/oracle/oradata/PROD4/catalog_tbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/10.2.0/db_1/dbs/06p4vq2u_1_1
ORA-19870: error while restoring backup piece /u01/app/oracle/product/10.2.0/db_1/dbs/06p4vq2u_1_1
ORA-19505: failed to identify file "/u01/app/oracle/product/10.2.0/db_1/dbs/06p4vq2u_1_1"
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
failover to previous backup

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/05/2014 15:37:45
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore


我失败了,后面该怎么做暂时还不知道。

网上有这么说的:
duplicate 不等于 可以用 11g 的DB software 直接打开10g的DB , 仍需要 Upgrade 操作。

至于做什么样的upgrade操作,还不得而知。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26521853/viewspace-1137898/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-01-23

  • 博文量
    49
  • 访问量
    262706