NBU ORACLE RAC恢复备份恢复测试.doc

上传人:文库蛋蛋多 文档编号:2394874 上传时间:2023-02-17 格式:DOC 页数:12 大小:74.50KB
返回 下载 相关 举报
NBU ORACLE RAC恢复备份恢复测试.doc_第1页
第1页 / 共12页
NBU ORACLE RAC恢复备份恢复测试.doc_第2页
第2页 / 共12页
NBU ORACLE RAC恢复备份恢复测试.doc_第3页
第3页 / 共12页
NBU ORACLE RAC恢复备份恢复测试.doc_第4页
第4页 / 共12页
NBU ORACLE RAC恢复备份恢复测试.doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《NBU ORACLE RAC恢复备份恢复测试.doc》由会员分享,可在线阅读,更多相关《NBU ORACLE RAC恢复备份恢复测试.doc(12页珍藏版)》请在三一办公上搜索。

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: starting 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=TAG20081230T14151

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号