Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Oracle fix_corrupt_blocks

Oracle Database Tips by Donald BurlesonApril 29, 2015

Question:  How do I use the dbms_repair procedure fix_corrupt_blocks?

Answer:  The dbms_repair utility provides a mechanism to repair the corrupt database blocks, which is the fix_corrupt_blocks procedure.  Corrupt blocks are not really repaired, but instead are simply marked as corrupt. and bypassed.

 

Below is the syntax for the fix_corrupt_blocks procedure.  Note that the only OUT parameter is the fix_count.

 

dbms_repair.FIX_CORRUPT_BLOCKS (

   schema_name       IN  VARCHAR2,

   object_name       IN  VARCHAR2,

   partition_name    IN  VARCHAR2       DEFAULT NULL,
  
object_type       IN  BINARY_INTEGER DEFAULT TABLE_OBJECT,

   repair_table_name IN  VARCHAR2       DEFAULT 'REPAIR_TABLE',
  
flags             IN  BINARY_INTEGER DEFAULT NULL,

   fix_count         OUT BINARY_INTEGER);

  • schema_name - The name of the schema containing the object with corrupt blocks.

  • object_name - The name of the object needing repair.

  • partition_name - The name of the partition or subpartition to process.  If none is specified and the object is partitioned, all partitions will be processed.

  • object_type - Either table_object or index_object as specified as an enumeration.

  • repair_table_name - The name of the repair table.

  • flags - Not used.

  • fix_count  - The number of blocks fixed.  This should equal the same number of corrupt blocks reported.

If the object repaired is a table, then any corresponding index also needs to be fixed.  The dump_orphan_keys procedure will indicate if any keys are broken.  If they are, the index will need to be rebuilt. 

The dbms_repair utility provides a mechanism to rebuild the impacted freelists and bitmap entries after fixing block corruption.  This procedure recreates the header portion of the datafile, allowing Oracle to use the newly repaired blocks.

 

Below is the syntax for the rebuild_freelists procedure:

 

dbms_repair.REBUILD_FREELISTS (

   schema_name    IN VARCHAR2,  
   partition_name IN VARCHAR2       DEFAULT NULL,
   object_type    IN BINARY_INTEGER DEFAULT TABLE_OBJECT);

 

  • schema_name - The name of the schema containing the object whose freelists need rebuilding.  

  • partition_name - The name of the partition or subpartition whose freelists are to be rebuilt.

  • object_type - Either TABLE_OBJECT or INDEX_OBJECT as specified as an enumeration.

Dbms_repair provides a new method of addressing ORA-600 errors dealing with block corruption.   The utility is very easy to use and very functional.  As described earlier, it is one of many potential solutions when resolving block corruption.  Dbms_repair does basically the same thing as analyze_table -validate structure.

 

Managing files on the Oracle server have been reviewed.  In the next section, the managing of user processes on the Oracle server will be detailed.

The Orakill Server Process Utility

In Windows, there are a couple of kill utilities: the Oracle-centric orakill utility and the Windows taskkill program.  The kill utilities should be used as a last resort only. If the session cannot be killed more gracefully via alter system kill session, or the instance is inaccessible via SQL, then orakill should be used to terminate the offending session.  Access to the Windows machine containing the database must be secure to use orakill. Any user with access to the box could access orakill or the Windows Task Manager and damage database processes. 

 

The Windows command to kill this session would be as follows:

 

    C:\Oracle\bin>orakill ORCL92 768

 

In this example, the Windows thread corresponding to the Oracle session can be killed in the operating system without ever logging into the database. For another example, the Windows command to kill a session would be:

 

   C:\Oracle\bin>orakill ORCL92 768


In this example, the thread (Oracle session) was killed in the operating system without ever logging into the database. Before killing the session, the DBA may decide to view the SQL being executed by the session. This can be obtained by using the TID above (300) in the following SQL statement:

 

  select
   b.username, a.sql_text
  from
  v$sqltext_with_newlines a, v$session b, v$process c
  where
   c.spid = to_number('300', 'xxx')
  and
   c.addr = b.paddr
  and
   b.sql_address = a.address;  
 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster