采用DUPLICATE 把asm数据库复制到文件系统

0    174    1

Tags:

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

题记: 可以使用rman 的duplicate命令直接把asm存储的数据库复制到文件管理的系统,本文就是基于这样的情况。。。。。

有关rman的另外2篇文章:

http://blog.itpub.net/26736162/viewspace-1223253/

http://blog.itpub.net/26736162/viewspace-1223247/

  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:

采用DUPLICATE 把asm数据库复制到文件系统

简单点就是 ①基于备份 ,而基于备份又分为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. 本次实验原理图

采用DUPLICATE 把asm数据库复制到文件系统

  1. 环境及搭建要求

环境:

  • source host :192.168.59.130 sid:orclasm database:11gR2 文件系统:ASM系统
  • Destination host :192.168.59.135 sid:orcl database:11gR2

注意事项说明:

  • 这里列出source database主要是为了备份
  • 源数据库和辅助数据库的几种不同名称:source/target database ---->>>>>----- (destination host)/duplicate database (auxiliary instance)
  • 源数据库是ASM管理的,目标数据库是文件管理系统的
  • 源数据库开启了数据库闪回,块改变跟踪,属于归档模式
  1. source database环境

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

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 7月 22 11:34:45 2014

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

连接到:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> select * from v$version where rownum=1;

BANNER

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

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

SQL> archive log list;

数据库日志模式 存档模式

自动存档 启用

存档终点 USE_DB_RECOVERY_FILE_DEST

最早的联机日志序列 290

下一个存档日志序列 292

当前日志序列 292

SQL>

采用DUPLICATE 把asm数据库复制到文件系统

select * from v$block_change_tracking;

采用DUPLICATE 把asm数据库复制到文件系统

  1. 对辅助数据库的要求

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

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

[oracle@testdb dbs]$ more ~/.bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

export PATH=$PATH:$HOME/bin

# for oracle user

unset USERNAME

export GLOBAL_DB_UNIQUE_NAME=orcl

export ORACLE_HOSTNAME=192.168.59.135

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.ZHS16GBK"

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'

  1. 正式开始

    1. 前期准备

      1. 建表

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

[oracle@rhel6_lhr dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期二 7月 22 11:44:15 2014

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

连接到:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> set time on;

11:44:15 SQL> SET LONG 99999999;

11:44:15 SQL> set timing on;

11:44:15 SQL> set serveroutput on size 1000000;

11:44:15 SQL> set sqlblanklines on;

11:44:15 SQL> set linesize 800;

11:44:15 SQL> set pagesize 50000;

11:44:15 SQL> set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "

11:44:15 SYS@orclasm>

create table lhr.test_duplicate(id number,text varchar2(20));

insert into lhr.test_duplicate values(1,'a');

insert into lhr.test_duplicate values(2,'b');

commit;

表已创建。

已用时间: 00: 00: 01.22

11:44:17 SYS@orclasm>

已创建 1 行。

已用时间: 00: 00: 00.25

11:44:17 SYS@orclasm>

已创建 1 行。

已用时间: 00: 00: 00.01

11:44:18 SYS@orclasm>

提交完成。

已用时间: 00: 00: 00.00

11:44:18 SYS@orclasm> select * from lhr.test_duplicate;

ID TEXT


1 a

2 b

已用时间: 00: 00: 00.07

11:44:20 SYS@orclasm>

采用DUPLICATE 把asm数据库复制到文件系统

  1. 数据库归档模式

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

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

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 7月 22 11:34:45 2014

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

连接到:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> archive log list;

数据库日志模式 存档模式

自动存档 启用

存档终点 USE_DB_RECOVERY_FILE_DEST

最早的联机日志序列 290

下一个存档日志序列 292

当前日志序列 292

SQL>

  1. 备份数据库

--做个全备份source database并将备份传送到destination database

[oracle@rhel6_lhr dbs]$ rman target /

恢复管理器: Release 11.2.0.3.0 - Production on 星期二 7月 22 11:47:07 2014

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

已连接到目标数据库: ORCLASM (DBID=3424884828)

RMAN> backup as compressed backupset format '/home/oracle/oraclebk/orclasm/full%n%T%t_%s.bak' database plus archivelog delete input;

启动 backup 于 22-7月 -14

当前日志已存档

使用通道 ORA_DISK_1

使用通道 ORA_DISK_2

通道 ORA_DISK_1: 正在启动压缩的归档日志备份集

通道 ORA_DISK_1: 正在指定备份集内的归档日志

输入归档日志线程=1 序列=294 RECID=290 STAMP=853588692

通道 ORA_DISK_1: 正在启动段 1 于 22-7月 -14

通道 ORA_DISK_1: 已完成段 1 于 22-7月 -14

段句柄=/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588692_16.bak 标记=TAG20140722T115812 注释=NONE

通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:01

通道 ORA_DISK_1: 正在删除归档日志

归档日志文件名=+FRA/orclasm/archivelog/2014_07_22/thread_1_seq_294.262.853588693 RECID=290 STAMP=853588692

完成 backup 于 22-7月 -14

启动 backup 于 22-7月 -14

使用通道 ORA_DISK_1

使用通道 ORA_DISK_2

通道 ORA_DISK_1: 正在启动压缩的全部数据文件备份集

通道 ORA_DISK_1: 正在指定备份集内的数据文件

输入数据文件: 文件号=00001 名称=+DATA/orclasm/datafile/system.256.850260145

输入数据文件: 文件号=00002 名称=+DATA/orclasm/datafile/sysaux.257.850260145

输入数据文件: 文件号=00006 名称=+DATA/orclasm/datafile/undotbs2.267.851204361

输入数据文件: 文件号=00007 名称=+DATA/orclasm/datafile/tbs_rc.268.852116523

通道 ORA_DISK_1: 正在启动段 1 于 22-7月 -14

通道 ORA_DISK_2: 正在启动压缩的全部数据文件备份集

通道 ORA_DISK_2: 正在指定备份集内的数据文件

输入数据文件: 文件号=00004 名称=+DATA/orclasm/datafile/users.259.850260147

输入数据文件: 文件号=00005 名称=+DATA/orclasm/datafile/example.265.850260295

输入数据文件: 文件号=00003 名称=+DATA/orclasm/datafile/undotbs1.258.851526539

输入数据文件: 文件号=00008 名称=+DATA/orclasm/datafile/ts_lhr.269.852632495

通道 ORA_DISK_2: 正在启动段 1 于 22-7月 -14

通道 ORA_DISK_1: 已完成段 1 于 22-7月 -14

段句柄=/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588694_17.bak 标记=TAG20140722T115814 注释=NONE

通道 ORA_DISK_1: 备份集已完成, 经过时间:00:02:06

通道 ORA_DISK_2: 已完成段 1 于 22-7月 -14

段句柄=/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588694_18.bak 标记=TAG20140722T115814 注释=NONE

通道 ORA_DISK_2: 备份集已完成, 经过时间:00:02:06

完成 backup 于 22-7月 -14

启动 backup 于 22-7月 -14

当前日志已存档

使用通道 ORA_DISK_1

使用通道 ORA_DISK_2

通道 ORA_DISK_1: 正在启动压缩的归档日志备份集

通道 ORA_DISK_1: 正在指定备份集内的归档日志

输入归档日志线程=1 序列=295 RECID=291 STAMP=853588821

通道 ORA_DISK_1: 正在启动段 1 于 22-7月 -14

通道 ORA_DISK_1: 已完成段 1 于 22-7月 -14

段句柄=/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588823_19.bak 标记=TAG20140722T120022 注释=NONE

通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:01

通道 ORA_DISK_1: 正在删除归档日志

归档日志文件名=+FRA/orclasm/archivelog/2014_07_22/thread_1_seq_295.262.853588821 RECID=291 STAMP=853588821

完成 backup 于 22-7月 -14

启动 Control File Autobackup 于 22-7月 -14

段 handle=/home/oracle/oracle_bk/orclasm/control_c-3424884828-20140722-01.bak comment=NONE

完成 Control File Autobackup 于 22-7月 -14

RMAN> list backup;

备份集列表

===================

BS 关键字 大小 设备类型占用时间 完成时间


15 955.50K DISK 00:00:00 22-7月 -14

BP 关键字: 15 状态: AVAILABLE 已压缩: YES 标记: TAG20140722T115812

段名:/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588692_16.bak

备份集 15 中的已存档日志列表

线程序列 低 SCN 时间下限 下一个 SCN 下一次


1 294 7503944 22-7月 -14 7504825 22-7月 -14

BS 关键字 类型 LV 大小 设备类型 经过时间 完成时间


16 Full 128.61M DISK 00:02:03 22-7月 -14

BP 关键字: 16 状态: AVAILABLE 已压缩: YES 标记: TAG20140722T115814

段名:/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588694_18.bak

备份集 16 中的数据文件列表

文件 LV 类型 Ckp SCN Ckp 时间 名称


3 Full 7504837 22-7月 -14 +DATA/orclasm/datafile/undotbs1.258.851526539

4 Full 7504837 22-7月 -14 +DATA/orclasm/datafile/users.259.850260147

5 Full 7504837 22-7月 -14 +DATA/orclasm/datafile/example.265.850260295

8 Full 7504837 22-7月 -14 +DATA/orclasm/datafile/ts_lhr.269.852632495

BS 关键字 类型 LV 大小 设备类型 经过时间 完成时间


17 Full 328.95M DISK 00:02:04 22-7月 -14

BP 关键字: 17 状态: AVAILABLE 已压缩: YES 标记: TAG20140722T115814

段名:/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588694_17.bak

备份集 17 中的数据文件列表

文件 LV 类型 Ckp SCN Ckp 时间 名称


1 Full 7504835 22-7月 -14 +DATA/orclasm/datafile/system.256.850260145

2 Full 7504835 22-7月 -14 +DATA/orclasm/datafile/sysaux.257.850260145

6 Full 7504835 22-7月 -14 +DATA/orclasm/datafile/undotbs2.267.851204361

7 Full 7504835 22-7月 -14 +DATA/orclasm/datafile/tbs_rc.268.852116523

BS 关键字 大小 设备类型占用时间 完成时间


18 847.50K DISK 00:00:00 22-7月 -14

BP 关键字: 18 状态: AVAILABLE 已压缩: YES 标记: TAG20140722T120022

段名:/home/oracle/oracle_bk/orclasm/full_ORCLASMx_20140722_853588823_19.bak

备份集 18 中的已存档日志列表

线程序列 低 SCN 时间下限 下一个 SCN 下一次


1 295 7504825 22-7月 -14 7505140 22-7月 -14

BS 关键字 类型 LV 大小 设备类型 经过时间 完成时间


19 Full 9.55M DISK 00:00:04 22-7月 -14

BP 关键字: 19 状态: AVAILABLE 已压缩: NO 标记: TAG20140722T120024

段名:/home/oracle/oracle_bk/orclasm/control_c-3424884828-20140722-01.bak

包括的控制文件: Ckp SCN: 7505224 Ckp 时间: 22-7月 -14

RMAN>

查看备份:

采用DUPLICATE 把asm数据库复制到文件系统

  1. 将备份内容拷贝到destination host

[root@rhel6_lhr orclasm]# scp -r /home/oracle/oracle_bk/orclasm/* oracle@192.168.59.135:/home/oracle/ora_bk

oracle@192.168.59.135's password:

control_c-3424884828-20140722-01.bak 100% 9792KB 9.6MB/s 00:00

full_ORCLASMx_20140722_853588692_16.bak 100% 956KB 956.0KB/s 00:00

full_ORCLASMx_20140722_853588694_17.bak 100% 329MB 20.6MB/s 00:16

full_ORCLASMx_20140722_853588694_18.bak 100% 129MB 32.2MB/s 00:04

full_ORCLASMx_20140722_853588823_19.bak 100% 848KB 848.0KB/s 00:00

[root@rhel6_lhr orclasm]#

采用DUPLICATE 把asm数据库复制到文件系统

在destination 库查看,确保已经传递到:

采用DUPLICATE 把asm数据库复制到文件系统

  1. 创建pfile 参数文件

这个步骤也可以在destination host直接创建,指定一个参数db_name 就可以了。。。。不过这样存在一些其它的问题,不推荐。。。。

--在source database生成文本初始化参数文件并传送到destination host

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

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 7月 22 12:11:54 2014

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

连接到:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> create pfile='/tmp/initocl.ora' from spfile;

文件已创建。

SQL>

这里用root用户传送权限不足,需要使用Oracle用户:

[root@rhel6_lhr orclasm]# scp /tmp/initocl.ora oracle@192.168.59.135:$ORACLE_HOME/dbs

oracle@192.168.59.135's password:

scp: /dbs: Permission denied

[root@rhel6_lhr orclasm]# su - oracle

[oracle@rhel6_lhr ~]$ scp /tmp/initocl.ora oracle@192.168.59.135:$ORACLE_HOME/dbs

oracle@192.168.59.135's password:

initocl.ora 100% 1161 1.1KB/s 00:00

[oracle@rhel6_lhr ~]$

采用DUPLICATE 把asm数据库复制到文件系统

确保传递到目的地:

[oracle@testdb dbs]$ cd $ORACLE_HOME/dbs

[oracle@testdb dbs]$ ll

total 4

-rw-r--r--. 1 oracle oinstall 1161 Jul 22 12:16 initocl.ora

[oracle@testdb dbs]$

采用DUPLICATE 把asm数据库复制到文件系统

至此与source database就没有任何关系了。。。。。。。。。

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

这一步至关重要,因为source database 为ASM存储的,而auxiliary instance为filesystem的,所以相关路径应该设置合理。

这里文件名写错了,修改一下,先看看传递过来的文件内容:

[oracle@testdb dbs]$ mv initocl.ora initorcl.ora

[oracle@testdb dbs]$ more initorcl.ora

orclasm.__db_cache_size=96468992

orclasm.__java_pool_size=4194304

orclasm.__large_pool_size=4194304

orclasm.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

orclasm.__pga_aggregate_target=209715200

orclasm.__sga_target=381681664

orclasm.__shared_io_pool_size=0

orclasm.__shared_pool_size=260046848

orclasm.__streams_pool_size=4194304

*.audit_file_dest='/u01/app/oracle/admin/orclasm/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='+DATA/orclasm/controlfile/current.260.850260253','+FRA/orclasm/controlfile/current.256.850260253'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain='lhr.com'

*.db_name='orclasm'

*.db_recovery_file_dest='+FRA'

*.db_recovery_file_dest_size=8589934592

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclasmXDB)'

*.job_queue_processes=1000

*.local_listener='LISTENER_ORCLASM'

*.log_archiveformat='%t%s_%r.dbf'

*.memory_target=588251136

*.O7_DICTIONARY_ACCESSIBILITY=TRUE

*.open_cursors=300

*.optimizer_capture_sql_plan_baselines=TRUE

*.processes=500

*.remote_login_passwordfile='EXCLUSIVE'

*.sessions=500

*.undo_retention=60

*.undo_tablespace='UNDOTBS1'

[oracle@testdb dbs]$

应该修改的几个参数我都用红色标注出来了,修改后的参数为:

[oracle@testdb dbs]$ more initorcl.ora

orcl.__db_cache_size=96468992

orcl.__java_pool_size=4194304

orcl.__large_pool_size=4194304

orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

orcl.__pga_aggregate_target=209715200

orcl.__sga_target=381681664

orcl.__shared_io_pool_size=0

orcl.__shared_pool_size=260046848

orcl.__streams_pool_size=4194304

*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/u01/app/oracle/oradata/control01.ctl','/u01/app/oracle/oradata/control02.ctl'

*.db_block_size=8192

*.db_create_file_dest='/u01/app/oracle/oradata/'

*.db_domain='lhr.com'

*.db_name='orcl'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=8589934592

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

*.job_queue_processes=1000

*.log_archiveformat='%t%s_%r.dbf'

*.memory_target=588251136

*.O7_DICTIONARY_ACCESSIBILITY=TRUE

*.open_cursors=300

*.optimizer_capture_sql_plan_baselines=TRUE

*.processes=500

*.remote_login_passwordfile='EXCLUSIVE'

*.sessions=500

*.undo_retention=60

*.undo_tablespace='UNDOTBS1'

[oracle@testdb dbs]$

创建需要的路径:

[oracle@testdb dbs]$ mkdir -p /u01/app/oracle/admin/orcl/adump

[oracle@testdb dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area

仔细检查,不能马虎的。。。。。。。。。。。。。。。。

  1. 创建密码文件

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

[oracle@testdb dbs]$ ll

total 8

-rw-r--r--. 1 oracle oinstall 1153 Jul 22 12:29 initocl.ora

-rw-r-----. 1 oracle oinstall 1536 Jul 22 12:31 orapworcl

[oracle@testdb dbs]$

采用DUPLICATE 把asm数据库复制到文件系统

  1. 实施数据库的复制

--启动auxiliary instance到nomount状态

  1. 启动Auxiliary 到nomout 状态

[oracle@testdb dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jul 22 12:42:59 2014

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

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 588746752 bytes

Fixed Size 2230592 bytes

Variable Size 482346688 bytes

Database Buffers 96468992 bytes

Redo Buffers 7700480 bytes

SQL>

采用DUPLICATE 把asm数据库复制到文件系统

告警日志:

[oracle@testdb trace]$ more alert_orcl.log

Tue Jul 22 12:43:01 2014

Starting ORACLE instance (normal)

LICENSE_MAX_SESSION = 0

LICENSE_SESSIONS_WARNING = 0

Picked latch-free SCN scheme 3

Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST

Autotune of undo retention is turned on.

IMODE=BR

ILAT =84

LICENSE_MAX_USERS = 0

SYS auditing is disabled

Starting up:

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

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

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

System name: Linux

Node name: testdb

Release: 2.6.32-431.el6.x86_64

Version: #1 SMP Sun Nov 10 22:19:54 EST 2013

Machine: x86_64

VM name: VMWare Version: 6

Using parameter settings in server-side pfile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora

System parameters with non-default values:

processes = 500

sessions = 772

memory_target = 564M

control_files = "/u01/app/oracle/oradata/control01.ctl"

control_files = "/u01/app/oracle/oradata/control02.ctl"

db_block_size = 8192

compatible = "11.2.0.0.0"

log_archiveformat = "%t%s_%r.dbf"

db_create_file_dest = "/u01/app/oracle/oradata/"

db_recovery_file_dest = "/u01/app/oracle/flash_recovery_area"

db_recovery_file_dest_size= 8G

undo_tablespace = "UNDOTBS1"

undo_retention = 60

O7_DICTIONARY_ACCESSIBILITY= TRUE

remote_login_passwordfile= "EXCLUSIVE"

db_domain = "lhr.com"

dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"

job_queue_processes = 1000

audit_file_dest = "/u01/app/oracle/admin/orcl/adump"

audit_trail = "DB"

db_name = "orcl"

open_cursors = 300

optimizer_capture_sql_plan_baselines= TRUE

diagnostic_dest = "/u01/app/oracle"

Tue Jul 22 12:43:02 2014

PMON started with pid=2, OS id=7129

Tue Jul 22 12:43:02 2014

PSP0 started with pid=3, OS id=7131

Tue Jul 22 12:43:03 2014

VKTM started with pid=4, OS id=7133 at elevated priority

VKTM running at (1)millisec precision with DBRM quantum (100)ms

Tue Jul 22 12:43:03 2014

GEN0 started with pid=5, OS id=7137

Tue Jul 22 12:43:03 2014

DIAG started with pid=6, OS id=7139

Tue Jul 22 12:43:03 2014

DBRM started with pid=7, OS id=7141

Tue Jul 22 12:43:04 2014

DIA0 started with pid=8, OS id=7143

Tue Jul 22 12:43:04 2014

MMAN started with pid=9, OS id=7145

Tue Jul 22 12:43:04 2014

DBW0 started with pid=10, OS id=7147

Tue Jul 22 12:43:04 2014

LGWR started with pid=11, OS id=7149

Tue Jul 22 12:43:04 2014

CKPT started with pid=12, OS id=7151

Tue Jul 22 12:43:04 2014

SMON started with pid=13, OS id=7153

Tue Jul 22 12:43:04 2014

RECO started with pid=14, OS id=7155

Tue Jul 22 12:43:04 2014

MMON started with pid=15, OS id=7157

Tue Jul 22 12:43:04 2014

MMNL started with pid=16, OS id=7159

starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...

starting up 1 shared server(s) ...

ORACLE_BASE from environment = /u01/app/oracle

[oracle@testdb trace]$

采用DUPLICATE 把asm数据库复制到文件系统

  1. 连接到auxiliary instance并复制数据库

先准备run块,在source database上:

select 'set newname for datafile '||a.FILE#||' to "'||a.NAME||'";' from v$datafile a

union all

select 'set newname for tempfile '||a.FILE#||' to "'||a.NAME||'";' from v$tempfile a;

采用DUPLICATE 把asm数据库复制到文件系统

修改一下文件名,加入logfile,注意controlfile已经在pfile中指定了:

RUN{

set newname for datafile 1 to "/u01/app/oracle/oradata/system.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/sysaux.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/undotbs1.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/users.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/example.dbf";

set newname for datafile 6 to "/u01/app/oracle/oradata/undotbs2.dbf";

set newname for datafile 7 to "/u01/app/oracle/oradata/tbs_rc.dbf";

set newname for datafile 8 to "/u01/app/oracle/oradata/ts_lhr.dbf";

set newname for tempfile 1 to '/u01/app/oracle/oradata/TEMP01.DBF';

duplicate target database to orcl backup location '/home/oracle/ora_bk' nofilenamecheck

LOGFILE

'/u01/app/oracle/oradata/redo01.log' SIZE 20M,

'/u01/app/oracle/oradata/redo02.log' SIZE 20M,

'/u01/app/oracle/oradata/redo03.log' SIZE 20M;

}

在这里也可以多分配几个通道,加快恢复速度:

RUN{

ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;

ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;

set newname for datafile 1 to "/u01/app/oracle/oradata/system01.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/sysaux01.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/undotbs1.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/users01.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/example.dbf";

set newname for datafile 6 to "/u01/app/oracle/oradata/undotbs2.dbf";

set newname for datafile 7 to "/u01/app/oracle/oradata/tbs_rc.dbf";

set newname for datafile 8 to "/u01/app/oracle/oradata/ts_lhr.dbf";

set newname for tempfile 1 to '/u01/app/oracle/oradata/temp01.DBF';

duplicate target database to orcl backup location '/home/oracle/ora_bk' nofilenamecheck

LOGFILE

'/u01/app/oracle/oradata/redo01.log' SIZE 20M,

'/u01/app/oracle/oradata/redo02.log' SIZE 20M,

'/u01/app/oracle/oradata/redo03.log' SIZE 20M;

}

恢复的时候就是2个通道恢复:

采用DUPLICATE 把asm数据库复制到文件系统

开始:

[oracle@testdb trace]$ rman auxiliary /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jul 22 12:45:25 2014

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

connected to auxiliary database: ORCL (not mounted)

RMAN>

RUN{

set newname for datafile 1 to "/u01/app/oracle/oradata/system.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/sysaux.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/undotbs1.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/users.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/example.dbf";

set newname for datafile 6 to "/u01/app/oracle/oradata/undotbs2.dbf";

set newname for datafile 7 to "/u01/app/oracle/oradata/tbs_rc.dbf";

set newname for datafile 8 to "/u01/app/oracle/oradata/ts_lhr.dbf";

set newname for tempfile 1 to '/u01/app/oracle/oradata/TEMP01.DBF';

duplicate target database to orcl backup location '/home/oracle/ora_bk' nofilenamecheck

LOGFILE

'/u01/app/oracle/oradata/redo01.log' SIZE 20M,

'/u01/app/oracle/oradata/redo02.log' SIZE 20M,

'/u01/app/oracle/oradata/redo03.log' SIZE 20M;

}

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

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

标签:

Avatar photo

小麦苗

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

您可能还喜欢...

发表回复

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

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

  • 回到顶部