NBU ORACLE RAC恢复备份恢复测试_第1页
NBU ORACLE RAC恢复备份恢复测试_第2页
NBU ORACLE RAC恢复备份恢复测试_第3页
NBU ORACLE RAC恢复备份恢复测试_第4页
NBU ORACLE RAC恢复备份恢复测试_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、附件一、oracle备份测试脚本1、 rac oracle备份脚本(对nbu模板作出修改的部分已红色标识)#!/bin/sh# $header: hot_database_backup.sh,v 1.2 2002/08/06 23:51:42 $#bcpyrght#*#* $vrtscprght: copyright 1993 - 2007 symantec corporation, all rights reserved $ *#*#ecpyrght# -# hot_database_backup.sh# -# this script uses recovery manager to tak

2、e a hot (inconsistent) database# backup. a hot backup is inconsistent because portions of the database are# being modified and written to the disk while the backup is progressing.# you must run your database in archivelog mode to make hot backups. it is# assumed that this script will be executed by

3、user root. in order for rman# to work properly we switch user (su -) to the oracle dba account before# execution. if this script runs under a user account that has oracle dba# privilege, it will be executed using this users account.# -# -# determine the user which is executing this script.# - cuser=

4、id |cut -d( -f2 | cut -d ) -f1 # -# put output in .out. change as desired.# note: output directory requires write permission.# -rman_log_file=$0.out# -# you may want to delete the output file so that backup information does# not accumulate. if not, delete the following lines.# -if -f $rman_log_file

5、thenrm -f $rman_log_filefi# -# initialize the log file.# - echo $rman_log_filechmod 666 $rman_log_file # -# log the start of this script.# - echo script $0 $rman_log_fileecho = started on date = $rman_log_fileecho $rman_log_file # -# replace /db/oracle/product/ora81, below, with the oracle home path

6、.# -oracle_home=/oracle/product/db/10.2export oracle_home# -# replace ora81, below, with the oracle sid of the target database.# -oracle_sid=gzyx1export oracle_sid# -# replace ora81, below, with the oracle dba user id (account).# -oracle_user=oracle# -# set the target connect string.# replace sys/ma

7、nager, below, with the target connect string.# -target_connect_str=/ # -# set the oracle recovery manager name.# -rman=$oracle_home/bin/rman# -# print out the value of the variables set by this script.# -echo $rman_log_fileecho rman: $rman $rman_log_fileecho oracle_sid: $oracle_sid $rman_log_fileech

8、o oracle_user: $oracle_user $rman_log_fileecho oracle_home: $oracle_home $rman_log_file# -# print out the value of the variables set by bphdb.# -echo $rman_log_fileecho nb_ora_full: $nb_ora_full $rman_log_fileecho nb_ora_incr: $nb_ora_incr $rman_log_fileecho nb_ora_cinc: $nb_ora_cinc $rman_log_filee

9、cho nb_ora_serv: $nb_ora_serv $rman_log_fileecho nb_ora_policy: $nb_ora_policy $rman_log_file# -# note: this script assumes that the database is properly opened. if desired,# this would be the place to verify that.# -echo $rman_log_file# -# if this script is executed from a netbackup schedule, netba

10、ckup# sets an nb_ora environment variable based on the schedule type.# the nb_ora variable is then used to dynamically set backup_type# for example, when:# schedule type is backup_type is# - -# automatic full incremental level=0# automatic differential incremental incremental level=1# automatic cumu

11、lative incremental incremental level=1 cumulative# # for user initiated backups, backup_type defaults to incremental# level 0 (full). to change the default for a user initiated# backup to incremental or incremental cumulative, uncomment# one of the following two lines.# backup_type=incremental level

12、=1# backup_type=incremental level=1 cumulative# # note that we use incremental level 0 to specify full backups.# that is because, although they are identical in content, only# the incremental level 0 backup can have incremental backups of# level 0 applied to it.# - if $nb_ora_full = 1 then echo full

13、 backup requested $rman_log_file backup_type=incremental level=0 elif $nb_ora_incr = 1 then echo differential incremental backup requested $rman_log_file backup_type=incremental level=1 elif $nb_ora_cinc = 1 then echo cumulative incremental backup requested $rman_log_file backup_type=incremental lev

14、el=1 cumulative elif $backup_type = then echo default - full backup requested $rman_log_file backup_type=incremental level=0fi# -# call recovery manager to initiate the backup. this example does not use a# recovery catalog. if you choose to use one, replace the option nocatalog# from the rman comman

15、d line below with the # rcvcat / statement.# note: any environment variables needed at run time by rman # must be set and exported within the switch user (su) command.# -# backs up the whole database. this backup is part of the incremental# strategy (this means it can have incremental backups of lev

16、els 0# applied to it).# we do not need to explicitly request the control file to be included# in this backup, as it is automatically included each time file 1 of# the system tablespace is backed up (the inference: as it is a whole# database backup, file 1 of the system tablespace will be backed up,#

17、 hence the controlfile will also be included automatically).# typically, a level 0 backup would be done at least once a week.# the scenario assumes:# o you are backing your database up to two tape drives# o you want each backup set to include a maximum of 5 files# o you wish to include offline dataf

18、iles, and read-only tablespaces,# in the backup# o you want the backup to continue if any files are inaccessible.# o you are not using a recovery catalog# o you are explicitly backing up the control file. since you are# specifying nocatalog, the controlfile backup that occurs# automatically as the r

19、esult of backing up the system file is# not sufficient; it will not contain records for the backup that# is currently in progress.# o you want to archive the current log, back up all the# archive logs using two channels, putting a maximum of 20 logs# in a backup set, and deleting them once the backu

20、p is complete.# note that the format string is constructed to guarantee uniqueness and# to enhance netbackup for oracle backup and restore performance.# note when using tns alias: when connecting to a database# using a tns alias, you must use a send command or a parms operand to # specify environmen

21、t variables. in other words, when accessing a database# through a listener, the environment variables set at the system level are not # visible when rman is running. for more information on the environment# variables, please refer to the netbackup for oracle admin. guide.# -cmd_str=oracle_home=$orac

22、le_homeexport oracle_homeoracle_sid=$oracle_sidexport oracle_sid$rman target $target_connect_str rcvcat rman/rmanscdbixp msglog $rman_log_file append $rman_log_file rstat=$?else /usr/bin/sh -c $cmd_str $rman_log_file rstat=$?fi # -# log the completion of this script.# - if $rstat = 0 then logmsg=end

23、ed successfullyelse logmsg=ended in errorfi echo $rman_log_fileecho script $0 $rman_log_fileecho = $logmsg on date = $rman_log_fileecho $rman_log_file exit $rstat附件二、oracle恢复测试步骤假设已经搭建好同平台的数据库测试环境:备份源主机名:scdbdb01恢复目标主机名:scdbtrnsvr备份服务器主机名:erpbackupsvr2数据库sid:gzyx(rac的服务名)本次恢复是把原建立在裸设备的rac数据恢复到异机的文件系

24、统,具体恢复过程如下:1、 在测试主机上安装nbu备份客户端和oracle备份代理。2、 创建一个测试用的initgzyx.ora文件。3、 开始恢复。以下均有恢复拷屏所得(具体输入的命令语句已红色标识)# su - oracle(c)copyright 1983-2006 hewlett-packard development company, l.p.(c)copyright 1979, 1980, 1983, 1985-1993 the regents of the univ. of california(c)copyright 1980, 1984, 1986 novell, inc.

25、(c)copyright 1986-2000 sun microsystems, inc.(c)copyright 1985, 1986, 1988 massachusetts institute of technology(c)copyright 1989-1993 the open software foundation, inc.(c)copyright 1990 motorola, inc.(c)copyright 1990, 1991, 1992 cornell university(c)copyright 1989-1991 the university of maryland(c

26、)copyright 1988 carnegie mellon university(c)copyright 1991-2006 mentat inc.(c)copyright 1996 morning star technologies, inc.(c)copyright 1996 progressive systems, inc.confidential computer software. valid license from hp required forpossession, use or copying. consistent with far 12.211 and 12.212,

27、commercial computer software, computer software documentation, andtechnical data for commercial items are licensed to the u.s. governmentunder vendors standard commercial license.scdbtrnsvr/oracle$sqlplus /nologsql*plus: release 10.2.0.4.0 - production on tue dec 30 17:41:21 2008copyright (c) 1982,

28、2007, oracle. all rights reserved.sql connect / as sysdbaconnected to an idle instance.sql startup nomount pfile=/oracle/initgzyx.oraoracle instance started.total system global area 1.0737e+10 bytesfixed size 2073976 bytesvariable size 1560283784 bytesdatabase buffers 9160359936 bytesredo buffers 14

29、700544 bytessql exitdisconnected from oracle database 10g enterprise edition release 10.2.0.4.0 - 64bit productionwith the partitioning, olap, data mining and real application testing optionsscdbtrnsvr/oracle$rman rcvcat rman/rmanscdbixprecovery manager: release 10.2.0.4.0 - production on tue dec 30

30、 17:42:34 2008copyright (c) 1982, 2007, oracle. all rights reserved.connected to recovery catalog databaserman set dbid=3984429810executing command: set dbiddatabase name is gzyx and dbid is 3984429810rman connect target /connected to target database: gzyx (not mounted)恢复控制文件rman run allocate channe

31、l ch00 type sbt_tape;send nb_ora_serv=erpbackupsvr2, nb_ora_client=scdbdb01;restore controlfile;allocated channel: ch00channel ch00: sid=1641 devtype=sbt_tapechannel ch00: veritas netbackup for oracle - release 6.5 (2007111606)sent command to channel: ch00starting restore at 30-dec-08channel ch00: s

32、tarting datafile backupset restorechannel ch00: restoring control filechannel ch00: reading from backup piece c-3984429810-20081230-01channel ch00: restored backup piece 1piece handle=c-3984429810-20081230-01 tag=tag20081230t141517channel ch00: restore complete, elapsed time: 00:01:36output filename

33、=/app01/oradata/gzyx/control01.ctloutput filename=/app01/oradata/gzyx/control02.ctloutput filename=/app01/oradata/gzyx/control03.ctlfinished restore at 30-dec-08released channel: ch00rman alter database mount;database mountedrman rman exitrecovery manager complete.scdbtrnsvr/oracle$orapwd file=$orac

34、le_home/dbs/orapwgzyx password=oraclescdbtrnsvr/oracle$rman rcvcat rman/rmanscdbixprecovery manager: release 10.2.0.4.0 - production on tue dec 30 17:56:07 2008copyright (c) 1982, 2007, oracle. all rights reserved.connected to recovery catalog databaserman set dbid=3984429810executing command: set d

35、biddatabase name is gzyx and dbid is 3984429810rman connect target /connected to target database: gzyx (dbid=3984429810, not open)恢复数据文件rman run 2 allocate channel ch00 type sbt_tape;3 allocate channel ch01 type sbt_tape;4 send nb_ora_serv=erpbackupsvr2, nb_ora_client=scdbdb01;5 set newname for data

36、file 1 to /app01/oradata/gzyx/datafile01.dbf;6 set newname for datafile 2 to /app01/oradata/gzyx/datafile02.dbf;7 set newname for datafile 3 to /app01/oradata/gzyx/datafile03.dbf;8 set newname for datafile 4 to /app01/oradata/gzyx/datafile04.dbf;9 set newname for datafile 5 to /app01/oradata/gzyx/da

37、tafile05.dbf;10 set newname for datafile 6 to /app01/oradata/gzyx/datafile06.dbf;11 set newname for datafile 7 to /app01/oradata/gzyx/datafile07.dbf;12 set newname for datafile 8 to /app01/oradata/gzyx/datafile08.dbf;13 set newname for datafile 9 to /app01/oradata/gzyx/datafile09.dbf;14 set newname

38、for datafile 10 to /app01/oradata/gzyx/datafile10.dbf;15 set newname for datafile 11 to /app01/oradata/gzyx/datafile11.dbf;16 set newname for datafile 12 to /app01/oradata/gzyx/datafile12.dbf;17 set newname for datafile 13 to /app01/oradata/gzyx/datafile13.dbf;18 set newname for datafile 14 to /app0

39、1/oradata/gzyx/datafile14.dbf;19 set newname for datafile 15 to /app01/oradata/gzyx/datafile15.dbf;20 set newname for datafile 16 to /app01/oradata/gzyx/datafile16.dbf;21 set newname for datafile 17 to /app01/oradata/gzyx/datafile17.dbf;22 set newname for datafile 18 to /app01/oradata/gzyx/datafile1

40、8.dbf;23 set newname for datafile 19 to /app01/oradata/gzyx/datafile19.dbf;24 set newname for datafile 20 to /app01/oradata/gzyx/datafile20.dbf;25 set newname for datafile 21 to /app01/oradata/gzyx/datafile21.dbf;26 set newname for datafile 22 to /app01/oradata/gzyx/datafile22.dbf;27 set newname for

41、 datafile 23 to /app01/oradata/gzyx/datafile23.dbf;28 set newname for datafile 24 to /app01/oradata/gzyx/datafile24.dbf;29 set newname for datafile 25 to /app01/oradata/gzyx/datafile25.dbf;30 set newname for datafile 26 to /app01/oradata/gzyx/datafile26.dbf;31 set newname for datafile 27 to /app01/o

42、radata/gzyx/datafile27.dbf;32 set newname for datafile 28 to /app01/oradata/gzyx/datafile28.dbf;33 set newname for datafile 29 to /app01/oradata/gzyx/datafile29.dbf;34 set newname for datafile 30 to /app01/oradata/gzyx/datafile30.dbf;35 set newname for datafile 31 to /app01/oradata/gzyx/datafile31.dbf;36 set newname for datafile 32 to /app01/oradata/gzyx/datafile32.dbf;37 set newname for datafile 33 to /app01/oradata/gzyx/datafile33.dbf;38 s

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论