Duplicating a Database Without Recovery Catalog or Target Connection

0    167    1

Tags:

👉 本文共约14890个字,系统预计阅读时间或需56分钟。

    1. duplicate体系结构

搞点英语出来吧,英语不好的哥们就好好翻译翻译吧,这段英语是必须看懂的。。。。

You can duplicate a source database to a destination database, which can be on the same or different computers. The database instance associated with the duplicate database is called the auxiliary instance. All duplication techniques require a connection to the auxiliary instance. The diagram shows you the following techniques for database duplication:

  • From an active database, connected to the target and auxiliary instances
  • From backup, connected to the target and auxiliary instances
  • From backup, connected to the auxiliary instance, not connected to the target, but with recovery catalog connection
  • From backup, connected to the auxiliary instance, not connected to the target and the recovery catalog

Choosing a technique to duplicate your database—always with connection to the auxiliary instance:

Duplicating a Database Without Recovery Catalog or Target Connection

简单点就是 ①基于备份 ,而基于备份又分为3种情况 ②基于活动数据库

  1. 本次实验简介

本次实验就是基于备份,但是不连接到目标数据库,也不连接到恢复目录。

When you duplicate a database without a target database connection and without a recovery catalog, RMAN uses a BACKUP LOCATION where all necessary backups and copies reside.

The diagram illustrates backup-based duplication without connections to the target or to the recovery catalog database instance. A disk backup location containing all the backups or copies for duplication must be available to the destination host.

  1. 本次实验原理图

Duplicating a Database Without Recovery Catalog or Target Connection

  1. 环境及搭建要求

环境:

  • Destination host :192.168.59.133 sid:orcl database:11gR2

注意事项说明:

  • 这里的duplicate database 和 source database 的目录结构完全一样
  • 源数据库和辅助数据库的几种不同名称:source/target database ---->>>>>----- (destination host)/duplicate database (auxiliary instance)

source database环境:

SQL> select * from v$version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

PL/SQL Release 11.2.0.1.0 - Production

CORE 11.2.0.1.0 Production

TNS for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

  1. 对辅助数据库的要求

辅助数据库应该提前安装好数据库,配置好环境变量。。。。。

辅助数据库的环境变量配置:

[root@rhel6 ~]# su - oracle

[oracle@rhel6 ~]$ more .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

export PATH=$PATH:/sbin/:$HOME/bin

# for oracle user

unset USERNAME

export GLOBAL_DB_UNIQUE_NAME=orcl

export ORACLE_HOSTNAME=192.168.59.133

export ORACLE_UNQNAME=orcl

export EDITOR=vi

export ORACLE_SID=orcl

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

export PATH=$ORACLE_HOME/bin:$PATH

umask 022

#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"

export SQLPATH=$ORACLE_HOME/sqlplus/admin

alias sqlplus='rlwrap sqlplus'

alias rman='rlwrap rman'

alias asmcmd='rlwrap asmcmd'

alias alert_log='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLESID/trace/alert$ORACLE_SID.log'

alias alert_xml='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/alert/log.xml'

alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'

[oracle@rhel6 ~]$

  1. 正式开始

    1. 前期准备

      1. 建表

--登录源数据库并创建一个新的表

[oracle@rhel6 ~]$ sqlplus lhr/lhr

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jul 20 20:54:04 2014

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create table test_duplicate(id number,text varchar2(20));

Table created.

SQL> insert into test_duplicate values(1,'a');

1 row created.

SQL> insert into test_duplicate values(2,'b');

1 row created.

SQL> commit;

Commit complete.

SQL>

Duplicating a Database Without Recovery Catalog or Target Connection

  1. 数据库归档模式

让源数据库处于归档模式:

[oracle@rhel6 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jul 20 20:57:18 2014

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 31

Next log sequence to archive 33

Current log sequence 33

SQL>

Duplicating a Database Without Recovery Catalog or Target Connection

  1. 备份数据库

--备份source database并将备份传送到destination database

[oracle@rhel6 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jul 20 20:59:18 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1379935487)

RMAN> backup database include current controlfile plus archivelog delete input;

Starting backup at 20-JUL-14

current log archived

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=40 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=5 RECID=1 STAMP=852157306

input archived log thread=1 sequence=6 RECID=2 STAMP=852374702

input archived log thread=1 sequence=7 RECID=3 STAMP=852384088

input archived log thread=1 sequence=8 RECID=4 STAMP=852384132

input archived log thread=1 sequence=9 RECID=5 STAMP=852384155

input archived log thread=1 sequence=10 RECID=6 STAMP=852384188

input archived log thread=1 sequence=11 RECID=7 STAMP=852384214

input archived log thread=1 sequence=12 RECID=8 STAMP=852384270

input archived log thread=1 sequence=13 RECID=9 STAMP=852384372

input archived log thread=1 sequence=14 RECID=10 STAMP=852384413

input archived log thread=1 sequence=15 RECID=11 STAMP=852384454

input archived log thread=1 sequence=16 RECID=12 STAMP=852384496

input archived log thread=1 sequence=17 RECID=13 STAMP=852384541

input archived log thread=1 sequence=18 RECID=14 STAMP=852384629

input archived log thread=1 sequence=19 RECID=15 STAMP=852384675

input archived log thread=1 sequence=20 RECID=16 STAMP=852384764

input archived log thread=1 sequence=21 RECID=17 STAMP=852385529

input archived log thread=1 sequence=22 RECID=18 STAMP=852391136

input archived log thread=1 sequence=23 RECID=19 STAMP=852398713

input archived log thread=1 sequence=24 RECID=20 STAMP=852398768

input archived log thread=1 sequence=25 RECID=21 STAMP=852398817

input archived log thread=1 sequence=26 RECID=22 STAMP=852398883

input archived log thread=1 sequence=27 RECID=23 STAMP=852398933

input archived log thread=1 sequence=28 RECID=24 STAMP=852426016

input archived log thread=1 sequence=29 RECID=25 STAMP=852464305

input archived log thread=1 sequence=30 RECID=26 STAMP=853429674

input archived log thread=1 sequence=31 RECID=27 STAMP=853431462

input archived log thread=1 sequence=32 RECID=28 STAMP=853437035

input archived log thread=1 sequence=33 RECID=29 STAMP=853448427

channel ORA_DISK_1: starting piece 1 at 20-JUL-14

channel ORA_DISK_1: finished piece 1 at 20-JUL-14

piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_07_20/o1_mf_annnn_TAG20140720T2100279wqhcdsw.bkp tag=TAG20140720T210027 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26

channel ORA_DISK_1: deleting archived log(s)

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_05/o1_mf_1_59vj2hrk1.arc RECID=1 STAMP=852157306

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_69vppscdl.arc RECID=2 STAMP=852374702

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_79vpzyom3.arc RECID=3 STAMP=852384088

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_89vq0006p.arc RECID=4 STAMP=852384132

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_99vq00or2.arc RECID=5 STAMP=852384155

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_109vq01noz.arc RECID=6 STAMP=852384188

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_119vq02jpc.arc RECID=7 STAMP=852384214

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_129vq049l9.arc RECID=8 STAMP=852384270

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_139vq07lm2.arc RECID=9 STAMP=852384372

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_149vq08t5m.arc RECID=10 STAMP=852384413

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_159vq0b484.arc RECID=11 STAMP=852384454

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_169vq0cgcr.arc RECID=12 STAMP=852384496

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_179vq0dvgv.arc RECID=13 STAMP=852384541

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_08/o1_mf_1_189vq0hlld.arc RECID=14 STAMP=852384629

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信db_bao,谢谢!
Duplicating a Database Without Recovery Catalog or Target Connection后续精彩内容已被小麦苗无情隐藏,请输入验证码解锁本站所有文章!
验证码:
请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“DB宝”或者“www_xmmup_com”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复

嘿,我是小麦,需要帮助随时找我哦。
  • 18509239930
  • 个人微信

  • DB宝
  • 个人邮箱
  • 点击加入QQ群
  • 个人微店

  • 回到顶部