ITPub博客

首页 > Linux操作系统 > Linux操作系统 > duplicate database

duplicate database

原创 Linux操作系统 作者:gamble_god 时间:2012-06-06 13:19:09 0 删除 编辑
前些天被用户叫去给创建备用库,通过rman duplicate在相同主机上生成辅助数据库,整理了下步骤。

target database directory hierarchy
/u01/app/oracle/oradata/ORCL
/u01/app/oracle/flash_recovery_area/ORCL

auxiliay database
#构建辅助数据库目录结构
cd /u01/app/oracle/oradata
mkdir aux1
mkdir aux1/arch
cd /u01/app/oracle/admin
mkdir aux1
cd aux1
mkdir pfile adump bdump udump cdump
cd /u01/app/oracle/flash_recovery_area
mkdir aux1

#将目标数据库的init.ora文件复制到辅助数据库的相应位置
SQL> conn /as sysdba
SQL> create pfile='/u01/app/oracle/admin/aux1/pfile/init.ora' from spfile;

#根据需要修改辅助实例中的init.ora文件
*.audit_file_dest='/u01/app/oracle/admin/aux1/adump'
*.background_dump_dest='/u01/app/oracle/admin/aux1/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/aux1/control01.ctl'
*.core_dump_dest='/u01/app/oracle/admin/aux1/cdump'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='aux1'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=aux1XDB)'
*.job_queue_processes=10
*.log_archive_dest_1='location=/home/oracle/archive'
*.log_archive_dest_10='location=USE_DB_RECOVERY_FILE_DEST'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=1024
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1131
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/aux1/udump'
*.instance_name='aux1'

#为辅助实例创建口令文件
cd $ORACLE_HOME/dbs
orapwd file=orapwaux1 password=oracle

#以未加载的模式启动aux1实例
export ORACLE_SID=aux1
sqlplus /nolog
SQL> connect /as sysdba
SQL> startup nomount pfile='/u01/app/oracle/admin/aux1/pfile/init.ora'

#配置连接aux1实例的网络文件
listener.ora文件应具有下面条目
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = aux1)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db)
      (SID_NAME = aux1)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = linux)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

tnsnames.ora文件应具有下面条目:
aux1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.128)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = aux1)
      (SERVER = DEDICATED)
    )
  )

#从RMAN连接到目标实例和辅助实例,并且运行duplicate命令
rman target /
RMAN> connect auxiliary sys/oracle@aux1
RMAN> duplicate target database to aux1 nofilenamecheck
 pfile='/u01/app/oracle/admin/aux1/pfile/init.ora'
 logfile
 '/u01/app/oracle/oradata/aux1/redo01.dbf' size 100m,
 '/u01/app/oracle/oradata/aux1/redo02.dbf' size 100m,
 '/u01/app/oracle/oradata/aux1/redo03.dbf' size 100m;

在归档模式下的备份是非一致性备份,还需要redo的信息才能使之变成一致性的,而这些信息暂时还在online redo log中,简单来说就是还没有出生(归档),我们可以切换一下日志文件,使之生成归档日志文件,并传到测试服务器上,对应的目录下面。否则会出现如下报错信息:
ORA-19870: error reading backup piece /u01/app/oracle/backup/all_04n8sls3_1_1
ORA-19505: failed to identify file "/u01/app/oracle/backup/all_04n8sls3_1_1"
ORA-27037: unable to obtain file status

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12366929/viewspace-732042/,如需转载,请注明出处,否则将追究法律责任。

上一篇: ORA-04030
下一篇: ORA-29740
请登录后发表评论 登录
全部评论

注册时间:2012-05-29

  • 博文量
    10
  • 访问量
    17871