版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
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恢復測試步驟假設已經(jīng)搭建好同平臺的數(shù)據(jù)庫測試環(huán)境:備份源主機名:scdbdb01恢復目標主機名:scdbtrnsvr備份服務器主機名:erpbackupsvr2數(shù)據(jù)庫sid:gzyx(rac的服務名)本次恢復是把原建立在裸設備的rac數(shù)據(jù)恢復到異機的文件系
24、統(tǒng),具體恢復過程如下:1、 在測試主機上安裝nbu備份客戶端和oracle備份代理。2、 創(chuàng)建一個測試用的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)恢復數(shù)據(jù)文件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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 國慶節(jié)小區(qū)物業(yè)活動策劃
- 門店店長工作崗位職責(30篇)
- 冬季領導致辭稿開場白(3篇)
- 酒店銷售經(jīng)理的述職報告
- 會計學原理張曾蓮課后參考答案
- 四川省瀘州市(2024年-2025年小學五年級語文)統(tǒng)編版隨堂測試((上下)學期)試卷及答案
- 2024年航空制造和材料專用設備項目資金需求報告代可行性研究報告
- 多姿多彩的圖形教案
- 2024安全加密芯片技術規(guī)范
- 2023-2024學年廣東省深圳市福田區(qū)九年級(上)期中英語試卷
- 2023年電焊工技能鑒定實操試題
- 國企三公經(jīng)費管理建議
- 幼兒學大班數(shù)學試題(6歲)1
- 四級高頻詞匯
- 央國企信創(chuàng)化與數(shù)字化轉型規(guī)劃實施
- 1.四方埔社區(qū)服務中心場地管理制度
- 智慧城市治理CIM平臺建設方案
- 心肺復蘇后疾病的病理生理和預后
- 《餐飲服務的特點》課件
- 少兒科學實驗-直升飛機
- 財政與金融基礎知識(中職財經(jīng)商貿(mào)類專業(yè))全套教學課件
評論
0/150
提交評論