Oracle 11g RMAN复制数据库的测试(4)

如果在RMAN恢复时不指定 nofilenamecheck 参数,则在数据文件相同文件名恢复时会出现RMAN-05501错误,当源数据库和目标数据库的数据库文件目录是一样的时候,必须使用 nofilenamecheck参数告诉rman源数据库和目标数据库拥有一样的文件目录和文件名。

二、基于活动数据库的复制
测试环境:同一台主机,OS=WIN7 64BIT; DB=oracle11gR2
1.在目标数据库端创建密码文件
C:\>orapwd file='C:\app\Administrator\product\11.2.0\dbhome_1\database\PWDbdup.ora' password=oracle entries=10
2.在目标数据库端创建相应的目录
C:\>mkdir -p D:\oradata\bdup    --用于存放datafile,logfile,controlfile
C:\>mkdir -p C:\app\Administrator\admin\bdup\adump
3.在目标数据库端创建参数文件
可以在源数据库端创建目标端的参数文件,例如
SQL>create pfile='C:\app\Administrator\product\11.2.0\dbhome_1\database\initbdup.ora' from spfile;
编辑initbdup.ora文件,内容如下:
bdup.__db_cache_size=285212672
bdup.__java_pool_size=16777216
bdup.__large_pool_size=16777216
bdup.__oracle_base='C:\app\Administrator'#ORACLE_BASE set from environment
bdup.__pga_aggregate_target=419430400
bdup.__sga_target=822083584
bdup.__shared_io_pool_size=0
bdup.__shared_pool_size=469762048
bdup.__streams_pool_size=16777216
*.audit_file_dest='C:\app\Administrator\admin\bdup\adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_file_record_keep_time=7
*.control_files='D:\oradata\bdup\control01.ctl','D:\oradata\bdup\control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='bdup'
*.db_recovery_file_dest='C:\app\Administrator\flash_recovery_area'
*.db_recovery_file_dest_size=4102029312
*.diagnostic_dest='C:\app\Administrator'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=bdupXDB)'
*.fast_start_mttr_target=90
*.job_queue_processes=1000
*.memory_target=1232076800
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=587202560

*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert=('C:\app\Administrator\oradata\orcl','D:\oradata\bdup')
*.log_file_name_convert=('C:\app\Administrator\oradata\orcl','D:\oradata\bdup')

4.启动目标数据库到NOMONNT
C:\>set ORACLE_SID=bdup
SQL> startup pfile='C:\app\Administrator\product\11.2.0\dbhome_1\database\initbdup.ora' nomount
ORACLE instance started.

Total System Global Area 1235959808 bytes
Fixed Size                  2175288 bytes
Variable Size            939527880 bytes
Database Buffers          285212672 bytes
Redo Buffers                9043968 bytes
5.配置目标端监听和服务
listener.ora文件内容如下:
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl.oracle.com)
      (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
      (SID_NAME = orcl)
    )
  (SID_DESC =
      (GLOBAL_DBNAME = bdup)
      (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
      (SID_NAME = bdup)

    )
  )
tnsnames.ora文件添加如下内容:
# tnsnames.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

BDUP =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = kermart)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bdup)
    )
  )
6.重启目标端监听
C:\>lsnrctl reload
C:\>lsnrctl status
7.RMAN连接源数据库和目标数据库进行复制
C:\>rman target sys/oracle@orcl auxiliary sys/oracle@bdup
RMAN>duplicate database to BDUP FROM ACTIVE DATABASE NOFILENAMECHECK;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/fec8aaef7cb10e5fa363ec96f4488639.html