nbu安装和oracle rman安装.docx
《nbu安装和oracle rman安装.docx》由会员分享,可在线阅读,更多相关《nbu安装和oracle rman安装.docx(19页珍藏版)》请在冰豆网上搜索。
nbu安装和oraclerman安装
NBUforOracle安装和RMAN备份、恢复配置及测试
一、NBUforOracle安装
安装masterserver
1、改/etc/hosts文件,添加本备份系统内所有主机的IP地址和主机名,因为NBU是根据主机名来查找主机。
2、确保mediaserver所在主机上/dev/rmt目录下能看到磁带机信息。
最好是能在磁带机内放一盘磁带并用tar命令确认能向磁带机写数据。
3、将介质放在光驱内
#cd/cdrom/cdrom0
#./install
选择安装Netbackup,根据提示继续。
在安装过程中,会问到“此主机是不是masterserver”,安装masterserver时就答yes,安装mediaserver时答no,并根据提示输入masterserver的主机名。
注意在集群环境中,请在安装过程中输入NetBackupclient的虚拟名称而不是实际的本地主机名。
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
exportMANMANPATH
安装client和agent
1、将介质放入光驱
#cd/cdrom/cdrom0
#./install
在提示输入server名字时输入masterserver的名字。
2、修改/usr/openv/netbackup/bp.conf文件,在第一行的“SERVER=XXXXX”下面按照此格式增加其他mediaserver的名字,有几台mediaserver就增加几行。
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‘/assysdba’
SQL>startup;
ORACLEinstancestarted.
TotalSystemGlobalArea838860800bytes
FixedSize781424bytes
VariableSize221254544bytes
DatabaseBuffers616562688bytes
RedoBuffers262144bytes
Databasemounted.
Databaseopened.
SQL>exit
$rmannocatalog
RMAN>connecttarget
RMAN>connecttargetsystem/manager2@db
连接正常,不报错,表示RMAN正常运行。
这次由于客户oracle补丁打的有问题,RMAN一直不正常,可以在配置RMAN前先测试一下RMAN的状态。
2.配置RMANforNBU
创建一个instancevertias用来存放catalog库。
Instance名字可以随便起
$dbca用dbca工具创建
创建catalog库
/////////////我7.06以上做了但补丁未打//////////////////
$drtias
$sqlplus‘/assysdba’
SQL>startup;
SQL>createtablespacercvcatdatafile‘/oradata/veritas/rcvcat01.dbf’size100Mextentmanagementlocalsegmentspacemanagementauto;
SQL>createuserrmanidentifiedbyrmandefaulttablespacercvcattemporarytablespacetempquotaunlimitedonrcvcat;
SQL>grantconnect,resorce,recovery_catalog_ownertorman;//是resource
SQL>exit
$rmancatalogrman/rman
RMAN>createcatalog;
注册备份数据库
$exportORACLE_SID=db(yourinstanceneedbackup)
$rmancatalogrman/rman@rmantarget///7.25这里报错,我想是@veritas
RMAN>registerdatabase;
7.25为止
3.编写rmanforNBU备份脚本
脚本模版在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,v1.22002/08/0623:
51:
42$
#
#bcpyrght
#***************************************************************************
#*$VRTScprght:
Copyright1993-2003VERITASSoftwareCorporation,AllRightsReserved$*
#***************************************************************************
#ecpyrght
#
#---------------------------------------------------------------------------
#hot_database_backup.sh
#---------------------------------------------------------------------------
#ThisscriptusesRecoveryManagertotakeahot(inconsistent)database
#backup.Ahotbackupisinconsistentbecauseportionsofthedatabaseare
#beingmodifiedandwrittentothediskwhilethebackupisprogressing.
#YoumustrunyourdatabaseinARCHIVELOGmodetomakehotbackups.Itis
#assumedthatthisscriptwillbeexecutedbyuserroot.InorderforRMAN
#toworkproperlyweswitchuser(su-)totheoracledbaaccountbefore
#execution.IfthisscriptrunsunderauseraccountthathasOracledba
#privilege,itwillbeexecutedusingthisuser'saccount.
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
#Determinetheuserwhichisexecutingthisscript.
#---------------------------------------------------------------------------
CUSER=`id|cut-d"("-f2|cut-d")"-f1`
#---------------------------------------------------------------------------
#Putoutputin.out.Changeasdesired.
#Note:
outputdirectoryrequireswritepermission.
#---------------------------------------------------------------------------
RMAN_LOG_FILE=${0}.out
#---------------------------------------------------------------------------
#Youmaywanttodeletetheoutputfilesothatbackupinformationdoes
#notaccumulate.Ifnot,deletethefollowinglines.
#---------------------------------------------------------------------------
if[-f"$RMAN_LOG_FILE"]
then
rm-f"$RMAN_LOG_FILE"
fi
#-----------------------------------------------------------------
#Initializethelogfile.
#-----------------------------------------------------------------
echo>>$RMAN_LOG_FILE
chmod666$RMAN_LOG_FILE
#---------------------------------------------------------------------------
#Logthestartofthisscript.
#---------------------------------------------------------------------------
echoScript$0>>$RMAN_LOG_FILE
echo====startedon`date`====>>$RMAN_LOG_FILE
echo>>$RMAN_LOG_FILE
#---------------------------------------------------------------------------
#Replace/db/oracle/product/ora81,below,withtheOraclehomepath.
#---------------------------------------------------------------------------
ORACLE_HOME=/oracle/product/9.2.0
exportORACLE_HOME
#---------------------------------------------------------------------------
#Replaceora81,below,withtheOracleSIDofthetargetdatabase.
#---------------------------------------------------------------------------
ORACLE_SID=db
exportORACLE_SID
#---------------------------------------------------------------------------
#Replaceora81,below,withtheOracleDBAuserid(account).
#---------------------------------------------------------------------------
ORACLE_USER=oracle
#---------------------------------------------------------------------------
#Setthetargetconnectstring.
#Replace"sys/manager",below,withthetargetconnectstring.
#---------------------------------------------------------------------------
TARGET_CONNECT_STR=/
#---------------------------------------------------------------------------
#SettheOracleRecoveryManagername.
#---------------------------------------------------------------------------
RMAN=$ORACLE_HOME/bin/rman
#---------------------------------------------------------------------------
#Printoutthevalueofthevariablessetbythisscript.
#---------------------------------------------------------------------------
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
#---------------------------------------------------------------------------
#Printoutthevalueofthevariablessetbybphdb.
#---------------------------------------------------------------------------
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:
Thisscriptassumesthatthedatabaseisproperlyopened.Ifdesired,
#thiswouldbetheplacetoverifythat.
#---------------------------------------------------------------------------
echo>>$RMAN_LOG_FILE
#---------------------------------------------------------------------------
#IfthisscriptisexecutedfromaNetBackupschedule,NetBackup
#setsanNB_ORAenvironmentvariablebasedonthescheduletype.
#TheNB_ORAvariableisthenusedtodynamicallysetBACKUP_TYPE
#Forexample,when:
#scheduletypeisBACKUP_TYPEis
#------------------------------
#AutomaticFullINCREMENTALLEVEL=0
#AutomaticDifferentialIncrementalINCREMENTALLEVEL=1
#AutomaticCumulativeIncrementalINCREMENTALLEVEL=1CUMULATIVE
#
#Foruserinitiatedbackups,BACKUP_TYPEdefaultstoincremental
#level0(full).Tochangethedefaultforauserinitiated
#backuptoincrementalorincrementalcumulative,uncomment
#oneofthefollowingtwolines.
#BACKUP_TYPE="INCREMENTALLEVEL=1"
#BACKUP_TYPE="INCREMENTALLEVEL=1CUMULATIVE"
#
#Notethatweuseincrementallevel0tospecifyfullbackups.
#Thatisbecause,althoughtheyareidenticalincontent,only
#theincrementallevel0backupcanhaveincrementalbackupsof
#level>0appliedtoit.
#---------------------------------------------------------------------------
if["$NB_ORA_FULL"="1"]
then
echo"Fullbackuprequested">>$RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTALLEVEL=0"
elif["$NB_ORA_INCR"="1"]
then
echo"Differentialincrementalbackuprequested">>$RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTALLEVEL=1"
elif["$NB_ORA_CINC"="1"]
then
echo"Cumulativeincrementalbackuprequested">>$RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTALLEVEL=1CUMULATIVE"
elif["$BACKUP_TYPE"=""]
then
echo"Default-Fullbackuprequested">>$RMAN_LOG_FILE
BACKUP_TYPE="INCREMENTALLEVEL=0"
fi
#---------------------------------------------------------------------------
#CallRecoveryManagertoinitiatethebackup.Thisexampledoesnotusea
#RecoveryCatalog.Ifyouchoosetouseone,replacetheoption'nocatalog'
#fromthermancommandlinebelowwiththe
#'rcvcat/@'statement.
#
#Note:
AnyenvironmentvariablesneededatruntimebyRMAN
#mustbesetandexportedwithintheswitchuser(su)command.
#-