Duplicating an Active Database

简介: Duplicating an Active Database duplicate体系结构 搞点英语出来吧,英语不好的哥们就好好翻译翻译吧,这段英语是必须看懂的。
  1. Duplicating an Active Database

    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:

 

 

 

 

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

 

  1. 本次实验简介

本次实验就是基于active database的duplicate技术。

Active database duplication 通过网络,直接copy target 库到auxiliary 库,然后创建复制库。 这种方法就不需要先用RMAN 备份数据库,然后将备份文件发送到auxiliary端。这个功能的作用是非常大的。 尤其是对T级别的库。 因为对这样的库进行备份,然后将备份集发送到备库,在进行duplicate 的代价是非常大的。 一备份要占用时间,二要占用备份空间,三在网络传送的时候,还需要占用带宽和时间。所以Active database duplicate 很好的解决了以上的问题。 它对大库的迁移非常有用。

 

  1. 本次实验原理

  1. 环境及搭建要求

环境:

  • 源数据库和目标数据库服务器:RHEL6.5
  • RMAN客户端:windows 7 系统下的rman client
  • source host : 192.168.59.129 sid:orcl database:11gR2
  • Destination host :192.168.59.133 sid:orcl database:11gR2

 

 

注意事项说明:

  • 这里的duplicate database 和 source database 的目录结构完全一样
  • 源数据库和辅助数据库的几种不同名称: source/target database ---->>>>>----- (destination host)/duplicate database (auxiliary instance)
  • 这里我利用了windows下的rman client来连接目标和辅助数据库,当然也可以利用目标库或者辅助库的rman client来操作
  • 目标数据库应该处于归档模式

 

 

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/$ORACLE_SID/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. duplicate database 设置

首先在duplicate database上进行设置:

  1. 创建pfile 参数文件

[oracle@rhel6 ~]$ cd $ORACLE_HOME/dbs

[oracle@rhel6 dbs]$ pwd

/u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@rhel6 dbs]$ ll -h

total 4.0K

-rw-r--r--. 1 oracle oinstall 2.8K May 15 2009 init.ora

[oracle@rhel6 dbs]$ vi initorcl.ora

[oracle@rhel6 dbs]$ more initorcl.ora

DB_NAME=orcl

[oracle@rhel6 dbs]$

截图:

 

  1. 创建密码文件

 

[oracle@rhel6 dbs]$ orapwd file=?/dbs/orapworcl password=lhr

[oracle@rhel6 dbs]$ ll -h

total 12K

-rw-r--r--. 1 oracle oinstall 2.8K May 15 2009 init.ora

-rw-r--r--. 1 oracle oinstall 13 Jul 20 16:03 initorcl.ora

-rw-r-----. 1 oracle oinstall 1.5K Jul 20 16:09 orapworcl

[oracle@rhel6 dbs]$

 

 

  1. 创建和source database的数据文件相关的目录结构

 

[oracle@rhel6 oracle]$ pwd

/u01/app/oracle

[oracle@rhel6 oracle]$ ll

total 8

drwxr-xr-x. 2 oracle oinstall 4096 May 18 17:14 checkpoints

drwxr-xr-x. 3 oracle oinstall 4096 May 18 16:04 product

[oracle@rhel6 oracle]$ mkdir -p /u01/app/oracle/oradata/orcl

[oracle@rhel6 oracle]$

 

 

 

 

不然在duplicate时会报如下错误:

ORA-19505: failed to identify file "/u01/app/oracle/oradata/orcl/users01.dbf"

ORA-27040: file create error, unable to create file

 

 

 

  1. 启动Auxiliary 到nomout 状态

[oracle@rhel6 ~]$ sqlplus / as sysdba

 

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

 

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

 

Connected to an idle instance.

 

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area 217157632 bytes

Fixed Size         2211928 bytes

Variable Size         159387560 bytes

Database Buffers     50331648 bytes

Redo Buffers         5226496 bytes

SQL>

 

 

 

  1. 在Target 和Auxiliary 都配置Oracle Net(Listener.ora and tnsnames.ora)

 

注意:

  • 对于Listener.ora 的配置需要配置成 静态监听,何谓静态监听???哈哈百度吧。。。。
  • target和auxiliary都需要配置listener.ora和tnsnames.ora
  • 如果rman client不在target和auxiliary库上,那么也应该配置tnsnames.ora的

 

target database配置:

[oracle@rhel6 admin]$ more listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = orcl.lhr.com)

(SID_NAME = orcl)

(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

)

(SID_DESC =

(GLOBAL_DBNAME = rman.lhr.com)

(SID_NAME = rman)

(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

)

)

[oracle@rhel6 admin]$ more tnsnames.ora

orcl =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl.lhr.com)

)

)

lhr_dup =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.133)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

 

 

 

 

auxiliary database 配置:

[oracle@rhel6 admin]$ more listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.133)(PORT = 1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = orcl)

(SID_NAME = orcl)

(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

)

)

 

 

ADR_BASE_LISTENER = /u01/app/oracle

[oracle@rhel6 admin]$ more tnsnames.ora

orcl =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl.lhr.com)

)

)

lhr_dup =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.133)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

 

  1. 测试网络是否配置好

 

配置好网络后,首先测试一下源数据库和duplicate数据库是否可以连接上,如果不能正常连接说明listener和tnsnames没有配置正确:

----------------源数据库

C:\Users\Administrator>sqlplus sys/lhr@orcl as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 7月 20 17:55:58 2014

 

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

 

 

连接到:

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>exit

 

 

 

----------------duplicate数据库

 

C:\Users\Administrator>sqlplus sys/lhr@lhr_dup as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 7月 20 17:41:28 2014

 

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

 

 

连接到:

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> exit

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

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

 

 

 

如果没有配置好的话,可能在后边执行duplicate命令的时候报错:

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: Duplicate Db 命令 (在 07/20/2014 17:28:11 上) 失败

RMAN-03015: 在存储的脚本Memory Script中出现错误

RMAN-03009: backup 命令 (ORA_DISK_1 通道上, 在 07/20/2014 17:28:11 上) 失败

ORA-17629: 无法连接到远程数据库服务器

ORA-17627: ORA-12154: TNS: 无法解析指定的连接标识符

ORA-17629: 无法连接到远程数据库服务器

 

 

 

 

  1. 开始RMAN duplicate from active database

 

 

 

注意:如果target 和 Auxiliary库的目录结构相同,记得加上nofilenamecheck参数,不然会报如下错误:

RMAN-05001: auxiliary file name /u01/app/oracle/oradata/orcl/users01.dbf conflicts with a file used by the target database

 

 

这里我利用的是本机电脑,即windows 7 系统上的rman client 来演示的。。。。。

 

C:\Users\Administrator>rman target sys/lhr@orcl auxiliary sys/lhr@lhr_dup

 

恢复管理器: Release 11.2.0.1.0 - Production on 星期日 7月 20 17:46:11 2014

 

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

 

连接到目标数据库: ORCL (DBID=1379935487)

已连接到辅助数据库: ORCL (未装载)

 

RMAN> duplicate target database to orcl from active database nofilenamecheck;

 

启动 Duplicate Db 于 20-7月 -14

使用目标数据库控制文件替代恢复目录

分配的通道: ORA_AUX_DISK_1

通道 ORA_AUX_DISK_1: SID=19 设备类型=DISK

 

内存脚本的内容:

{

sql clone "alter system set db_name =

''ORCL'' comment=

''Modified by RMAN duplicate'' scope=spfile";

sql clone "alter system set db_unique_name =

''ORCL'' comment=

''Modified by RMAN duplicate'' scope=spfile";

shutdown clone immediate;

startup clone force nomount

backup as copy current controlfile auxiliary format '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/cntrlorcl.dbf';

alter clone database mount;

}

正在执行内存脚本

 

sql 语句: alter system set db_name = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile

 

sql 语句: alter system set db_unique_name = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile

 

Oracle 实例已关闭

 

Oracle 实例已启动

 

系统全局区域总计 217157632 字节

 

Fixed Size 2211928 字节

Variable Size 159387560 字节

Database Buffers 50331648 字节

Redo Buffers 5226496 字节

 

启动 backup 于 20-7月 -14

分配的通道: ORA_DISK_1

通道 ORA_DISK_1: SID=47 设备类型=DISK

通道 ORA_DISK_1: 启动数据文件副本

复制当前控制文件

输出文件名=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f 标记=TAG20140720T174646 RECID=2 STAMP=853436808

通道 ORA_DISK_1: 数据文件复制完毕, 经过时间: 00:00:07

完成 backup 于 20-7月 -14

 

数据库已装载

 

内存脚本的内容:

{

set newname for datafile 1 to

"/u01/app/oracle/oradata/orcl/system01.dbf";

set newname for datafile 2 to

"/u01/app/oracle/oradata/orcl/sysaux01.dbf";

set newname for datafile 3 to

"/u01/app/oracle/oradata/orcl/undotbs01.dbf";

set newname for datafile 4 to

"/u01/app/oracle/oradata/orcl/users01.dbf";

set newname for datafile 5 to

"/u01/app/oracle/oradata/orcl/example01.dbf";

backup as copy reuse

datafile 1 auxiliary format

"/u01/app/oracle/oradata/orcl/system01.dbf" datafile

2 auxiliary format

"/u01/app/oracle/oradata/orcl/sysaux01.dbf" datafile

3 auxiliary format

"/u01/app/oracle/oradata/orcl/undotbs01.dbf" datafile

4 auxiliary format

"/u01/app/oracle/oradata/orcl/users01.dbf" datafile

5 auxiliary format

"/u01/app/oracle/oradata/orcl/example01.dbf" ;

sql 'alter system archive log current';

}

正在执行内存脚本

 

正在执行命令: SET NEWNAME

 

正在执行命令: SET NEWNAME

 

正在执行命令: SET NEWNAME

 

正在执行命令: SET NEWNAME

 

正在执行命令: SET NEWNAME

 

启动 backup 于 20-7月 -14

使用通道 ORA_DISK_1

通道 ORA_DISK_1: 启动数据文件副本

输入数据文件: 文件号=00001 名称=/u01/app/oracle/oradata/orcl/system01.dbf

输出文件名=/u01/app/oracle/oradata/orcl/system01.dbf 标记=TAG20140720T174700

通道 ORA_DISK_1: 数据文件复制完毕, 经过时间: 00:01:35

通道 ORA_DISK_1: 启动数据文件副本

输入数据文件: 文件号=00002 名称=/u01/app/oracle/oradata/orcl/sysaux01.dbf

输出文件名=/u01/app/oracle/oradata/orcl/sysaux01.dbf 标记=TAG20140720T174700

通道 ORA_DISK_1: 数据文件复制完毕, 经过时间: 00:01:06

通道 ORA_DISK_1: 启动数据文件副本

输入数据文件: 文件号=00003 名称=/u01/app/oracle/oradata/orcl/undotbs01.dbf

输出文件名=/u01/app/oracle/oradata/orcl/undotbs01.dbf 标记=TAG20140720T174700

通道 ORA_DISK_1: 数据文件复制完毕, 经过时间: 00:00:35

通道 ORA_DISK_1: 启动数据文件副本

输入数据文件: 文件号=00005 名称=/u01/app/oracle/oradata/orcl/example01.dbf

输出文件名=/u01/app/oracle/oradata/orcl/example01.dbf 标记=TAG20140720T174700

通道 ORA_DISK_1: 数据文件复制完毕, 经过时间: 00:00:15

通道 ORA_DISK_1: 启动数据文件副本

输入数据文件: 文件号=00004 名称=/u01/app/oracle/oradata/orcl/users01.dbf

输出文件名=/u01/app/oracle/oradata/orcl/users01.dbf 标记=TAG20140720T174700

通道 ORA_DISK_1: 数据文件复制完毕, 经过时间: 00:00:03

完成 backup 于 20-7月 -14

 

sql 语句: alter system archive log current

 

内存脚本的内容:

{

backup as copy reuse

archivelog like "/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2014_07_20/o1_mf_1_32_9wq47c1r_.arc" auxiliary format

"/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_32_852154753.dbf" ;

catalog clone archivelog "/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_32_852154753.dbf";

switch clone datafile all;

}

正在执行内存脚本

 

启动 backup 于 20-7月 -14

使用通道 ORA_DISK_1

通道 ORA_DISK_1: 正在开始复制归档日志

输入归档日志线程=1 序列=32 RECID=28 STAMP=853437035

输出文件名=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_32_852154753.dbf RECID=0 STAMP=0

通道 ORA_DISK_1: 归档日志复制完成, 经过时间: 00:00:03

完成 backup 于 20-7月 -14

 

已编目的归档日志

归档日志文件名=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_32_852154753.dbf RECID=28 STAMP=853437039

 

数据文件 1 已转换成数据文件副本

输入数据文件副本 RECID=2 STAMP=853437039 文件名=/u01/app/oracle/oradata/orcl/system01.dbf

数据文件 2 已转换成数据文件副本

输入数据文件副本 RECID=3 STAMP=853437039 文件名=/u01/app/oracle/oradata/orcl/sysaux01.dbf

数据文件 3 已转换成数据文件副本

输入数据文件副本 RECID=4 STAMP=853437039 文件名=/u01/app/oracle/oradata/orcl/undotbs01.dbf

数据文件 4 已转换成数据文件副本

输入数据文件副本 RECID=5 STAMP=853437039 文件名=/u01/app/oracle/oradata/orcl/users01.dbf

数据文件 5 已转换成数据文件副本

输入数据文件副本 RECID=6 STAMP=853437039 文件名=/u01/app/oracle/oradata/orcl/example01.dbf

 

内存脚本的内容:

{

set until scn 1397315;

recover

clone database

delete archivelog

;

}

正在执行内存脚本

 

正在执行命令: SET until clause

 

启动 recover 于 20-7月 -14

分配的通道: ORA_AUX_DISK_1

通道 ORA_AUX_DISK_1: SID=18 设备类型=DISK

 

正在开始介质的恢复

 

线程 1 序列 32 的归档日志已作为文件 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_32_852154753.dbf 存在于磁盘上

归档日志文件名=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_32_852154753.dbf 线程=1 序列=32

介质恢复完成, 用时: 00:00:00

完成 recover 于 20-7月 -14

 

内存脚本的内容:

{

shutdown clone immediate;

startup clone nomount;

sql clone "alter system set db_name =

''ORCL'' comment=

''Reset to original value by RMAN'' scope=spfile";

sql clone "alter system reset db_unique_name scope=spfile";

shutdown clone immediate;

startup clone nomount;

}

正在执行内存脚本

 

数据库已卸装

Oracle 实例已关闭

 

已连接到辅助数据库 (未启动)

Oracle 实例已启动

 

系统全局区域总计 217157632 字节

 

Fixed Size 2211928 字节

Variable Size 159387560 字节

Database Buffers 50331648 字节

Redo Buffers 5226496 字节

 

sql 语句: alter system set db_name = ''ORCL'' comment= ''Reset to original value by RMAN'' scope=spfile

 

sql 语句: alter system reset db_unique_name scope=spfile

 

Oracle 实例已关闭

 

已连接到辅助数据库 (未启动)

Oracle 实例已启动

 

系统全局区域总计 217157632 字节

 

Fixed Size 2211928 字节

Variable Size 159387560 字节

Database Buffers 50331648 字节

Redo Buffers 5226496 字节

sql 语句: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1 ( '/u01/app/oracle/oradata/orcl/redo01.log' ) SIZE 50 M REUSE,

GROUP 2 ( '/u01/app/oracle/oradata/orcl/redo02.log' ) SIZE 50 M REUSE,

GROUP 3 ( '/u01/app/oracle/oradata/orcl/redo03.log' ) SIZE 50 M REUSE

DATAFILE

'/u01/app/oracle/oradata/orcl/system01.dbf'

CHARACTER SET ZHS16GBK

 

 

内存脚本的内容:

{

set newname for tempfile 1 to

"/u01/app/oracle/oradata/orcl/temp01.dbf";

switch clone tempfile all;

catalog clone datafilecopy "/u01/app/oracle/oradata/orcl/sysaux01.dbf",

"/u01/app/oracle/oradata/orcl/undotbs01.dbf",

"/u01/app/oracle/oradata/orcl/users01.dbf",

"/u01/app/oracle/oradata/orcl/example01.dbf";

switch clone datafile all;

}

正在执行内存脚本

 

正在执行命令: SET NEWNAME

 

临时文件 1 在控制文件中已重命名为 /u01/app/oracle/oradata/orcl/temp01.dbf

 

已将数据文件副本列入目录

数据文件副本文件名=/u01/app/oracle/oradata/orcl/sysaux01.dbf RECID=1 STAMP=853437064

已将数据文件副本列入目录

数据文件副本文件名=/u01/app/oracle/oradata/orcl/undotbs01.dbf RECID=2 STAMP=853437064

已将数据文件副本列入目录

数据文件副本文件名=/u01/app/oracle/oradata/orcl/users01.dbf RECID=3 STAMP=853437064

已将数据文件副本列入目录

数据文件副本文件名=/u01/app/oracle/oradata/orcl/example01.dbf RECID=4 STAMP=853437064

 

数据文件 2 已转换成数据文件副本

输入数据文件副本 RECID=1 STAMP=853437064 文件名=/u01/app/oracle/oradata/orcl/sysaux01.dbf

数据文件 3 已转换成数据文件副本

输入数据文件副本 RECID=2 STAMP=853437064 文件名=/u01/app/oracle/oradata/orcl/undotbs01.dbf

数据文件 4 已转换成数据文件副本

输入数据文件副本 RECID=3 STAMP=853437064 文件名=/u01/app/oracle/oradata/orcl/users01.dbf

数据文件 5 已转换成数据文件副本

输入数据文件副本 RECID=4 STAMP=853437064 文件名=/u01/app/oracle/oradata/orcl/example01.dbf

 

内存脚本的内容:

{

Alter clone database open resetlogs;

}

正在执行内存脚本

 

数据库已打开

完成 Duplicate Db 于 20-7月 -14

 

RMAN>

 

 

测试一下dbid:

C:\Users\Administrator>sqlplus sys/lhr@orcl as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 7月 20 17:55:58 2014

 

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

 

 

连接到:

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> select name,dbid from v$database;

 

NAME DBID

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

ORCL 1379935487

 

SQL> conn sys/lhr@lhr_dup as sysdba

已连接。

SQL> select name,dbid from v$database;

 

NAME DBID

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

ORCL 1381217798

 

SQL>

 

 

 

 

 

 

 

 

  1. drop database

删掉数据库准备做其它实验:

 

SQL> shutdown abort

ORACLE instance shut down.

SQL> startup mount restrict;

ORACLE instance started.

 

Total System Global Area 217157632 bytes

Fixed Size         2211928 bytes

Variable Size         159387560 bytes

Database Buffers     50331648 bytes

Redo Buffers         5226496 bytes

Database mounted.

SQL> exit

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

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

[oracle@rhel6 orcl]$ rman target /

 

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

 

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

 

connected to target database: ORCL (DBID=1381217798, not open)

 

RMAN> drop database;

 

database name is "ORCL" and DBID is 1381217798

 

Do you really want to drop the database (enter YES or NO)? yes

database dropped

 

RMAN>

相关实践学习
数据库实验室挑战任务-初级任务
本场景介绍如何开通属于你的免费云数据库,在RDS-MySQL中完成对学生成绩的详情查询,执行指定类型SQL。
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
3月前
|
数据库
Greenplum【部署 09】has an active database process on port = 6000 和 [Errno 2] No such file or directory
Greenplum【部署 09】has an active database process on port = 6000 和 [Errno 2] No such file or directory
29 0
|
数据库
Duplicating a Database
Duplicating a Database
151 0
Duplicating a Database
|
SQL Oracle 网络协议
|
Oracle 网络协议 关系型数据库
Oracle Active database duplication
001 理论基础 active database duplication :A duplicate database that is created over a network without restoring backups of the target database. This technique is an alternative to backup-based duplication. 意即:duplicate数据库不需要通过还原目标数据库的备份,而是直接通过网络而创建。
832 0

热门文章

最新文章