select file_id, block_id, blocks from dba_extents where owner =  LILC  and segment_na..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

利用dbms_repair來標記和跳過壞塊

發(fā)布時間:2020-08-15 11:47:58 來源:網(wǎng)絡 閱讀:1046 作者:llc018198 欄目:關系型數(shù)據(jù)庫
SQL> select file_id, block_id, blocks from dba_extents where owner = 'LILC' and segment_name = 'TEST';
,,,,,
 610624    1024
 611648    1024
83 rows selected.

破壞之前的數(shù)據(jù):

SQL> select count(*) from test;

  COUNT(*)

----------

    783018

RMAN> recover datafile 6 block 11620 clear;

RMAN> recover datafile 6 block 4467 clear;

RMAN> backup check logical validate datafile 6;

Starting backup at 23-SEP-15

using channel ORA_DISK_1

using channel ORA_DISK_2

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00006 name=+DATA/phub/datafile/llc01.dbf

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

List of Datafiles

=================

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN

---- ------ -------------- ------------ --------------- ----------

6    FAILED 0              20           12800           1991935   

  File Name: +DATA/phub/datafile/llc01.dbf

  Block Type Blocks Failing Blocks Processed

  ---------- -------------- ----------------

  Data       2              12140           

  Index      0              329             

  Other      1              311             

validate found one or more corrupt blocks

See trace file /u01/app/oracle/diag/rdbms/phub/PHUB/trace/PHUB_ora_29666.trc for details

Finished backup at 23-SEP-15

數(shù)據(jù)查詢肯定報錯:

SQL> select count(*) from test;

select count(*) from test

*

ERROR at line 1:

ORA-01578: ORACLE data block corrupted (file # 6, block # 4467)

ORA-01110: data file 6: '+DATA/phub/datafile/llc01.dbf'

skip_corrupt_blocks來跳過壞塊:

SQL> exec dbms_repair.skip_corrupt_blocks(schema_name => 'LILC',object_name => 'TEST',flags => 1);

PL/SQL procedure successfully completed.

SQL> conn lilc/lilc;

Connected.

SQL> select count(*) from test;


  COUNT(*)

----------

    782884


這里少了34條數(shù)據(jù)

修復壞塊;

RMAN> recover datafile 6 block 11620

2> ;

Starting recover at 23-SEP-15

using channel ORA_DISK_1

using channel ORA_DISK_2

finished standby search, restored 1 blocks

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 23-SEP-15

RMAN> recover datafile 6 block 4467

Starting recover at 23-SEP-15

using channel ORA_DISK_1

using channel ORA_DISK_2

finished standby search, restored 1 blocks

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 23-SEP-15

數(shù)據(jù)正常:

SQL> select count(*) from test;


  COUNT(*)

----------

    783018


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI