欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-05-22 09:31:55
...

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

用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;