Four Methods for checking data block consistency

Source: Internet
Author: User


Four methods of data block consistency check (I) What is data block consistency? Www.2cto.com each data block header has a "checksum" field. When the data block is written back to the disk, Oracle recalculates the checksum and records the field, finally written back to the disk next time the data block is read into the memory, Oracle will re-calculate the data block checksum and compare with the value in the checksum field if there is a difference, Oracle will throw the ORA-1578, that is, the entire verification process: When writing back, calculating and saving the read, calculating and comparing www.2cto.com with the checksum field is called the physical consistency check, which focuses on hardware faults, if the content is correct or not, and the logical consistency check takes over the task, for example, whether the record corresponds to the index, whether the record is locked by a non-existent transaction, etc. db_block_checksum: when the physical consistency check value is true, in addition to checking the data blocks of all tablespaces, Oracle also checks the redo log blocks. If this parameter is set to false, we recommend that you enable this parameter only for data blocks in the system tablespace. Db_block_checking: when the value of the logical consistency check is false, only the logical consistency check on the system tablespace has a great impact on the performance, DBV checks the physical and logical consistency of data files but does not check the matching of indexes. For details, see my previous blog: use of the Oracle tool dbv ② analyze also performs the physical and logical consistency check to check the matching between the table and the index. If the check fails, the problem will be placed in the trc file of USER_DUMP_DEST. analyze checks object consistency Syntax: analyze table table_name validate structure cascade online (offline) Note: (1) cascade: it can be confirmed that each record has a corresponding index (2) online: online consistency check, but does not collect object statistics (3) offline: Object statistics can be collected, but only tables It will be locked. (4) When checking whether the records in the Partition Table are correctly partitioned, you can put the checked rowid in the special table invalid_rows before running: $ ORACLE_HOME/rdbms/admin/utlvalid. syntax of the SQL Script: analyze table table_name validate structure into invalid_rows; as this command is also important, I will write a blog to introduce it! ③ When RMAN is used for backup, data blocks are read into the read buffer zone of rman, and then copied to the write buffer zone of rman, finally, from the write buffer to the physical media, during the copy process from the read buffer to the write buffer, rman checks the data block consistency Syntax: backup check logical validate; note: this command only performs consistency check and does not store the backup check results in v $ database_block_corruption logical: Performs logical consistency check validate: performs physical consistency check. Example: backup check logical validate datafile 1; in addition to checking data files, rman can also check the file syntax that has been backed up: restore validate example: Check the database Backup restore validate database; check the backup control file restore validate controlfile to '/u01 /.... '; check the archive log file restore validate archivelog from sequence x until sequence y; ④ dbms_repair discovers, identifies, and modifies Bad blocks in the data file. However, using this package may result in data loss, inconsistent data returned from tables and indexes, and damage to integrity constraints, dbms_repair is only a method used without backup. This method usually causes data loss. The dbms_repair package works in a simple way and marks the detected Bad blocks, when subsequent dml operations skip this block, the dbms_repair package also provides a key value used to save the index that is marked as a bad block, note that the dbms_repair package is not authorized and can only be executed by sys users.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.