How to check Database corrupt Block
This short article describes several features of Oracle which may be
used on new databases to help detect problems as close to when they
occur as possible. Some of these features are publicly documented
and some are not. All should be used with extreme care.
DBVERIFY
~~~~~~~~
DBVERIFY (also known as DBV) performs similar checks to the block
checking described above but it is a stand alone tool which can
be run against an Oracle datafile. Most Unix platforms allow DBV
to be run on an open database file but NT, VMS and other platforms
that use file level locking prevents this.
DBVERIFY checks data and index blocks and is supplied as standard
from Oracle 7.3 onwards. As of 8.1.6 addition block types are also
checked.
ANALYZE TABLE tablename VALIDATE STRUCTURE CASCADE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This SQL command allows Oracle to perform a health check on the
named table and any related indexes.
What does it do ?
The 'ANALYZE ... VALIDATE ..' command performs the same block checks
as the logical block checking above but does NOT mark blocks as
corrupt. It also checks that table and index entries match.
Any problems found are reported into the user session trace file
in USER_DUMP_DEST.
You can specify that you want to perform structure validation online
while DML is occurring against the object being validated.
There can be a slight performance impact when validating with ongoing
DML affecting the object, but this is offset by the flexibility of being
able to perform ANALYZE online.
ANALYZE TABLE
When you validate the structure of an object ONLINE, Oracle Database
does not collect any statistics, as it does when you validate the
structure of the object OFFLINE.
For a table, Oracle Database verifies the integrity of each of the data
blocks and rows.
For an index-organized table, the database also generates compression
statistics (optimal prefix compression count) for the primary key index
on the table.
For a cluster, Oracle Database automatically validates the structure of
the cluster tables.
For a partitioned table, Oracle Database also verifies that each row belongs
to the correct partition.
If a row does not collate correctly, then its rowid is inserted into the
INVALID_ROWS table.
Script UTLVALID.SQL is used to create invalid_rows table.
ANALYZE TABLE
For an index, Oracle Database verifies the integrity of each data block
in the index and checks for block corruption.
This clause does not confirm that each row in the table has an index
entry or that each index entry points to a row in the table.
You can perform these operations by validating the
structure of the table with the CASCADE clause.
Benefits
This allows important tables to be regularly checked for corruptions
during a convenient timeslot.
Disadvantages
The command takes system resource and time to run.
When ran OFFLINE is locking the object.
Using ANALYZE
This is a standard SQL command so can be issued against any table
whenever required. It is advisable to have a script pre-prepared to
check all the major application tables using this feature.
DBMS_REPAIR
~~~~~~~~~~~
DBMS_REPAIR is a package introduced in Oracle 8.1.5.
The DBMS_REPAIR.CHECK_OBJECT procedure can be used to perform
the same type of checking that ANALYZE TABLE ... VALIDATE STRUCTURE
performs.
The DBMS_REPAIR package is used to work with corruption in the
transaction layer and the data layer only (software corrupt blocks).
Blocks with physical corruption (ex. fractured block) are marked as
the block is read into the buffer cache and DBMS_REPAIR ignores all
blocks marked corrupt.
DB_BLOCK_CHECKING and DB_BLOCK_CHECKSUM must both be set to FALSE.
DBMS_REPAIR procedures have the following limitations:
a.Tables with LOB datatypes, nested tables, and varrays are supported,
but the out of line columns are ignored.
b.Clusters are supported in the SKIP_CORRUPT_BLOCKS and REBUILD_FREELISTS procedures,
but not in the CHECK_OBJECT procedure.
c.Index-organized tables and LOB indexes are not supported.
d.The DUMP_ORPHAN_KEYS procedure does not operate on bitmap indexes or function-based indexes.
e.The DUMP_ORPHAN_KEYS procedure processes keys that are no more than 3,950 bytes long.
f.DBMS_REPAIR makes the object usable by ignoring corruptions during table and index scans,
Using the FIX_CORRUPT_BLOCKS and SKIP_CORRUPT_BLOCKS Procedures
RMAN
~~~~
RMAN can be used to check for both logical and physical corruption.
During a RMAN backup or RMAN 'backup validate' every block currently
used or previously used is read into memory then written to another
portion of memory.
During this memory to memory write the block is checked for corruption.
Therefore RMAN's BACKUP command with the VALIDATE and CHECK LOGICAL
clauses allow a Database Adminstrator to quickly check for both physical
and logical corruption.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/38542/viewspace-980866/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SUPTOOL: BBED - 7.3.2+ Database Block Editor(轉)DatabaseBloC
- How to Collect Diagnostics for Database Hanging Issues (Doc ID 452358.1)Database
- [20221222]How to Enable and Disable Database Options in oracle 11g.txtDatabaseOracle
- onclick="return check()" 和 onclick="check()" 區別
- ORA-19599 When Backing up an Archivelog that is CorruptHive
- 打 patch 報錯:corrupt patch at line 36
- BlockBloC
- Block學習①--block的本質BloC
- Unused Block Compression和Null Block CompressionBloCNull
- Check if String is HappyAPP
- __block使用BloC
- How to ssh
- Block學習②--block的變數捕獲BloC變數
- iOS block巢狀block中weakify的使用iOSBloC巢狀
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- CHECK_INTERFACE作用
- check_document_position
- SAP WM中階Storage Type的Capacity Check – Usage check based on SUT
- Oracle Database Cloud - Database as a Service Quick StartOracleDatabaseCloudUI
- Error querying database. XXXXXXXXXXXXX, No database selected。ErrorDatabase
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- iOS Block探究iOSBloC
- Git 錯誤:fatel: loose object ... is corrupt 解決辦法GitObject
- Extract rows from a CORRUPT table creating ROWID from DBA_EXTENTS
- ext4 lvreduce報錯superblock or the partition table is likely to be corruptVRBloC
- How to find dependency
- Block學習⑤--block對物件變數的捕獲BloC物件變數
- [LintCode] Check Full Binary Tree
- Mysql replication check指令碼MySql指令碼
- Check connection related issue of mysqlMySql
- 括展actuator health check
- check memcached process and restart if downREST
- SAP WM中階儲存型別的Capacity Check – Usage check based on material型別
- Database TimeoutDatabase
- Database OverallDatabase
- database no shardingDatabase
- Block的型別BloC型別
- block實現原理BloC
- E. Block SequenceBloC