Three ways to repair database broken blocks with Oracle8i

xiaoxiao2021-03-06  32

In the case of Sun Cluster dual switching, unexpected power failure or other cases, sometimes the shared disk mount is not on, you need to use FSCK to fix the shared disk. After the repair is completed, the phenomenon of "data block corruption, unable to start the database" occurs during the database startup, at this time, the error can be detected and repaired according to different data blocks. Here is three ways to use Oracle8i to repair damage to damaged data blocks.

First, the data block is damaged, the error code is ORA-01578

ORA-1115 I / O Error Reading Block

Usually followed by ORA-737x errors and operating system errors (such as error number in UNIX)

cause:

1. Hardware problem (disk controller problem or disk problem)

2. Physical grade data block is damaged (usually caused by the previous cause)

3. When processing a giant file, followed by error code ORA-7371

Determining the cause of the fault and recovery:

1. View the occurrence of other ORA-1115 errors in the alert.log file:

1) If you point to a file of different disks, the problem of disk controller, view V $ datafile, and which files are located under the controller and go to the second step.

2) If you point to different files of the same disk, it is a problem with the disk and goes to the second step.

3) If you point to the same file, perform the following statement to find the file name:

Select segment_name, segment_type from dba_extents where file_id = and Between block_id and block_id blocks-1;

Where the file number is pointed out in ORA-1115, if the query continues to point to a table or an index, rebuild them.

2. If the file is System table space, or in the noarchiveLog mode, turn off the database, go to the fourth step.

3. If the database is in ArchiveLog mode, the database should still be turned off. If the database cannot be closed, the corresponding data file is offline: ALTER DATABASE DATAFILE 'file name' OFFLINE;

4. Try to copy the data file to another disk.

5. If the copy fails, the file will be lost.

6. Startup mount;

7. Rename the data file as a file name that successfully copied to another disk:

ALTER DATABASE RENAME FILE 'Old Path File Name' to 'New Path File Name

8. ALTER DATABASE OPEN

9. Recover DataFile file name;

ALTER DATABASE DATAFILE 'file name' online;

Second, the rollback segment needs to be recovered

If the spur segment is in the NEED Recovery status, you need to perform the following steps to recover:

1. See all online tablespaces and data files

2. Add Event = "10015 Trace Name Context Forever, Level 10" in the init.ora file, which will generate a tracking file containing information about the transaction and rollback.

3. Close and reopen the database.

4. View the trace file, there should be Error Recovery TX (#, #) Object # .tx (#, #), pointing out transaction information, where Object # is the same as Object_ID in sys.dba_objects. 5. Use the following query to find out the object being recovered:

Select Owner, Object_name, Object_Type, Status from DBA_Objects Where Object_ID = ;

6. This object must be deleted to release the rollback block.

Third, the common method of detecting and repairing damaged blocks:

(1) Use the initialization parameter db_block_checking with db_block_checksum.

DB_BLOCK_CHECKING is logically verified when the block changes. The occurrence of 10210 and 10211 errors will be prevented.

(2) Use the DBMS_REPAIR package, generated by dbmsrpr.sql and prvtrprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprprise generated information in a particular table.

1. DBMS_REPAIR.ADMIN_TABLES is used to create a table with deleting storage corruption blocks. Where Table_Type is: REPAIR_TABLE, OPHAN_TABLE (index); action is: create_action, purge_action (deleted data), DROP_ACTION. example:

DBMS_REPAIR.ADMIN_TABLES ('REPAIR_TABLE', DBMS_REPAIR.REPAIR_TABLE, DBMS_REPAIR.CREATE_ACITION, 'TEMP_DATA');

2. DBMS_REPAIR.CHECK_OBJECT checkscripts, index, block damage in the partition. Where Object_Type is: Table_Object (Table), INDEX_Object (index), repair_table_name (for the table for storing damage to block information). example:

DBMS_REPAIR.CHECK_OBJECT ('ORATRAIN', 'LOCATION', CORRUPT_COUNT =>: CC);

3. Use the following statement to query the block corruption information:

Select Object_name, relative_file_no, block_id, marked_corrupt, corrupt_description, repair_description from repair_table;

4. The block mark is damaged: dbms_repair.fix_corrupt_blocks ('ORATRAIN', 'LOCATION', FIX_COUNT =>: Fc);

5. Skip damaged blocks: dbms_repair.skip_corrupt_blocks ('ORATRAIN', 'LOCATION');

Where Object_Type is: Table_Object (Table), Cluster_Object (Index).

6. Reconstruction of damaged idle lists using Rebuild_Freelists: dbms_repair.rebuild_freeelists7. Use the following methods to find the index of corrugation blocks:

(1) Creating a table with a memory index

(2) DBMS_REPAIR.DUMP_ORPHAN_KEYS ('ORATRAIN', 'LOC_PK',

Orpha_table_name => 'orphan_tab1', key_count =>: kc);

(3) SELECT INDEX_NAME, Count (*) from orphan_key_table where table_name = 'classes' group by index_name;

(4) Reconstruction of indexes with Orpha KEYS

Limit: Index-Organized Tables and LOB INDEXES, DUMP_ORPHAN_KEYS cannot operate with Bitmap with Function-Based Indexes.

(3) Using SQL Command Analyze Table | INDEX ... VALIDATE STRUCTURE

UTLVALID.SQL. Create an Invalid_Rows table with corrupted block information, Analyze Table Validate Structure Cascade simultaneously checks the table and index.

(4) Using dbverify

DBVERIFY is an external tool, so it has little impact on the database. It can be used to verify the integrity of the backup file before copying the backup file back to the original position, and position the data block corruption. The command is as follows:

DBV /OPT/Orcle/db02/oradata/data01.dbf start = 1 end = 500 logfile = dbv.log

转载请注明原文地址:https://www.9cbs.com/read-62612.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.048, SQL: 9