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.
|