Oracle 11gR2 使用RMAN Duplicate复制数据库_oracle duplicate必须使用spfile启动到nomount吗(2)

EOF

cat >> /home/oracle/.bash_profile <<EOF
export TMP=/tmp
export TMPDIR=$TMP
export EDIT=vi
alias vi=vim
export ORACLE_HOSTNAME= h o s t n a m e e x p o r t O R A C L E U N Q N A M E = hostname export ORACLE_UNQNAME= hostnameexportORACLEUNQNAME=db_name
export ORACLE_BASE=/DBSoft/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.4/dbhome_1
export ORACLE_SID=$instance_name
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA AL32UTF16
umask 022
EOF




  


四、安装软件并创建数据库 


./runInstaller -silent -debug -force -responseFile /home/oracle/database/response/db_install.rsp

dbca -silent -responsefile /home/oracle/database/response/dbca.rsp


  

五、开启归档



SQL> alter system set log_archive_dest_1=‘location=+FRA001/archive’ scope=spfile sid=‘woo1’;

System altered.
SQL> alter database archivelog;

Database altered.
SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA001/archive
Oldest online log sequence 978
Next log sequence to archive 979
Current log sequence 979
SQL> alter system switch logfile;
alter system switch logfile;

System altered.

SQL>

System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA001/archive
Oldest online log sequence 980
Next log sequence to archive 981
Current log sequence 981


  



六、配置静态监听


   RAC节点监听信息如下:



$ cd $ORACLE_HOME/network/admin
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan.woo.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = woo.com)
(ORACLE_HOME = /DBSoft/oracle/product/11.2.0/db_1)
(SID_NAME = woo)
)
)
ADR_BASE_LISTENER = /DBSoft/oracle


  


单节点监听信息如下:



LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.55)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = woo.com)
(ORACLE_HOME = /DBSoft/oracle/product/11.2.0/db_1)
(SID_NAME = woo)
)
)
ADR_BASE_LISTENER = /DBSoft/oracle


  


配置所有节点tnsname信息如下:



WOO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan.woo.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = woo)
)
)

DUPLICATE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.55)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = woo)
)
)


  

六、启动数据库到nomount状态
  



SQL> startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.

Total System Global Area 954155008 bytes
Fixed Size 1368632 bytes
Variable Size 306187720 bytes
Database Buffers 641728512 bytes
Redo Buffers 4870144 bytes
SQL>exit ---------必须退出
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options


  



七、 在RAC端任意节点通过RMAN连接到目标实例和辅助实例,执行duplicate命令复制数据库:



[oracle@db01 ~]$ rman target sys/oracle@woo auxiliary sys/oracle@standby

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jun 3 19:39:00 2015

Copyright © 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: WOO (DBID=4218366793)
connected to auxiliary database: WOO (not mounted)

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

Starting Duplicate Db at 03-JUN-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

contents of Memory Script:
{
sql clone “alter system set db_name =
‘‘WOO’’ comment=
‘‘Modified by RMAN duplicate’’ scope=spfile”;
sql clone “alter system set db_unique_name =
‘‘WOO’’ comment=
‘‘Modified by RMAN duplicate’’ scope=spfile”;
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format ‘/DBSoft/oracle/oradata/woo/control01.ctl’;
restore clone controlfile to ‘/DBSoft/oracle/fast_recovery_area/woo/control02.ctl’ from
‘/DBSoft/oracle/oradata/woo/control01.ctl’;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ‘‘WOO’’ comment= ‘‘Modified by RMAN duplicate’’ scope=spfile

sql statement: alter system set db_unique_name = ‘‘WOO’’ comment= ‘‘Modified by RMAN duplicate’’ scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area 954155008 bytes

Fixed Size 1368632 bytes
Variable Size 306187720 bytes
Database Buffers 641728512 bytes
Redo Buffers 4870144 bytes

Starting backup at 03-JUN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/DBSoft/oracle/product/11.2.4/dbhome_1/dbs/snapcf_woo.f tag=TAG20150603T194000 RECID=3 STAMP=881437202
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
Finished backup at 03-JUN-15

Starting restore at 03-JUN-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 03-JUN-15

database mounted

contents of Memory Script:
{
sql clone ‘alter database flashback off’;
set newname for datafile 1 to
“/DBSoft/oracle/oradata/woo/system01.dbf”;
set newname for datafile 2 to
“/DBSoft/oracle/oradata/woo/sysaux01.dbf”;
set newname for datafile 3 to
“/DBSoft/oracle/oradata/woo/undotbs01.dbf”;
set newname for datafile 4 to
“/DBSoft/oracle/oradata/woo/users01.dbf”;
backup as copy reuse
datafile 1 auxiliary format
“/DBSoft/oracle/oradata/woo/system01.dbf” datafile
2 auxiliary format
“/DBSoft/oracle/oradata/woo/sysaux01.dbf” datafile
3 auxiliary format
“/DBSoft/oracle/oradata/woo/undotbs01.dbf” datafile
4 auxiliary format
“/DBSoft/oracle/oradata/woo/users01.dbf” ;
sql ‘alter system archive log current’;
}
executing Memory Script

sql statement: alter database flashback off

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME
Starting backup at 03-JUN-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/DBSoft/oracle/oradata/woo/system01.dbf
output file name=/DBSoft/oracle/oradata/woo/system01.dbf tag=TAG20150603T194019
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:04:47
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/DBSoft/oracle/oradata/woo/sysaux01.dbf
output file name=/DBSoft/oracle/oradata/woo/sysaux01.dbf tag=TAG20150603T194019
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:03:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/DBSoft/oracle/oradata/woo/undotbs01.dbf
output file name=/DBSoft/oracle/oradata/woo/undotbs01.dbf tag=TAG20150603T194019
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/DBSoft/oracle/oradata/woo/users01.dbf
output file name=/DBSoft/oracle/oradata/woo/users01.dbf tag=TAG20150603T194019
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 03-JUN-15

sql statement: alter system archive log current

contents of Memory Script:
{
backup as copy reuse
archivelog like “/DBArchive/archive/1_63_878860684.dbf” auxiliary format
“/DBArchive2/archive/1_63_878860684.dbf” ;
catalog clone archivelog “/DBArchive2/archive/1_63_878860684.dbf”;
switch clone datafile all;
}
executing Memory Script

Starting backup at 03-JUN-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=63 RECID=38 STAMP=881437711
output file name=/DBArchive2/archive/1_63_878860684.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 03-JUN-15

cataloged archived log
archived log file name=/DBArchive2/archive/1_63_878860684.dbf RECID=38 STAMP=881437696

datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=881437696 file name=/DBSoft/oracle/oradata/woo/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=881437696 file name=/DBSoft/oracle/oradata/woo/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=881437696 file name=/DBSoft/oracle/oradata/woo/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=881437696 file name=/DBSoft/oracle/oradata/woo/users01.dbf

contents of Memory Script:
{
set until scn 1338740;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 03-JUN-15
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 63 is already on disk as file /DBArchive2/archive/1_63_878860684.dbf
archived log file name=/DBArchive2/archive/1_63_878860684.dbf thread=1 sequence=63
media recovery complete, elapsed time: 00:00:00
Finished recover at 03-JUN-15
Oracle instance started

Total System Global Area 954155008 bytes

Fixed Size 1368632 bytes
Variable Size 306187720 bytes
Database Buffers 641728512 bytes
Redo Buffers 4870144 bytes

contents of Memory Script:
{
sql clone “alter system set db_name =
‘‘WOO’’ 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;
}
executing Memory Script

sql statement: alter system set db_name = ‘‘WOO’’ comment= ‘‘Reset to original value by RMAN’’ scope=spfile

最全的Linux教程,Linux从入门到精通

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

  1. linux从入门到精通(第2版)

  2. Linux系统移植

  3. Linux驱动开发入门与实战

  4. LINUX 系统移植 第2版

  5. Linux开源网络全栈详解 从DPDK到OpenFlow

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

第一份《Linux从入门到精通》466页

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

内容简介

====

本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。

需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以点击这里获取!

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 25
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值