Oracle數(shù)據(jù)庫備份與恢復(fù)用戶手冊(cè)_第1頁
Oracle數(shù)據(jù)庫備份與恢復(fù)用戶手冊(cè)_第2頁
Oracle數(shù)據(jù)庫備份與恢復(fù)用戶手冊(cè)_第3頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、oracleoracle 數(shù)據(jù)庫備份與恢復(fù)數(shù)據(jù)庫備份與恢復(fù)用戶手冊(cè)用戶手冊(cè)目錄目錄123安裝 oracle 客戶機(jī)軟件. 3安裝 oracle 數(shù)據(jù)庫 agent . 3備份 oracle 數(shù)據(jù)庫. 43.13.23.33.4更改歸檔模式 . 4連接數(shù)據(jù)庫. 5確認(rèn) rman的備份方式 . 5修改備份腳本(這部分是在裝有 oracle 數(shù)據(jù)庫的 client 端操作) . 53.4.13.4.23.54在修改腳本之前應(yīng)該收集關(guān)于 oracle 數(shù)據(jù)庫的信息. 5現(xiàn)在我們來修改備份數(shù)據(jù)庫的腳本 . 7添加備份策略 . 14恢復(fù)數(shù)據(jù)庫 . 144.1oracle 全庫恢復(fù). 144.2oracle

2、 表空間恢復(fù) . 141 1 安裝安裝 oracleoracle 客戶機(jī)軟件客戶機(jī)軟件1.1. 將 netbackup cd-rom 插入到客戶計(jì)算機(jī)的驅(qū)動(dòng)器中。2.2. 將工作目錄切換到 cd-rom 目錄:cd cd_rom_directory其中 cd_rom_directory 是 cd-rom 的目錄路徑。在某些平臺(tái)上,可能需要安裝該目錄。3.3. 啟動(dòng)安裝程序。./install4.4. 選擇選項(xiàng) 2 netbackupnetbackup 客戶機(jī)軟件。5.5. 按照提示完成安裝。2 2 安裝安裝 oracleoracle 數(shù)據(jù)庫數(shù)據(jù)庫 agentagent1.1. 作為機(jī)器上的 r

3、oot 用戶登錄。2.2. 將 cd-rom 插入驅(qū)動(dòng)器中。3.3. 將工作目錄切換到 cd-rom 目錄。cd /cd_mount_pointcd /cd_mount_point4.4. 通過執(zhí)行 install 腳本裝入并安裝軟件。注意要求在本地機(jī)器上運(yùn)行的 netbackup 版本級(jí)別(例如 5.0)與要安裝的數(shù)據(jù)庫代理程序版本級(jí)別相匹配。輸入輸入./install./installa.a. 選擇“netbackup 數(shù)據(jù)庫代理軟件”選項(xiàng)。將出現(xiàn)下面的提示:do you want to do a local installation? (y/n) nb.b. 回答 y y。您將看到一個(gè)菜

4、單,菜單上顯示 cd-rom 上可用的所有數(shù)據(jù)庫代理程序。c.c. 選擇“netbackup for oracle”選項(xiàng)。d.d. 輸入 q q 退出選擇選項(xiàng)。隨即出現(xiàn)一個(gè)提示,詢問列表是否正確。e.e. 回答 y y。將發(fā)生下列操作: 版本文件、壓縮 tar 文件和 install_dbext 腳本將被裝入到目錄install_path/netbackup/dbext 中。 install 腳本將自動(dòng)執(zhí)行 install_dbext 腳本。 如果接收客戶機(jī)被配置為 hp-ux11.00、 hp-ux11.11、solaris7、solaris 8 或solaris9、irix6.5、aix4

5、.3.3 或 aix5 計(jì)算機(jī),則將安裝netbackup fororacle 的 32 位和 64 位兩個(gè)版本。 如果 install_dbext 成功完成,則在目錄install_path/netbackup/ext/ 中將出現(xiàn)一個(gè)版本文件,該文件包含所安裝的 netbackup for oracle 的版本和安裝時(shí)間戳。f.f. 輸入 q q 退出腳本。3 3 備份備份 oracleoracle 數(shù)據(jù)庫數(shù)據(jù)庫3.13.1 更改歸檔模式更改歸檔模式首先關(guān)閉數(shù)據(jù)庫sql shutdown immediate再將數(shù)據(jù)庫啟動(dòng)到 mount狀態(tài)sqlstartup mount$ sqlplus /

6、nologsql*plus: release 9.2.0.1.0 - production on tue mar 15 10:05:00 2005copyright (c) 1982, 2002, oracle corporation.all rights reserved.sql connect /as sysdbaconnected.sql archive log list;database log modeno archive modeautomatic archivaldisabledarchive destination/oracle/9i/dbs/archoldest online

7、 log sequence112current log sequence114sql create pfile=$oracle_home/dbs/initsid.ora from spfile=$oracle_home /dbs/spfilesid.ora;file created.通過此命令將 spfile 的參數(shù)文件導(dǎo)出到 pfile 文件中,然后修改 initsid.ora 中;將以下三行的注釋去掉(如果沒有此三行則需添加)log_archive_start=true此句使自動(dòng)歸檔生效log_archive_dest=/oracle/oradata/hndldb/archive此句指定了

8、歸檔路徑log_archive_format = %t_%s.arc此句設(shè)定了歸檔日志文件的命名規(guī)則sql shutdown immediate停止 oracle數(shù)據(jù)庫sqlcreate spfile=$oracle_home /dbs/spfilehndldb.ora from pfile=$oracle_home /dbs/inithndl.ora;file created.通過此命令將 pfile的參數(shù)文件導(dǎo)回到 spfile 文件中;sql startup mountoracle instance started.total system global area186089336 by

9、tesfixed size741240 bytesvariable size150994944 bytesdatabase buffers33554432 bytesredo buffers798720 bytesdatabase mounted.sql alter database archivelog;database altered.sql archive log start;statement processed.sql alter database open;database altered.sql archive log list;database log modearchive

10、modeautomatic archivalenabledarchive destination/oracle/oradata/hndldb/archiveoldest online log sequence112next log sequence to archive114current log sequence114sql3.23.2 連接數(shù)據(jù)庫連接數(shù)據(jù)庫注意:在做此項(xiàng)操作前必須使用 oracle用戶,且數(shù)據(jù)庫必須是 shutdown 的。# su oracle$sqlplus “/ as sysdba”shutdown immediate$cd /usr/openv/netbackup/

11、bin$./oracle_link此操作完成后將數(shù)據(jù)庫起來。3.33.3 確認(rèn)確認(rèn) rmanrman的備份方式的備份方式veritas的oracle agent是采用調(diào)用 rman的備份語句來提取 oracle 數(shù)據(jù)的,而 rman 的備份方式分為 catalog 和 nocatalog 兩種,本項(xiàng)目采用nocatalog方式進(jìn)行備份。3.43.4 修改備份腳本修改備份腳本 (這部分是在裝有(這部分是在裝有 oracleoracle數(shù)據(jù)庫的數(shù)據(jù)庫的 clientclient端操端操作)作)3.4.13.4.1 在修改腳本之前應(yīng)該收集關(guān)于在修改腳本之前應(yīng)該收集關(guān)于 oracleoracle數(shù)據(jù)庫

12、的信息數(shù)據(jù)庫的信息在 oracle 用戶下輸入 set 就能得到我們所需要的一些信息(紅色部分就是 oraclehome 和實(shí)例名)sspro1 $setclass_pa th=/oracle/app/oracle/product/jlib:/oracle/app/oracle/jre:/oracle/app/oracle/jlib:/oracle/app/oracle/network/jlibcolumns=79editor=vierase=herrno=0fcedit=/usr/bin/edhome=/oracleifs=ld_library_pa th=/oracle/app/oracl

13、e/lib:/lib:/usr/lib:/oracle/app/oracle/rdbms/liblineno=1lines=32logname=oraclemailcheck=600manpa th=/usr/share/man/%l:/usr/share/man:/usr/contrib/man/%l:/usr/contrib/man:/usr/local/man/%l:/usr/local/man:/opt/graphics/common/man:/opt/ignite/share/man/%l:/opt/ignite/share/man:/opt/ipf/man:/opt/mx/shar

14、e/man:/usr/dt/share/man:/opt/samba/man:/opt/resmon/share/man:/opt/sec_mgmt/share/man:/opt/gnome/man:/opt/openssl/man:/opt/openssl/prngd/man:/opt/wbem/share/man:/opt/perl/man:/opt/sec_mgmt/share/man/%l:/opt/ssh/share/man:/opt/vrts/man:/opt/acc/share/man/%l:/opt/acc/share/man:/opt/ansic/share/man/%l:/

15、opt/ansic/share/man:/opt/langtools/share/man/%l:/opt/langtools/share/man:/opt/caliper/man/%l:/opt/caliper/man:/opt/imake/mannls_lang=simplified chinese_china.zhs16gbkoptargoptind=1oracle_base=/oracleoracle_home=/oracle/app/oracleoracle_sid=ldtdataoracle_term=hpora_nls33=/oracle/app/oracle/ocommon/nl

16、s/admin/datapa th=/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/q4/bin:/opt/perl/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/x11:/opt/graphics/common/bin:/opt/upgrade/bin:/usr/contrib/bin/x11:/opt/ipf/bin:/opt/resmon/bin:/opt/ignite/bin:/o

17、pt/sec_mgmt/bastille/bin:/opt/gnome/bin:/opt/mozilla:/opt/wbem/bin:/opt/wbem/sbin:/opt/mx/bin:/opt/sec_mgmt/spc/bin:/opt/acc/bin:/opt/caliper/bin:/opt/langtools/bin:.:/usr/cls/bin:/usr/lib:/usr/lbin:/usr/bin:/oracle/app/oracle/bin:/binppid=10692ps1=sspro1 $ps2= ps3=#? ps4=+ pwd=/oraclerandom=22938se

18、conds=25shell=/usr/bin/shshlib_pa th=/oracle/app/oracle/lib32:/oracle/app/oracle/rdbms/lib32term=ansitmout=0tmpdir=/tmptz=pst-8pdt_= / as sysdbasspro1 $3.4.23.4.2 現(xiàn)在我們來修改備份數(shù)據(jù)庫的腳本現(xiàn)在我們來修改備份數(shù)據(jù)庫的腳本該腳本的路徑是usr/openv/netbackup/ext/de_ext/rman/hot_database_backup.sh以下的腳本中紅色部分是需要被修改后的。password:please wait.ch

19、ecking for disk quotas(c)copyright 1983-2003 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.(c)copyright 1986-2000 sun microsystems, inc.(c)copyright 1985, 1986, 1988 massachusetts inst

20、itute of technology(c)copyright 1989-1993the open software foundation, inc.#!/bin/sh# $header: hot_database_backup.sh,v 1.2 2002/08/06 23:51:42 $#bcpyrght#*#* $vrtscprght: copyright 1993 - 2005 veritas software corporation, all rightsreserved $ *#*#ecpyrght# -#hot_database_backup.sh# -#this script u

21、ses 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 scri

22、pt 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 users account.# -# -# determine the user which is executing th

23、is script.# -cuser=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 -

24、f $rman_log_file 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 ora

25、cle home path.# -oracle_home=/oracle/app/oracleexport oracle_home# -# replace ora81, below, with the oracle sid of the target database.# -oracle_sid=ldtdataexport oracle_sid# -# replace ora81, below, with the oracle dba user id (account).# -oracle_user=oracle# -# set the target connect string.# repl

26、ace 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_fileechorman: $rman $rman_log_fileechooracle_sid: $oracle_sid $rman_log_

27、fileechooracle_user: $oracle_user $rman_log_fileechooracle_home: $oracle_home $rman_log_file# -# print out the value of the variables set by bphdb.# -echo $rman_log_fileechonb_ora_full: $nb_ora_full $rman_log_fileechonb_ora_incr: $nb_ora_incr $rman_log_fileechonb_ora_cinc: $nb_ora_cinc $rman_log_fil

28、eechonb_ora_serv: $nb_ora_serv $rman_log_fileechonb_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

29、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 isbackup_type is#-# automatic fullincremental level=0# automatic differential incremental incremental level=1# automatic cumulative

30、 incrementalincremental level=1 cumula tive# 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# backu

31、p_type=incremental level=1 cumula tive# 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 thenecho full backup requ

32、ested $rman_log_filebackup_type=incremental level=0elif $nb_ora_incr = 1 thenecho differential incremental backup requested $rman_log_filebackup_type=incremental level=1elif $nb_ora_cinc = 1 thenecho cumulative incremental backup requested $rman_log_filebackup_type=incremental level=1 cumula tiveeli

33、f $backup_type = thenecho default - full backup requested $rman_log_filebackup_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 command line below with the

34、# 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 levels 0#applied to it).#we do

35、 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

36、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 th

37、e 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 su

38、fficient; 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 cons

39、tructed 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#th

40、rough 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_homeexport oracle_homeoracle_sid=$oracle_sidexport oracle_s

41、id$rman target $target_connect_str nocatalog msglog $rman_log_file append $rman_log_filersta t=$?else/usr/bin/sh -c $cmd_str $rman_log_filersta t=$?fi# -# log the completion of this script.# -if $rsta t = 0 thenlogmsg=ended successfullyelselogmsg=ended in errorfiecho $rman_log_fileecho script $0 $rman_log_fileecho = $logmsg on date = $rman_log_fileecho $rman_log_fileexit $rsta t3.53.5 添加備份策略添加備份策略該步驟在 master server上操作第一步:在 policies 上點(diǎn)擊右鍵,選擇 new policy 選項(xiàng),輸入新策略名稱,如ora9 ,然后按 ok。第二步: attributes頁面在po

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論