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

在Oracle 11gR2上使用RMAN实现整库迁移

程序员文章站 2022-05-16 14:15:32
...

在Oracle 11gR2上使用RMAN实现整库迁移 背景: 数据库 IP SID 端口 数据库版本 Target DB 192.168.1.133 orcl 152

在Oracle 11gR2上使用RMAN实现整库迁移

背景:

数据库

IP

SID

端口

数据库版本

Target DB

192.168.1.133

orcl

1521

11.2.0.1.0

Auxiliary DB

192.168.1.133(可以是同一机器,,也可以是不同机器)

V112

1522

11.2.0.1.0

1. 在Auxiliary 创建pfile 参数文件

[oracle@localhost dbs]$ pwd
/u01/oracle11gR2/product/11.2.0/db_1/dbs
[oracle@localhost dbs]$ more initv112.ora
*.DB_NAME=v112
*.control_files='/u01/oracle11gR2/oradata/v112/control01.ctl','/u01/oracle11gR2/flash_recovery_area
/v112/control02.ctl'
*.db_block_size=8192
*.compatible='11.2.0.1'
_compression_compatibility="11.2.0" 注:这个隐含参数可以绕过11.2.0.1的bug
*.db_recovery_file_dest_size=4294967296
*.db_recovery_file_dest='/u01/oracle11gR2/flash_recovery_area'
*.audit_file_dest='/u01/oracle11gR2/admin/v112/adump'

2. 在Auxiliary库上创建口令文件
[oracle@localhost dbs]$ pwd
/u01/oracle11gR2/product/11.2.0/db_1/dbs
[oracle@localhost dbs]$ orap
orapipe orapki orapwd orapwdO
[oracle@localhost dbs]$ orapwd file=orapwv112 password=Your password
3. 在Auxiliary库创建相关的目录结构
[oracle@localhost dbs]$ mkdir /u01/oracle11gR2/admin/v112/
[oracle@localhost dbs]$ mkdir /u01/oracle11gR2/oradata/v112/
注:在duplicate过程中,如果目录不存在,则会报错“ORA-27040: file create error, unable to create file”

4. 启动Auxiliary 到nomout 状态

SQL> conn / as sysdba;
Connected to an idle instance.
SQL> startup nomount pfile=‘/u01/oracle11gR2/product/11.2.0/db_1/dbs/initv112.ora’
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes

5. 在Target 和Auxiliary 都配置Oracle Net(Listener.ora and tnsnames.ora)[可选]

[oracle@localhost admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/oracle11gR2/product/11.2.0/db_1/network/admin/tnsna
mes.ora
# Generated by Oracle configuration tools.
v112 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.133)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = v112)
)
)
LISTENER_v112 =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.133)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.133)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID_NAME = orcl
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.133)(PORT = 1521))

[oracle@localhost admin]$ more listener.ora
# listener.ora Network Configuration File: /u01/oracle11gR2/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.133)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = v112)
(ORACLE_HOME = /u01/oracle11gR2/product/11.2.0/db_1)
(SID_NAME = v112)
)
)

LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.133)(PORT = 1522))
)
)

SID_LIST_LISTENER2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/oracle11gR2/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)

ADR_BASE_LISTENER1 = /u01/oracle11gR2

在Oracle 11gR2上使用RMAN实现整库迁移