To diagnose and repair corruptions in Locally Managed Tablespaces Oracle has supplied a package called DBMS_SPACE_ADMIN. This package has many procedures described below:
Procedure |
Description |
SEGMENT_VERIFY |
Verifies the consistency of the extent map of the segment. |
SEGMENT_CORRUPT |
Marks the segment corrupt or valid so that appropriate error recovery can be done. Cannot be used for a locally managed SYSTEM tablespace. |
SEGMENT_DROP_CORRUPT |
Drops a segment currently marked corrupt (without reclaiming space). Cannot be used for a locally managed SYSTEM tablespace. |
SEGMENT_DUMP |
Dumps the segment header and extent map of a given segment. |
TABLESPACE_VERIFY |
Verifies that the bitmaps and extent maps for the segments in the tablespace are in sync. |
TABLESPACE_REBUILD_BITMAPS |
Rebuilds the appropriate bitmap. Cannot be used for a locally managed SYSTEM tablespace. |
TABLESPACE_FIX_BITMAPS |
Marks the appropriate data block address range (extent) as free or used in bitmap. Cannot be used for a locally managed SYSTEM tablespace. |
TABLESPACE_REBUILD_QUOTAS |
Rebuilds quotas for given tablespace. |
TABLESPACE_MIGRATE_FROM_LOCAL |
Migrates a locally managed tablespace to dictionary-managed tablespace. Cannot be used to migrate a locally managed SYSTEM tablespace to a dictionary-managed SYSTEM tablespace. |
TABLESPACE_MIGRATE_TO_LOCAL |
Migrates a tablespace from dictionary-managed format to locally managed format. |
TABLESPACE_RELOCATE_BITMAPS |
Relocates the bitmaps to the destination specified. Cannot be used for a locally managed system tablespace. |
TABLESPACE_FIX_SEGMENT_STATES |
Fixes the state of the segments in a tablespace in which migration was aborted. |
Be careful using the above procedures if not used properly you will corrupt your database. Contact Oracle Support before using these procedures.
Following are some of the Scenarios where you can use the above procedures
The TABLESPACE_VERIFY procedure discovers that a segment has allocated blocks that are marked free in the bitmap, but no overlap between segments is reported.
In this scenario, perform the following tasks:
You cannot drop a segment because the bitmap has segment blocks marked "free". The system has automatically marked the segment corrupted.
In this scenario, perform the following tasks:
The TABLESPACE_VERIFY procedure reports some overlapping. Some of the real data must be sacrificed based on previous internal errors.
After choosing the object to be sacrificed, in this case say, table t1, perform the following tasks:
A set of bitmap blocks has media corruption.
In this scenario, perform the following tasks:
To migrate a dictionary-managed tablespace to a locally managed tablespace. You use the TABLESPACE_MIGRATE_TO_LOCAL procedure.
For example if you want to migrate a dictionary managed tablespace ICA2 to Locally managed then give the following command.
EXEC DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL ('ica2');
Interface Computers Academy © 2007-2017 All Rights Reserved