真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Oracle中基于RMAN如何實(shí)現(xiàn)壞塊介質(zhì)恢復(fù)

小編給大家分享一下Oracle中基于RMAN如何實(shí)現(xiàn)壞塊介質(zhì)恢復(fù),相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

專注于為中小企業(yè)提供網(wǎng)站制作、網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)珠海免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千余家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

對于物理損壞的數(shù)據(jù)塊,在有備份的情況下,我們可以通過RMAN塊介質(zhì)恢復(fù)(BLOCK MEDIA RECOVERY)功能來完成受損塊的恢復(fù),
而不需要恢復(fù)整個數(shù)據(jù)庫或所有文件來修復(fù)這些少量受損的數(shù)據(jù)塊。但前提條件是你得有一個可用的RMAN備份存在,
因此,無論何時備份就是一切。本篇我們來模擬產(chǎn)生一個壞塊,然后使用RMAN實(shí)現(xiàn)壞塊恢復(fù)。

說明:
一般出現(xiàn)壞塊的時候,都是業(yè)務(wù)訪問到這個壞塊的時候報(bào)如下的錯誤:
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 18, block # 130)
ORA-01110: data file 18: '/ora11gSource/ora11g/tbs_tmp.dbf'

操作:
1 創(chuàng)建用于演示的表空間  
create tablespace tbs_tmp datafile '/ora11gSource/ora11g/tbs_tmp.dbf' size 10m autoextend on;   

2 基于新的數(shù)據(jù)文件創(chuàng)建對象tb_tmp
conn scott/tiger;  
create table tb_tmp tablespace tbs_tmp as select * from dba_objects;  
SQL> col file_name format a60  
SQL> select file_id,file_name from dba_data_files where tablespace_name='TBS_TMP'; 
   FILE_ID FILE_NAME
---------- ------------------------------------------------------------
        18 /ora11gSource/ora11g/tbs_tmp.dbf
  
3 表對象tb_tmp上的信息,對應(yīng)的文件信息,頭部塊,總塊數(shù)  
SQL> select segment_name , header_file , header_block,blocks        
  2  from dba_segments  
  3  where segment_name = 'TB_TMP' and owner='SCOTT';
SEGMENT_N HEADER_FILE HEADER_BLOCK     BLOCKS
--------- ----------- ------------ ----------
TB_TMP             18          130       1280
  
4 使用rman對該數(shù)據(jù)文件進(jìn)行一次備份
$ $ORACLE_HOME/bin/rman target /  
RMAN> backup datafile 18 tag=health;

Starting backup at 12-JUN-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00018 name=/ora11gSource/ora11g/tbs_tmp.dbf
channel ORA_DISK_1: starting piece 1 at 12-JUN-18
channel ORA_DISK_1: finished piece 1 at 12-JUN-18
piece handle=/ora11gSource/zhida/ORA11G/backupset/2018_06_12/o1_mf_nnndf_HEALTH_fkz35h7r_.bkp tag=HEALTH comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-JUN-18

5 人為制造一個單塊數(shù)據(jù)塊的損壞
使用linux自帶的dd命令來損壞單塊數(shù)據(jù)塊  
ora11g[redora]/home/ora11g>dd of=/ora11gSource/ora11g/tbs_tmp.dbf bs=8192 conv=notrunc seek=130 <> Corrupted block!
> EOF
0+1 records in
0+1 records out
17 bytes (17 B) copied, 5.9505e-05 seconds, 286 kB/s

6 觸發(fā)壞塊所在對象  
清空buffer cache 
conn scott/tiger; 
alter system flush buffer_cache;  
查詢表對象 tb_tmp,收到ORA-01578  
SQL> select count(*) from tb_tmp;  
select count(*) from tb_tmp
                     *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 18, block # 130)
ORA-01110: data file 18: '/ora11gSource/ora11g/tbs_tmp.dbf'
查詢視圖v$database_block_corruption,提示有壞塊,注意該視圖可能不會返回任何數(shù)據(jù),如無返回,先執(zhí)行backup validate  
SQL> select * from v$database_block_corruption;  
     FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
        18        130          1                  0 CORRUPT
  
7 使用dbv工具來校驗(yàn)壞塊
ora11g[redora]/home/ora11g>dbv file=/ora11gSource/ora11g/tbs_tmp.dbf feedback=1000
DBVERIFY: Release 11.2.0.4.0 - Production on Wed Jun 13 10:25:13 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /ora11gSource/ora11g/tbs_tmp.dbf
Page 130 is marked corrupt
Corrupt block relative dba: 0x04800082 (file 18, block 130)
Bad header found during dbv: 
Data in bad block:
 type: 67 format: 7 rdba: 0x65747075
 last change scn: 0x636f.6c622064 seq: 0x6b flg: 0x21
 spare1: 0x72 spare2: 0x72 spare3: 0x0
 consistency value in tail: 0x8d8d2301
 check value in block header: 0xc50a
 block checksum disabled
..
DBVERIFY - Verification complete
Total Pages Examined         : 1536
Total Pages Processed (Data) : 1196
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 154
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 185
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 939342345 (3332.939342345)  

8 下面使用blockrecover來恢復(fù)壞塊        
RMAN> blockrecover datafile 18 block 130;

Starting recover at 13-JUN-18
using channel ORA_DISK_1
searching flashback logs for block images until SCN 14311770329033
finished flashback log search, restored 1 blocks

starting media recovery
media recovery complete, elapsed time: 00:00:07

Finished recover at 13-JUN-18
  
9 驗(yàn)證修復(fù)效果
再次查詢表tb_emp正常  
SQL> select count(*) from tb_tmp;  
  
  COUNT(*)  
----------  
     72449  

ora11g[redora]/home/ora11g>dbv file=/ora11gSource/ora11g/tbs_tmp.dbf feedback=1000
DBVERIFY: Release 11.2.0.4.0 - Production on Wed Jun 13 10:26:31 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /ora11gSource/ora11g/tbs_tmp.dbf
..
DBVERIFY - Verification complete
Total Pages Examined         : 1536
Total Pages Processed (Data) : 1196
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 155
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 185
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 939342345 (3332.939342345)

以上是“Oracle中基于RMAN如何實(shí)現(xiàn)壞塊介質(zhì)恢復(fù)”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!


網(wǎng)頁題目:Oracle中基于RMAN如何實(shí)現(xiàn)壞塊介質(zhì)恢復(fù)
網(wǎng)頁路徑:http://weahome.cn/article/gjeicd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部