利用Rman的duplicate命令,可以很方便的将原库复制出一个新库,这在诸如data guard等应用中非常有用。但是在Oracle11g之前,执行duplicate要求首先对原库用rman进行备份,然后将备份复制到复制库,同时连接原库(做为target)和复制库(做为auxiliary),执行duplicate命令进行复制。在Oracle11g中推出的active database duplicate特性,则省略了进行rman备份的步骤,能够直接从原库复制出新库,对于一些大型的数据库来说,这个特性可以节省很多操作时间。本文将简单的演示一下操作过程(在同一个主机上执行duplicate):
原库:ora11g(归档模式)
新库:oradup
操作系统:windows
1,首先手工创建新的instance oradup
2,从原库的spfile创建pfile并进行修改替换为oradup
3,创建spfile中的目录
oradup.__db_cache_size=226492416 oradup.__java_pool_size=8388608 oradup.__large_pool_size=8388608 oradup.__oracle_base='C:\app\dell'#ORACLE_BASE set from environment oradup.__pga_aggregate_target=511705088 oradup.__sga_target=780140544 oradup.__shared_io_pool_size=0 oradup.__shared_pool_size=528482304 oradup.__streams_pool_size=0 *.audit_file_dest='C:\app\dell\admin\oradup\adump' *.audit_trail='db' *.compatible='11.2.0.0.0' *.control_files='C:\app\dell\oradata\oradup\control01.ctl','C:\app\dell\flash_recovery_area\oradup\control02.ctl' *.DB_FILE_NAME_CONVERT=('D:\sendb','D:\oradup') *.LOG_FILE_NAME_CONVERT=('D:\sendb','D:\oradup') *.log_archive_dest_1='location=D:\oradup\ARCH' *.db_block_size=8192 *.db_domain='' *.db_name='oradup' *.db_recovery_file_dest='C:\app\dell\flash_recovery_area' *.db_recovery_file_dest_size=4039114752 *.diagnostic_dest='C:\app\dell' *.dispatchers='(PROTOCOL=TCP) (SERVICE=oradupXDB)' *.job_queue_processes=1000 *.memory_target=1287651328 *.nls_language='SIMPLIFIED CHINESE' *.nls_territory='CHINA' *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.undo_management='AUTO' *.undo_tablespace='UNDOTBS2'
3.1 创建口令验证文件
C:\>orapwd file=C:\app\dell\product\11.2.0\dbhome_1\database\pwdoradup.ora password=sys entries=1
口令文件名格式pwd + sid + .ora,pwdoradup.ora不用事先建立,是上面语句执行之后生成。
4,配置好了listener和tnsname之后sqlplus / as sysdba进如每次都是报错“协议适配器错误”,
手工启动windows的这个服务之后就好了
5,启动rman,同时连接原库和新库
C:\Documents and Settings\dell>rman target sys/sys@sen auxiliary sys/sys@oradup
在net ca修改监听,增加oracle home目录
lsnrctl stop再start之后,成功
6 执行duplicate
RMAN> duplicate target database to oradup from active database;
7,验证辅助库
SQL> select instance_name,status from v$instance;