一、 NBU for Oracle 安装
安装master server
1、改/etc/hosts文件,添加本备份系统内所有主机的IP地址和主机名,因为NBU是根据主机名来查找主机。
2、确保media server所在主机上/dev/rmt目录下能看到磁带机信息。最好是能在磁带机内放一盘磁带并用tar命令确认能向磁带机写数据。 3、将介质放在光驱内 #cd /cdrom/cdrom0 #./install
选择安装Netbackup,根据提示继续。在安装过程中,会问到“此主机是不是master server\",安装master server时就答yes,安装media server时答no,并根据提示输入master server的主机名。
注意 在集群环境中,请在安装过程中输入 NetBackup client的虚拟名称而不是实际的本地主机名.
4、为方便使用,在root 的profile 中加入
PATH=$PATH:/usr/openv/netbackup/bin:/usr/openv/netbackup/bin/admincmd:/usr/openv/netbackup/bin/goodies:/usr/openv/volmgr/bin:/usr/openv/volmgr/bin/goodies MANPATH=$MANPATH:/usr/openv/man/share/man export MAN MANPATH
安装client 和 agent 1、将介质放入光驱 #cd /cdrom/cdrom0 #./install
在提示输入server名字时输入master server的名字。
2、修改/usr/openv/netbackup/bp.conf文件,在第一行的“SERVER = XXXXX”下面按照此格式增加其他media server的名字,有几台media server就增加几行。 3、把agent介质放入光驱 #cd /cdrom/cdrom0 #。/install
注意打上agent的补丁,我这次测试oracle9i时,发现不打agent补丁无法,备份保错。 注意需要执行一条命令建立RMAN和NBU之间的联系 # su – oracle
$ install_path/netbackup/bin/oracle_link
二、 配置RMAN
我此次数据库的一些参数,下面的描述都以这些参数为例子,以后可以根据不同参数修改命令和脚本。
ORACLE_HOME=/oracle/product/9。2.0 ORACLE_SID=db ORACLE_USER=oracle
TARGET_CONNECT_STR=system/manager2
1. 测试RMAN是否正常运行 # su – oracle
$ sqlplus ‘/as sysdba’
SQL〉 startup;
ORACLE instance started。
Total System Global Area 838860800 bytes Fixed Size 781424 bytes
Variable Size 221254544 bytes Database Buffers 616562688 bytes
Redo Buffers 262144 bytes Database mounted. Database opened. SQL〉 exit
$ rman nocatalog
RMAN〉connect target
RMAN〉connect target system/manager2@db
连接正常,不报错,表示RMAN正常运行。这次由于客户oracle补丁打的有问题,RMAN一直不正常,可以在配置RMAN前先测试一下RMAN的状态.
2. 配置RMAN for NBU
创建一个instance vertias 用来存放catalog库.Instance名字可以随便起 $ dbca 用dbca工具创建 创建catalog库
/////////////我7.06以上做了但补丁未打////////////////// $ drtias
$ sqlplus ‘/as sysdba' SQL>startup;
SQL>create tablespace rcvcat datafile ‘/oradata/veritas/rcvcat01.dbf’ size 100M extent management local segment space management auto;
SQL>create user rman identified by rman default tablespace rcvcat temporary tablespace temp quota unlimited on rcvcat;
SQL>grant connect,resorce,recovery_catalog_owner to rman; //是resource SQL〉exit
$ rman catalog rman/rman RMAN> create catalog; 注册备份数据库
$ export ORACLE_SID=db (your instance need backup)
$ rman catalog rman/rman@rman target / //7.25这里报错,我想是@veritas
RMAN〉 register database; 7。25为止
3. 编写rman for NBU 备份脚本
脚本模版在installpath/netbackup/ext/db_ext/oracle/samples/rman目录下
有hot_database_backup。sh和hot_database_restore。sh 修改hot_database_backup.sh并把他放到你需要的目录下 下面是我这次的脚本内容:
#!/bin/sh
# $Header: hot_database_backup。sh,v 1。2 2002/08/06 23:51:42 $ #
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2003 VERITAS Software Corporation, All Rights Reserved $ *
#*************************************************************************** #ecpyrght # #
--————-—--———-——-—----—-——-———---————-—-——----———--—--—-—--——————---—————-- # #
---——-———---—--——————--——--—-———--—-————————-—-——-—-—-———---———--——-—-——-—-
# This script uses Recovery Manager to take 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 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 user's account. #
—-———----———-—-——---——-—----—-————----————-—-———-—-—----—-——-—-——————-——-—— #
—--————--——-—------———---—-———---——-----—-———---—---——————-———---——-—--———-
# Determine the user which is executing this script. #
---—-——-—-—-——----—————————-----—-——-—--———---———-------
hot_database_backup。sh
——-——--———-—--—-—--
CUSER=`id |cut -d”(” -f2 | cut —d ”)” —f1` #
-———-—-----—----—----——-—----———--—-—-—-—-————-———-—————-——-—-——-———--—---—
# Put output in 〈this file name〉.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” ] then fi #
—---—-——---——-—-————-————--——-—-—-—-—-—--—-—-——-————-—--—--—----—
# Initialize the log file。 #
-——-———----—-———————-—-—-—————--——-——————---—————————--—---—--—-—
echo >〉 $RMAN_LOG_FILE chmod 666 $RMAN_LOG_FILE #
-—----————-—----———-——-—————--—-——-—--———-—-———----——-———--——-—————--—-———- # Log the start of this script.
rm -f \"$RMAN_LOG_FILE\"
#
-—-———-—--——-—--———-----———-———-—--——-—--———-—--————---—--—-——-——-—--——----
echo Script $0 〉〉 $RMAN_LOG_FILE
echo ==== started on `date` ==== >〉 $RMAN_LOG_FILE echo >〉 $RMAN_LOG_FILE #
——-----—--—---—-———-—-————-----————-—-----——-—-———-—-—-——-——--—--——--—-————
# Replace /db/oracle/product/ora81, below, with the Oracle home path。 #
-——-———-—-———————-——--—--—-—-—-—-———--——---—--—-—————-———-———----———-—--———
ORACLE_HOME=/oracle/product/9.2。0 export ORACLE_HOME #
—--——--——-———-——————--—-—--—-—————————-—--—-------------——---—---—————--—-—
# Replace ora81, below, with the Oracle SID of the target database。 #
-—--——-——-——-——--——--—--——————--—-——-——-—-—--———-———------——--—-—-—-——--—-—
ORACLE_SID=db export ORACLE_SID #
———--———-—---—----—-——----—-----———---—--—-——-———————-——-—-———---——-—---—-—
# Replace ora81, below, with the Oracle DBA user id (account). #
——-—-———-—--—---————-—--—--—-——-—-———--———-—--—-—--—---———--—-—-—---—-—--—-
ORACLE_USER=oracle #
-—-——————---——-——-----—-----—--——--—-——--——-——----——---—-—-——-————-—----—-- # Set the target connect string.
# Replace ”sys/manager\#
—--—--————-——-—————----—--———-—-—-—----—---—--—-----—----------——-—-—----—-
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_FILE
echo ”RMAN: $RMAN” >〉 $RMAN_LOG_FILE
echo ”ORACLE_SID: $ORACLE_SID\" 〉〉 $RMAN_LOG_FILE echo \"ORACLE_USER: $ORACLE_USER\" 〉> $RMAN_LOG_FILE echo \"ORACLE_HOME: $ORACLE_HOME\" 〉> $RMAN_LOG_FILE #
—--————----—-——---—--—-—-—------————-——--—————-—--——-—-—--——---———----——-——
# Print out the value of the variables set by bphdb。 #
-------------——------—-—————--——--—--—-----———--—-———-——--——---———---—-—---
echo >> $RMAN_LOG_FILE
echo \"NB_ORA_FULL: $NB_ORA_FULL” 〉〉 $RMAN_LOG_FILE echo \"NB_ORA_INCR: $NB_ORA_INCR\" >> $RMAN_LOG_FILE echo \"NB_ORA_CINC: $NB_ORA_CINC\" >〉 $RMAN_LOG_FILE echo ”NB_ORA_SERV: $NB_ORA_SERV” 〉> $RMAN_LOG_FILE
echo \"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, NetBackup # 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 Cumulative 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=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 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 LEVEL=1 CUMULATIVE\"
elif [ ”$BACKUP_TYPE” = ”\" ] then
echo ”Default — Full backup requested\" 〉〉 $RMAN_LOG_FILE BACKUP_TYPE=\"INCREMENTAL LEVEL=0” fi #
------———-—--—--——-—---—----——-----——-—-—---—-——--——--—--—--——---—--—--—--—
# 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 command line below with the
# ’rcvcat 〈userid>/ # 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 levels 〉 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, # 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 datafiles, 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 result 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 backup 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 environment 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=$ORACLE_HOME export ORACLE_HOME ORACLE_SID=$ORACLE_SID export ORACLE_SID $RMAN target $TARGET_CONNECT_STR catalog rman/rman@veritas msglog $RMAN_LOG_FILE append << EOF RUN { ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch01 TYPE ’SBT_TAPE'; BACKUP $BACKUP_TYPE SKIP INACCESSIBLE TAG hot_db_bk_level0 FILESPERSET 5 # recommended format FORMAT 'bk_%s_%p_%t' DATABASE; sql ’alter system archive log current'; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; # backup all archive logs ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE’; BACKUP filesperset 20 FORMAT 'al_%s_%p_%t' ARCHIVELOG ALL DELETE INPUT; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; # # Note: During the process of backing up the database, RMAN also backs up the # control file。 This version of the control file does not contain the # information about the current backup because ”nocatalog” has been specified. # To include the information about the current backup, the control file should # be backed up as the last step of the RMAN section. This step would not be # necessary if we were using a recovery catalog. # ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE’; BACKUP # recommended format FORMAT ’cntrl_%s_%p_%t' CURRENT CONTROLFILE; RELEASE CHANNEL ch00; } EOF ” # Initiate the command string if [ ”$CUSER” = \"root” ] then su - $ORACLE_USER -c \"$CMD_STR” 〉> $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=\"ended successfully” else LOGMSG=\"ended in error\" fi echo >> $RMAN_LOG_FILE echo Script $0 〉> $RMAN_LOG_FILE echo ==== $LOGMSG on `date` ==== 〉〉 $RMAN_LOG_FILE echo >〉 $RMAN_LOG_FILE exit $RSTAT 模版中需要修改的地方我用红色标出了. 4. 在NBU master server中参见oracle 备份策略 策略中选择oracle选项,并指定你备份脚本的路径.其他的可以参照官方文档。 5. 备份测试 在NBU中手动执行备份策略,看是否备份成功.//8.9号做到此,备份成功,注意将veritas实例启来,我将veritas也加入到双机中了,这样NBU中的client名指定的是float,切换后备份也成功。 三、 恢复测试 1. 修改恢复脚本 一下是我这次的恢复脚本: #!/bin/sh # $Header: database_restore.sh,v 1。2 2002/11/20 00:47:40 $ # #bcpyrght #*************************************************************************** #* $VRTScprght: Copyright 1993 - 2003 VERITAS Software Corporation, All Rights Reserved $ * #*************************************************************************** #ecpyrght # # ——--—-—--——-----——-———-——----—-—--————-—-----————————-—--—--—-——---——-——--- # # ——-—-——---———----———-—-—-—-—--——-—-—-——-—————--————--——--—-----———-———----- # This script uses Recovery Manager to restore all datafiles, and recover # them completely。 It is assumed that this script will be executed by 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 executed using this user's # account。 # —-----—-----————---—--——---—-—-----—-—-—--—----—————---—-—--————---——--——-- # —--—-—----—---—--—-——---——-——---—---———-—----—--———-—----——-——--—————-————— # Put output in --—-——----—-----—---——--—————---——-—-—-—-———-——-—-——-———-—---—---—--——---—— RMAN_LOG_FILE=${0}.out # --———-———--——--————----—-------——-————--———————-——-—————-————-———-——-—-—--— # Determine the user which is executing this script. # -——---———-—--——-———--—-—-—---———-—-——-—--———-———--———--——-—————-—-———--—--— CUSER=`id |cut -d”(” —f2 | cut -d \")” -f1` # ---————-——--—--—-—-——----——--——--—-———--——-—--—--—-------- database_restore.sh ————----———----—— # 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” ] then fi # —--——--—-—-————---—-—-—--—----—-———-——--—---———------—-—--——----— # Initialize the log file。 # -—-—————-—----——---—--——-----—-—--—-—--——--———-—--—————---—-----— echo 〉> $RMAN_LOG_FILE chmod 666 $RMAN_LOG_FILE # --—-———-—-—-——-—-—-—----—-—-—————--———------———-——-——--—-——-—-—--—-—-—-———- # Log the start of this script. # -——-----——--—---—-—--—--—---—-———-———--—-—--—-—-—-—---—--—--————----——---—- echo Script $0 >> $RMAN_LOG_FILE echo ==== started on `date` ==== 〉> $RMAN_LOG_FILE echo 〉〉 $RMAN_LOG_FILE # —————--—-—---—-—--—-----—-—-—--—--——----——-————---———-—-—-——-—-------————-— # Replace /db/oracle/product/ora81, below, with the Oracle home path. # -—-———-----——————-—-——--——-———--—----——-—-----——--———-—-—-———---——-———-—--— ORACLE_HOME=/oracle/product/9.2。0 rm -f ”$RMAN_LOG_FILE\" export ORACLE_HOME # —-—-—-—-——-——---—--————------—-————-----—-——---——-——-————--——----——-—————-- # Replace ora81, below, with the Oracle SID of the target database. # —---——-—-——-——--——-—---—-—-—-—---—--—--—————————-—-——----—--——-—--—---——-—— ORACLE_SID=db export ORACLE_SID # -——-——-----—-——-—-—--—---—--———-———---—-——--—--—--—-——-—---—-—---——-—--——-- # Replace ora81, below, with the Oracle DBA user id (account)。 # -————-——-—-——-——-——-——-----——-------—--—--——-—-——--—---—-———--—---—-———---- ORACLE_USER=oracle # -———--—--——-————--—-——---——-—-—————--——---——------——---————-—----—---—————— # Set the target connect string. # Replace \"sys/manager”, 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_FILE echo ”RMAN: $RMAN” >〉 $RMAN_LOG_FILE echo \"ORACLE_SID: $ORACLE_SID” >> $RMAN_LOG_FILE echo \"ORACLE_USER: $ORACLE_USER\" 〉〉 $RMAN_LOG_FILE echo ”ORACLE_HOME: $ORACLE_HOME” 〉> $RMAN_LOG_FILE # —----—————-——---———---——--————--——-—-—--————--—--——-----————-——-——-----——-- # NOTE: This script assumes that the database is off line (mount state)。 If # desired, this would be the place to verify that。 # ----———-——-—-—--———-——————---——------—-———---—--—-----——---——-——-——--—-—-—- # -—-----——---——--————-———-————------——----————-——--—-————-——---————------—-- # Call Recovery Manager to initiate the restore。 This example does not use a # Recovery Catalog. If you choose to use one, remove the option, nocatalog, # from the rman command line below and add a # 'rcvcat # Note: Any environment variables needed at run time by RMAN # must be set and exported within the switch user (su) command. # ---———-———--—---———-—--———-—---——---——————-—---—-—-—--——-————---—-—-----——— # # The script below restores all datafiles, and recovers them completely。 # All data files are restored to their current locations, from their most # recent backups。 It does not restore the control file。 If you wish to # omit restoring one or more tablespaces, use the skip tablespace clause # on the restore command. # # Note recovery manager automatically: # o determines whether the controlfile is a backup, and will perform the # correct type of recovery。 # o restores any archived redo logs that are currently not on disk, # which are required for recovery. # # If there are incremental backups, it will apply these first, then # apply any redo required to fully recover。 # # # 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 environment 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=$ORACLE_HOME export ORACLE_HOME ORACLE_SID=$ORACLE_SID export ORACLE_SID $RMAN target $TARGET_CONNECT_STR catalog rman/rman@veritas msglog $RMAN_LOG_FILE append 〈〈 EOF RUN { ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE’; ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE’; RESTORE DATABASE; RECOVER DATABASE; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; } EOF \" # Initiate the command string if [ \"$CUSER\" = ”root\" ] then su — $ORACLE_USER —c ”$CMD_STR” 〉〉 $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=\"ended successfully\" else LOGMSG=”ended in error\" fi echo >〉 $RMAN_LOG_FILE echo Script $0 〉〉 $RMAN_LOG_FILE echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE echo 〉〉 $RMAN_LOG_FILE exit $RSTAT 脚本修改需要修改地方我用红色标出 2. 测试恢复 首先需要把数据库停到mount状态 $ sqlplus ‘/as sysdba' SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down SQL> startup mount;。 SQL〉exit # /bin/sh hot_database_restore。sh 监控NBU进程,查看恢复进程启动。如果恢复正常结束后,可以startup数据库检查数据. 四、 注意点 1. 最好把NBU的补丁打上 2. 请看一下NBU里的一些参数,有些需要根据客户的具体情况修改 3. 如果数据库是异地恢复,或者数据库有cluster环境的化需要在master server这里 touch一个空文件,这个空文件折腾我3天时间,大家注意。 install_path/netbackup/db/altnames/No.Restrictions 4. 本地RMAN备份和恢复的方法,可用来测试RMAN 备份: su – oracle $ rman target / catalog rman/rman@veritas RMAN> run { allocate channel dev1 type disk; set limit channel dev1 kbytes 2000000; backup incremental level 0 format ’/backup/rman/full/full_%d_%s_%p’ filesperset 3 (database include current controlfile); } 恢复: # su – oracle $ sqlplus ‘/as sysdba’ SQL〉shutdown; SQL>startup mount; SQL>exit $ rman target / catalog rman/rman@veritas RMAN〉 run { restore database ; recover databse ; } 因篇幅问题不能全部显示,请点此查看更多更全内容