rman的duplicate复制数据库

duplicate
最近公司准备迁移数据库,迁移的办法有很多,由于考虑到生产系统的安全性和停机时间等其他因素,选择的方案有很多,这里我们谈一下rman的duplicate:
11g的rman duplicate 相比10g先进了很多,10G需要在rman备份的基础上进行复制,使用 RMAN duplicate 创建一个数据完全相同但DBID不同的数据库。而11g的RMAN duplicate ,可以通过Active database duplicate和Backup-based duplicate两种方法实现。这里的测试使用的是Active database duplicate,因为Active database duplicate 功能强大,不需要先把目标数据库进行rman备份,只要目标数据库处于归档模式下即可直接通过网络对数据库进行copy,且copy完成后自动open数据库。这对于大数据特别是T级别的数据库来说优点非常明显,复制前不需要进行备份,减少了备份和传送备份的时间,同时节省备份空间。


步骤和说明:
实验环境
source端:
centos6.5
ip:192.168.6.151
oracle_sid=pu

oracle版本11g

hostname  oracle



target端:
centos6.5
ip:192.168.6.152
oracle_sid=pu

oracle版本11g

hostname  target


需要注意的是我这里的db_name是一致的,数据库目录也是一致


1、安装source端的数据库软件以及建库(详细步骤这里不在介绍可以参考:我的博客http://blog.csdn.net/freedompuge/article/details/45028961)

查看source数据库的数据文件

[oracle@target admin]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Mon May 9 16:01:30 2016


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




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options


SQL> select name from v$datafile;


NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/pu/system01.dbf
/u01/oracle/oradata/pu/sysaux01.dbf
/u01/oracle/oradata/pu/undotbs01.dbf
/u01/oracle/oradata/pu/users01.dbf
/u01/salary.dbf
/u01/11g/ggs.dbf
/u01/ogg01.dbf


7 rows selected.


2、安装target端数据库软件,但不建库(详细步骤这里不在介绍可以参考:我的博客http://blog.csdn.net/freedompuge/article/details/45028961)


3、创建密码文件
可以手工创建orapwd file='$ORACLE_HOME/dbs/orapwpu'  password=oracle entries=5 force=y;
最好是直接source端的密码文件scp $ORACLE_HOME/dbs/orapwpu  root@192.168.6.152:/u01/11g/dbs/


4、创建参数文件init.ora

这里也可以直接拷贝

source端

SQL> create pfile='/u01/init.ora' from spfile;
scp /u01/init.ora  root@192.168.6.152:/u01
[oracle@oracle dbs]$ cat /u01/init.ora
pu.__db_cache_size=33554432
pu.__java_pool_size=12582912
pu.__large_pool_size=4194304
pu.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
pu.__pga_aggregate_target=176160768
pu.__sga_target=239075328
pu.__shared_io_pool_size=0
pu.__shared_pool_size=171966464
pu.__streams_pool_size=4194304
*.audit_file_dest='/u01/oracle/admin/pu/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/oracle/oradata/pu/control01.ctl','/u01/oracle/fast_recovery_area/pu/control02.ctl'#Restore Controlfile
*.db_block_size=8192
*.db_domain=''
*.db_name='pu'
*.db_recovery_file_dest='/u01/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=8589934592
*.diagnostic_dest='/u01/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=puXDB)'
*.memory_target=414187520
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'




5、创建参数文件中的目录路径,并授予权限
最简单的防范  chown oralce.oinstall /u01 -R
[oracle@target dbs]$ cat init.ora | grep /
pu.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
*.audit_file_dest='/u01/oracle/admin/pu/adump'
*.control_files='/u01/oracle/oradata/pu/control01.ctl','/u01/oracle/fast_recovery_area/pu/control02.ctl'#Restore Controlfile
*.db_recovery_file_dest='/u01/oracle/fast_recovery_area'
*.diagnostic_dest='/u01/oracle'
创建以上目录
[oracle@target dbs]$ mkdir -p /u01/oracle/admin/pu/adump^C
[oracle@target dbs]$ mkdir -p /u01/oracle/admin/pu/adump
[oracle@target dbs]$ mkdir -p /u01/oracle/oradata/pu/
[oracle@target dbs]$ mkdir -p /u01/oracle/fast_recovery_area/pu/
[oracle@target dbs]$ mkdir -p /u01/oracle/fast_recovery_area



6、启动到nomount,并网络互通
[oracle@target ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Mon May 9 13:57:59 2016


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


Connected to an idle instance.


SQL> startup nomount pfile='/u01/11g/dbs/init.ora';
ORACLE instance started.


Total System Global Area  413372416 bytes
Fixed Size                  2228904 bytes
Variable Size             369102168 bytes
Database Buffers           37748736 bytes
Redo Buffers                4292608 bytes


关闭iptables和selinux
开启监听,tnsping能互相ping通
静态监听listener.ora
source端:


SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/11g)
      (SID_NAME = pu)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )


ADR_BASE_LISTENER = /u01/oracle


target端:


SID_LIST_LISTENER =
  (SID_LIST =
    (SID_
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值