數(shù)據(jù)庫(kù)歸檔管理_第1頁(yè)
數(shù)據(jù)庫(kù)歸檔管理_第2頁(yè)
數(shù)據(jù)庫(kù)歸檔管理_第3頁(yè)
數(shù)據(jù)庫(kù)歸檔管理_第4頁(yè)
數(shù)據(jù)庫(kù)歸檔管理_第5頁(yè)
已閱讀5頁(yè),還剩2頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、數(shù)據(jù)庫(kù)歸檔1、 查看、更改歸檔路徑在ORACLE10G中,默認(rèn)的歸檔路徑為$ORACLE_BASE/flash_recovery_area。對(duì)于這個(gè)路徑,ORACLE有一個(gè)限制,就是默認(rèn)只能有2G的空間給歸檔日志使用,可以使用下面兩個(gè)SQL語(yǔ)句去查看它的限制select * from v$recovery_file_dest;show parameter db_recovery_file_dest(這個(gè)更友好直觀一些)當(dāng)歸檔日志數(shù)量大于2G時(shí),那么就會(huì)由于沒(méi)有更多的空間去容納更多的歸檔日志會(huì)報(bào)無(wú)法繼續(xù)歸檔的錯(cuò)誤。如:RA-19809: limit exceeded for recovery f

2、ilesORA-19804: cannot reclaim 10017792 bytes disk space from 2147483648 limitARC0: Error 19809 Creating archive log file to '/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2007_04_30/o1_mf_1_220_0_.arc'這時(shí)我們可以修改它的默認(rèn)限制,比如說(shuō)將它增加到5G或更多,也可以將歸檔路徑重新置到別的路徑,就不會(huì)有這個(gè)限制了。更改限制語(yǔ)句如下:alter system set db_

3、recovery_file_dest_size=5368709102; 或者直接修改歸檔的路徑即可alter system set log_archive_dest_1='location=/u01/archivelog' scope =both;2、修改歸檔模式sql> archive log list;sql> shutdown immediate;sql> startup mount;sql> alter database archivelog; alter database noarchivelogsql> alter datab

4、ase open;sql> archive log list;3、確認(rèn)歸檔是否生效alter system switch logfile;看對(duì)應(yīng)的歸檔位置時(shí)候有archivelog產(chǎn)生。該參數(shù)已廢棄,只要開(kāi)啟了archivelog就自動(dòng)歸檔。4、設(shè)置歸檔文件格式當(dāng)數(shù)據(jù)庫(kù)處理ARCHIVELOG模式時(shí),如果進(jìn)行日志切換,后臺(tái)進(jìn)程將自動(dòng)生成歸檔日志。歸檔日志的默認(rèn)位置為%ORACLE_HOEM%RDBMS,在Oracle 11g中,歸檔日志的默認(rèn)文件名格式為ARC%S%_%R%T。為了改變歸檔日志的位置和名稱格式,必須改變相應(yīng)的初始化參數(shù)。 初始化參數(shù)LOG_ARCHIV

5、E_FORMAT用于指定歸檔日志的文件名稱格式,設(shè)置該初始化參數(shù)時(shí),可以指定以下匹配符: l %s  日志序列號(hào)。 l %S  日志序列號(hào),但帶有前導(dǎo)0。 l %t  重做線程號(hào)。 l %T  重做線程號(hào),但帶有前導(dǎo)0。 l %a  活動(dòng)ID號(hào)。 l %d  數(shù)據(jù)庫(kù)ID號(hào)。 l %r  RESETLOGS的ID值。&#

6、160;需要注意,在Oracle 11g中,配置歸檔日志文件格式時(shí),必須帶有%s,%t和%r匹配符,其他匹配符可有可無(wú)。配置了歸檔文件格式后,必須重新啟動(dòng)數(shù)據(jù)庫(kù)。例如: SQL> alter system set log_archive_format='%s_%t_%r.arc' scope=spfile;  系統(tǒng)已更改。  SQL> shutdown immediate; SQL> startup 修改初始化參

7、數(shù)LOG_ARCHIVE_FORMAT并重啟數(shù)據(jù)庫(kù)后,實(shí)始化參數(shù)配置將會(huì)生效。進(jìn)行日志切換時(shí),會(huì)生成該格式的歸檔日志文件。5、歸檔模式啟停1. archive log stop;  2. archive log start; 6、查看歸檔日志select name from v$archived_log; 7、歸檔相關(guān)參數(shù)log_archive_dest &LOG_ARCHIVE_DEST_n使用log_archive_dest參數(shù)最多可設(shè)置2個(gè)歸檔路徑,通過(guò)log_archi

8、ve_dest設(shè)置一個(gè)主歸檔路徑,通過(guò)LOG_ARCHIVE_DUPLEX_DEST 參數(shù)設(shè)置一個(gè)從歸檔路徑。所有的路徑必須是本地的,該參數(shù)的設(shè)置格式如下:LOG_ARCHIVE_DEST = '/disk1/archive'LOG_ARCHIVE_DUPLEX_DEST = '/disk2/archive' LOG_ARCHIVE_DEST_n 參數(shù)可以設(shè)置最多10個(gè)不同的歸檔路徑,通過(guò)設(shè)置關(guān)鍵詞location或service,該參數(shù)指向的路徑可以是本地或遠(yuǎn)程的。LOG_ARCHIVE_DEST_1 = 'LOCATION = /disk1

9、/archive'LOG_ARCHIVE_DEST_2 = 'LOCATION = /disk2/archive'LOG_ARCHIVE_DEST_3 = 'LOCATION = /disk3/archive'如果要?dú)w檔到遠(yuǎn)程的standby數(shù)據(jù)庫(kù),可以設(shè)置service:LOG_ARCHIVE_DEST_4 = 'SERVICE = standby1'可見(jiàn),這兩個(gè)參數(shù)都可以設(shè)置歸檔路徑,不同的是后者可以設(shè)置遠(yuǎn)程歸檔到standby端,而前者只能歸檔到本地,且最多同時(shí)歸檔到2個(gè)路徑下。log_archive_dest_n&DB_R

10、ECOVERY_FILE_DEST參數(shù)都可以用來(lái)存放歸檔日志,但二者的關(guān)系是:不設(shè)置log_archive_dest_n時(shí),使用DB_RECOVERY_FILE_DEST來(lái)存文件;當(dāng)設(shè)置了log_archive_dest_n時(shí),則使用log_archive_dest_n來(lái)存放歸檔日志。8、查看歸檔日志所占空間select * from V$FLASH_RECOVERY_AREA_USAGE;9、刪除歸檔日志文件 今天一早,同事說(shuō)Oracle數(shù)據(jù)庫(kù)連接不上。用Sqlplus測(cè)試一下,報(bào)如下錯(cuò):ORA-00257 archiver error. Connec

11、t internal only, until freed.原因比較明顯,應(yīng)該是歸檔日志文件太多造成磁盤或者設(shè)備空間不足。官方的解釋就基本如此:· Cause: The archiver process received an error while trying to archive a redo log. If the problem is not resolved soon, the database will stop executing transactions. The most likely cause of this message is the destin

12、ation device is out of space to store the redo log file.·  Action: Check the archiver trace file for a detailed description of the problem. Also, verify that the device specified in the initialization parameter ARCHIVE_LOG_DEST is set up properly for archiving.·    

13、; 通常,在正式的也就是生產(chǎn)環(huán)境下,Oracle是啟用歸檔模式的(SQL>alter database archivelog;)。因此,Oracle系統(tǒng)會(huì)不斷的產(chǎn)生歸檔日志??梢韵炔榭匆幌乱延械臍w檔日志:   · 1.telnet 到主機(jī):·· AIX Version 5(C) Copyrights by IBM and by others 1982, 2005.login: rootroot's Password:*        

14、;                                                  

15、;                   *                              

16、0;                                              *  Welcome t

17、o AIX Version 5.2!                                               

18、 *                                                 

19、;                            *                     

20、0;                                                 

21、0;     *  Please see the README file in /usr/lpp/bos for information pertinent to    *  this release of the AIX Operating System.                 

22、0;                *                                 

23、60;                                           *      &#

24、160;                                                 &#

25、160;                    *Last unsuccessful login: Thu Jul 30 00:06:26 BEIST 2009 on /dev/pts/0 from smnpcbackupLast login: Sat Aug  8 10:37:11 BEIST 2009 on /dev·· 2.切換用戶到oracleroo

26、tp630_1#:/> su - oracle·· 3.進(jìn)入rmanp630_1#oracle> rmanRecovery Manager: Release 9.2.0.8.0 - 64bit ProductionCopyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.4.連接到目標(biāo)數(shù)據(jù)庫(kù)RMAN> connect target /connected to target database: RAC9I (DBID=654968050)  &

27、#160;5.查看所有日志情況RMAN> list archivelog all;using target database controlfile instead of recovery catalogList of Archived Log CopiesKey     Thrd Seq     S Low Time  Name- - - - - -960     1   

28、60;522     A 01-AUG-09 /archlog1/Arch1_522.arc962     1    523     A 02-AUG-09 /archlog1/Arch1_523.arc964     1    524     A 04-AUG-09

29、/archlog1/Arch1_524.arc972     1    525     A 05-AUG-09 /archlog1/Arch1_525.arc967     1    526     A 06-AUG-09 /archlog1/Arch1_526.arc973   

30、0; 1    527     A 06-AUG-09 /archlog1/Arch1_527.arc974     1    528     A 07-AUG-09 /archlog1/Arch1_528.arc     簡(jiǎn)單地,我們可以到OS下把這些物理文件delete掉。但是,我們都知道在control

31、file中記錄著每一個(gè)archivelog的相關(guān)信息,當(dāng)我們?cè)贠S中刪除這些文件后,我們的controlfile中仍然記錄著這些archivelog的信息,因此在Oracle的OEM管理器中還會(huì)存在這些日志。因?yàn)楫?dāng)我們手工清除 archive目錄下的文件后,這些記錄并沒(méi)有被我們從controlfile中清除掉,也就是oracle并不知道這些文件已經(jīng)不存在了。如果我們已經(jīng)這樣做了,那么可以通過(guò)如下步驟來(lái)更新Oracle的controlfile中關(guān)于日志的信息:· 1.進(jìn)入rmanp630_1#oracle> rman·· 2.連接到目標(biāo)數(shù)據(jù)庫(kù)· RMAN> connect target /;·· 3

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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)論