Oracle DBMS_SPACE_ADMIN
Version 21c

General Information
Library Note Morgan's Library Page Header
ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling complimentary technical Workshops on Database Security for the first 30 Oracle Database customers located anywhere in North America, EMEA, LATAM, or APAC that send an email to asra_us@oracle.com. Request a Workshop for your organization today.
Purpose Provides tablespace/segment space administration not available through the standard sql such as support for locally managed tablespaces.
AUTHID DEFINER
Constants
Name Data Type Value
 General
SEGMENT_VERIFY_EXTENTS POSITIVE 1
SEGMENT_VERIFY_EXTENTS_GLOBAL POSITIVE 2
SEGMENT_MARK_CORRUPT POSITIVE 3
SEGMENT_MARK_VALID POSITIVE 4
SEGMENT_DUMP_EXTENT_MAP POSITIVE 5
TABLESPACE_VERIFY_BITMAP POSITIVE 6
TABLESPACE_EXTENT_MAKE_FREE POSITIVE 7
TABLESPACE_EXTENT_MAKE_USED POSITIVE 8
SEGMENT_VERIFY_BASIC POSITIVE 9
SEGMENT_VERIFY_DEEP POSITIVE 10
SEGMENT_VERIFY_SPECIFIC POSITIVE 11
HWM_CHECK POSITIVE 12
BMB_CHECK POSITIVE 13
SEG_DICT_CHECK POSITIVE 14
EXTENT_TS_BITMAP_CHECK POSITIVE 15
DB_BACKPOINTER_CHECK POSITIVE 16
EXTENT_SEGMENT_BITMAP_CHECK POSITIVE 17
BITMAPS_CHECK POSITIVE 18
TS_VERIFY_BITMAPS POSITIVE 19
TS_VERIFY_DEEP POSITIVE 20
TS_VERIFY_SEGMENTS POSITIVE 21
SEGMENT_DUMP_BITMAP_SUMMARY POSITIVE 27
 NGLOB + Heat Map
NGLOB_HBB_CHECK POSITIVE 12
NGLOB_FSB_CHECK POSITIVE 13
NGLOB_PUA_CHECK POSITIVE 14
NGLOB_CFS_CHECK POSITIVE 15
HEAT_MAP_MAXSIZE_UNLIMITED POSITIVE 16
 ATTR Constants
ATTR_DISABLE NUMBER 0
ATTR_ENABLE NUMBER 1
 COMP Constants
COMP_ADVISOR NUMBER 1
COMP_LOB NUMBER 2
 Segment Repair
SEGMENT_REPAIR_METADATA POSITIVE 1
Dependencies
DBA_LOBS DBMS_SPACE_ADMIN_LIB USER$
DBA_LOB_PARTITIONS DBMS_STANDARD USER_SEGMENTS
DBA_LOB_SUBPARTITIONS DBMS_STATS_INTERNAL USER_TS_QUOTAS
DBA_SEGMENTS OBJ$ UTL_ALL_IND_COMPS
DBA_SEGMENTS_OLD PRVT_ILM WRI$_SEGADV_ATTRIB
DBA_TABLES SM$TS_USED _utl$_gnp_ind
DBA_TAB_COLUMNS SYS_UNCOMPRESSED_SEGS _utl$_gp_ind_parts
DBA_TS_QUOTAS TBS_SPACE_USAGE _utl$_lc_ind_subs
DBMS_PLUGTS TS_PITR_OBJECTS_TO_BE_DROPPED _utl$_lnc_ind_parts
DBMS_SPACE    
Documented Yes
Exceptions
Error Code Reason
ORA-00959 tablespace '<tablespace_name>' does not exist
ORA-38327 invalid_argument_value
First Available 8.1.5
Security Model Owned by SYS with no privileges granted
Source {ORACLE_HOME}/rdbms/admin/dbmsspc.sql
Subprograms
 
GET_SEGADV_ATTRIB
Gets an attribute of space administration ... but do not know which one. The only values accepted are 1 or 2. the default value is 1 but the value can also be set to 0. dbms_space_admin.get_segadv_attrib(
attribute IN  NUMBER, -- must be 1 or 2
value     OUT NUMBER);
DECLARE
  retVal NUMBER;
BEGIN
  dbms_space_admin.get_segadv_attrib(1, retVal);
  dbms_output.put_line(retVal);
END;
/
 
SET_SEGADV_ATTRIB
Add an attribute for space administration purpose dbms_space_admin.set_segadv_attrib(
attribute IN NUMBER,
value     IN NUMBER);
exec dbms_space_admin.set_segadv_attrib(1, 0);
 
ASSM_SEGMENT_SYNCHWM
Synchronize HWMs of the ASSM segment

Returns 1 if the segment requires HWM synchronization: Otherwise returns 0
dbms_space_admin.assm_segment_synchwm(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2 DEFAULT NULL,
check_only     IN NUMBER DEFAULT 1) RETURN PLS_INTEGER;
conn / as sysdba

SELECT tablespace_name, segment_space_management
FROM dba_tablespaces;

SELECT DISTINCT owner
FROM dba_all_tables
WHERE tablespace_name = 'EXAMPLE';

SELECT dbms_space_admin.assm_segment_synchwm('SH', 'SALES', 'TABLE', NULL, 1)
FROM dual;

SELECT partition_name
FROM dba_tab_partitions
WHERE table_owner = 'SH'
AND table_name = 'SALES';

SELECT DISTINCT segment_type
FROM dba_segments
ORDER BY 1;

SELECT dbms_space_admin.assm_segment_synchwm('SH', 'SALES', 'TABLE PARTITION', 'SALES_Q3_2000', 1)
FROM dual;
 
ASSM_SEGMENT_VERIFY
Verifies the basic consistency of the space metadata blocks as well as consistency between space metadata and segment data blocks dbms_space_admin.assm_segment_verify(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2,
verify_option  IN POSITIVE DEFAULT SEGMENT_VERIFY_BASIC,
attrib         IN POSITIVE DEFAULT NULL);
exec dbms_space_admin.assm_segment_verify('SH', 'TIMES', 'TABLE', NULL, 10);
 
ASSM_TABLESPACE_VERIFY
Verifies all the segments created in an ASSM tablespace dbms_space_admin.assm_tablespace_verify(
tablespace_name IN VARCHAR2,
ts_option       IN POSITIVE,
segment_option  IN POSITIVE DEFAULT NULL);
exec dbms_space_admin.assm_tablespace_verify('EXAMPLE', 20, 10);
 
DROP_EMPTY_SEGMENTS
Drops segments from empty tables or table fragments and dependent segments dbms_space_admin.drop_empty_segments(
schema_name    IN VARCHAR2 DEFAULT NULL,
table_name     IN VARCHAR2 DEFAULT NULL,
partition_name IN VARCHAR2 DEFAULT NULL);
exec dbms_space_admin.drop_empty_segments;
 
FLUSH_LOBSEGMENT_STAT
Undocumented dbms_space_admin.flush_lobsegment_stat;
exec dbms_space_admin.flush_lobsegment_stat;
 
HEAT_MAP_SEGMENT_DROP
Drops the HEATMAP segment created in the SYSAUX tablespace dbms_space_admin.heat_map_segment_drop;
exec dbms_space_admin.heat_map_segment_drop;
 
HEAT_MAP_SEGMENT_SETMAXSIZE
Set the MAXSIZE, specified in datafile bocks, for the storage clause for HEATMAP the segment to limit its growth dbms_space_admin.heat_map_segment_setmaxsize(
maxsize IN BINARY_INTEGER DEFAULT HEAT_MAP_MAXSIZE_UNLIMITED);
exec dbms_space_admin.heat_map_segment_setmaxsize(1000);
 
IMC_AREA_DUMP
Procedure to dump in memory area dbms_space_admin.imc_area_dump;
exec dbms_space_admin.imc_area_dump;

Trace file C:\APP\ORACLE\diag\rdbms\orabase\orabase\trace\orabase_ora_5684.trc
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Windows NT Version V6.1 Service Pack 1
CPU : 4 - type 8664, 2 Physical Cores
Process Affinity : 0x0x0000000000000000
Memory (Avail/Total): Ph:4970M/8075M, Ph+PgF:13009M/16148M
Instance name: orabase
Redo thread mounted by this instance: 1
Oracle process number: 49
Windows thread id: 5684, image: ORACLE.EXE (SHAD)


*** 2014-11-28 14:35:21.277
*** SESSION ID:(124.64307) 2014-11-28 14:35:21.277
*** CLIENT ID:() 2014-11-28 14:35:21.277
*** SERVICE NAME:(SYS$USERS) 2014-11-28 14:35:21.277
*** MODULE NAME:(sqlplus.exe) 2014-11-28 14:35:21.277
*** CLIENT DRIVER:(SQL*PLUS) 2014-11-28 14:35:21.277
*** ACTION NAME:() 2014-11-28 14:35:21.277
*** CONTAINER ID:(1) 2014-11-28 14:35:21.277

In Memory Columnar Area 1 MB Pool Dump
---------------------------------
Flag:0x3 IMCAsize:418381824 UnitsPerSB:64
Number of SLCB Metadata Blocks: 7
Dump of SLCB Metadata Block: 0
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fe1490: Data Area Size: 64: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 78000000 Flag:0x2
Length of Data Area: 64 Max Bits: 64 Free Bits:64
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 1
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fdf340: Data Area Size: 64: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 73ffffe8 Flag:0x2
Length of Data Area: 64 Max Bits: 64 Free Bits:64
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 2
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fdd1f0: Data Area Size: 64: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 6fffffd0 Flag:0x2
Length of Data Area: 64 Max Bits: 64 Free Bits:64
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 3
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fdb0a0: Data Area Size: 64: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 6bffffb8 Flag:0x2
Length of Data Area: 64 Max Bits: 64 Free Bits:64
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 4
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fd8f50: Data Area Size: 64: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 67ffffa0 Flag:0x2
Length of Data Area: 64 Max Bits: 64 Free Bits:64
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 5
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fd6e00: Data Area Size: 64: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 63ffff88 Flag:0x2
Length of Data Area: 64 Max Bits: 64 Free Bits:64
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 6
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fd4cb0: Data Area Size: 15: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 630fff70 Flag:0x2
Length of Data Area: 15 Max Bits: 15 Free Bits:15
Printing bytes 0 to 32
0000000000000000 0000000000000000
In Memory Columnar Area 64KB Pool Dump
---------------------------------
Flag:0x3 IMCAsize:100663296 UnitsPerSB:1024
Number of SLCB Metadata Blocks: 2
Dump of SLCB Metadata Block: 0
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fca8c0: Data Area Size: 1024: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 5efc8670 Flag:0x2
Length of Data Area: 1024 Max Bits: 1024 Free Bits:1024
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 64 to 96
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 96 to 128
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 128 to 160
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 160 to 192
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 192 to 224
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 224 to 256
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 256 to 288
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 288 to 320
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 320 to 352
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 352 to 384
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 384 to 416
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 416 to 448
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 448 to 480
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 480 to 512
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 512 to 544
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 544 to 576
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 576 to 608
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 608 to 640
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 640 to 672
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 672 to 704
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 704 to 736
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 736 to 768
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 768 to 800
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 800 to 832
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 832 to 864
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 864 to 896
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 896 to 928
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 928 to 960
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 960 to 992
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 992 to 1024
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Dump of SLCB Metadata Block: 1
---------------------------------
NUMA id: 0
Number of SCB Metadata Blocks: 1
Summary Array of SCB Blocks
-----------------------------
Id: 0: Address of SB: 62fc8770: Data Area Size: 512: Free: 100
Description of SB: 0
--------------------------
Start Address of Data Area: 5cfc8658 Flag:0x2
Length of Data Area: 512 Max Bits: 512 Free Bits:512
Printing bytes 0 to 32
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 32 to 64
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 64 to 96
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 96 to 128
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 128 to 160
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 160 to 192
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 192 to 224
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 224 to 256
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 256 to 288
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 288 to 320
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 320 to 352
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 352 to 384
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 384 to 416
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 416 to 448
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 448 to 480
0000000000000000 0000000000000000 0000000000000000 0000000000000000
Printing bytes 480 to 512
0000000000000000 0000000000000000 0000000000000000 0000000000000000
 
IMC_SEGMENT_CREATE
Dummy procedure for creating table/segment in memory columnar dbms_space_admin.imc_segment_create(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2);
TBD
 
IMC_SEGMENT_DROP
Dummy procedure for dropping table/segment in memory columnar dbms_space_admin.imc_segment_drop(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2);
TBD
 
IMC_SEGMENT_LOAD
Dummy procedure for loading in memory columnar segment dbms_space_admin.imc_segment_load(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2,
query          IN BINARY_INTEGER);
TBD
 
IMC_TABLESPACE_CREATE
Dummy procedure for creating in memory columnar tablespace extent map dbms_space_admin.imc_tablespace_create(tablespace_name IN VARCHAR2);
exec dbms_space_admin.imc_tablespace_create('USERS');
 
IMC_TABLESPACE_DROP
Dummy procedure for drop of in memory columnar tablespace extent map dbms_space_admin.imc_tablespace_drop(tablespace_name IN VARCHAR2);
exec dbms_space_admin.imc_tablespace_drop('USERS');
 
IMC_TREE_DUMP
Procedure to dump in memory L1,L2,L3 tree dbms_space_admin.imc_tree_dump;
exec dbms_space_admin.imc_tree_dump;
 
MATERIALIZE_DEFERRED_SEGMENTS
Creates a segment for a table or index previously created and for which a segment does not currently exist dbms_space_admin.materialize_deferred_segments(
schema_name    IN VARCHAR2 DEFAULT NULL,
table_name     IN VARCHAR2 DEFAULT NULL,
partition_name IN VARCHAR2 DEFAULT NULL);
CREATE TABLE t (
testcol VARCHAR2(20));

CREATE INDEX ix_t
ON t(testcol);

SELECT segment_name
FROM user_segments
WHERE segment_name IN ('T', 'IX_T');

exec dbms_space_admin.materialize_deferred_segments;

SELECT segment_name
FROM user_segments
WHERE segment_name IN ('T', 'IX_T');
 
MATERIALIZE_DEFERRED_WITH_OPT
Materialize segments for tables/table fragments with deferred segment creation (and their dependent objects), with an additional option dbms_space_admin.materialize_deferred_with_opt(
schema_name      IN VARCHAR2 DEFAULT NULL,
table_name       IN VARCHAR2 DEFAULT NULL,
partition_name   IN VARCHAR2 DEFAULT NULL,
partitioned_only IN BOOLEAN DEFAULT FALSE);
exec dbms_space_admin.materialize_deferred_with_opt('UWCLASS', 'SERVERS');
 
NGLOB_SEGMENT_VERIFY
Verifies the consistency of the segment dbms_space_admin.nglob_segment_verify(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2,
verify_option  IN POSITIVE DEFAULT SEGMENT_VERIFY_BASIC,
attrib         IN POSITIVE DEFAULT NULL);
-- used only with the verify_option default

Verify Options
DEEP
SEGMENT_VERIFY_BASIC
SPECIFIC
TBD
 
PURGE_LOBSEGMENT_STAT
Undocumented dbms_space_admin.purge_lobsegment_stat;
exec dbms_space_admin.purge_lobsegment_stat;
 
SEGMENT_CORRUPT
Marks the segment corrupt or not corrupt dbms_space_admin.assm_tablespace_verify(
tablespace_name      IN VARCHAR2,
header_relative_file IN POSITIVE,
header_block         IN POSITIVE,
corrupt_option       IN POSITIVE DEFAULT SEGMENT_MARK_CORRUPT);
SELECT relative_fno
FROM dba_data_files
WHERE tablespace_ name = 'EXAMPLE';

SELECT header_block
FROM dba_segments
WHERE tablespace_name = 'EXAMPLE';

-- mark corrupt

exec dbms_space_admin.segment_corrupt('EXAMPLE', 10, 41090, dbms_space_admin.segment_mark_corrupt);

-- mark not corrupt
exec dbms_space_admin.segment_corrupt('EXAMPLE', 10, 41090, dbms_space_admin.segment_mark_valid);
 
SEGMENT_DROP_CORRUPT
Drops a segment currently marked corrupt (without reclaiming space). For this to work, the segment should have been marked temporary. To mark a corrupt segment as temporary, issue a DROP command on the segment. dbms_space_admin.segment_drop_corrupt(
tablespace_name      IN VARCHAR2,
header_relative_file IN POSITIVE,
header_block         IN POSITIVE);
exec dbms_space_admin.segment_drop_corrupt('EXAMPLE', 4, 33);
 
SEGMENT_DUMP
Dumps the segment header and bitmap blocks of a specific segment to the location specified in the USER_DUMP_DEST initialization parameter dbms_space_admin.segment_dump(
tablespace_name      IN VARCHAR2,
header_relative_file IN POSITIVE,
header_block         IN POSITIVE,
dump_option          IN POSITIVE DEFAULT SEGMENT_DUMP_EXTENT_MAP);
SELECT ts#, name
FROM sys.ts$;

-- header type = 5
SELECT distinct type#, block#
FROM sys.seg$
WHERE ts# = 7
AND type# = 5;

exec dbms_space_admin.segment_dump('UWDATA', 6, 9676);
 
SEGMENT_EXTEND
Extends a SecureFile segment dbms_space_admin.segment_extend(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2, -- name of LOB segment
segment_type   IN VARCHAR2, -- values: 'LOB', 'LOB PARTITION', 'LOB SUBPARTITION'
partition_name IN VARCHAR2 DEFAULT NULL,
target_size    IN NUMBER   DEFAULT 1);
-- target size in GB
TBD
 
SEGMENT_MOVEBLOCKS
Moves blocks from the segment header to the process freelist. It only moves blocks if the list is shorter than the minimum size for the move_count blocks. dbms_space_admin.segment_moveblocks(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
partition_name IN VARCHAR2,
segment_type   IN VARCHAR2,
group_id       IN NATURAL,
minimum_size   IN POSITIVE,
move_count     IN POSITIVE,
pause_time     IN NATURAL,
iterations     IN POSITIVE);
TBD
 
SEGMENT_NUMBER_BLOCKS
Returns the number of blocks that belong to the segment. Will return NULL if segment has disappeared.

IS NOT to be used for any other purposes but by the views that need it and are sure that there info is correct. Else internal errors will abound. Ask me how I know.
dbms_space_admin.segment_number_blocks(
header_tablespace_id IN NATURAL,
header_relative_file IN POSITIVE,
header_block         IN POSITIVE,
segment_type         IN POSITIVE,
buffer_pool_id       IN NATURAL,
dictionary_flags     IN NATURAL,
data_object_id       IN NUMBER,
dictionary_blocks    IN NUMBER) RETURN PLS_INTEGER;
Take the warning at the left seriously!
 
SEGMENT_NUMBER_EXTENTS
Returns the number of extents that belong to the segment. Will return NULL if segment has disappeared.

IS NOT to be used for any other purposes but by the views that need it and are sure that there info is correct. Else internal errors will abound. Ask me how I know.
dbms_space_admin.segment_number_extents(
header_tablespace_id IN NATURAL,
header_relative_file IN POSITIVE,
header_block         IN POSITIVE,
segment_type         IN POSITIVE,
buffer_pool_id       IN NATURAL,
dictionary_flags     IN NATURAL,
data_object_id       IN NUMBER,
dictionary_extents   IN NUMBER) RETURN PLS_INTEGER;
Take the warning to the left seriously!
 
SEGMENT_REPAIR
Used to corrupt the segment metadata by enabling event 42221 for verification testing purposes

Read this description one more time before thinking it is a good idea to try this.
dbms_space_admin.segment_repair(
segment_owner  IN VARCHAR2,
segment_name   IN VARCHAR2,
segment_type   IN VARCHAR2,
partition_name IN VARCHAR2 DEFAULT NULL,
repair_option  IN NUMBER   DEFAULT SEGMENT_REPAIR_METADATA);
Take the warning to the left seriously!

CREATE TABLE t AS SELECT * FROM user_objects;

exec dbms_space_admin.segment_repair(USER, 'T', 'TABLE');
 
SEGMENT_VERIFY
Checks the consistency of the segment extent map with the tablespace file bitmaps dbms_space_admin.segment_verify(
tablespace_name      IN VARCHAR2,
header_relative_file IN POSITIVE,
header_block         IN POSITIVE,
verify_option        IN POSITIVE DEFAULT SEGMENT_VERIFY_EXTENTS);
desc dba_data_files

SELECT file_id, tablespace_name
FROM dba_data_files;

SELECT header_block
FROM dba_segments
WHERE tablespace_name = 'UWDATA'

exec dbms_space_admin.segment_verify('UWDATA', 6, 9068, 2);
 
TABLEPACE_DUMP_BITMAPS
Dumps the tablespace space header of files dbms_space_admin.tablespace_dump_bitmaps(tablespace_name IN VARCHAR2);
-- choose a tablespace
SELECT tablespace_name, SUM(bytes)/1024/1024
FROM dba_data_files
GROUP BY tablespace_name;

exec dbms_space_admin.tablespace_dump_bitmaps('USERS');

-- the first few lines of the dump

*** SERVICE NAME:(SYS$USERS) 2007-03-14 21:39:46.937
*** SESSION ID:(159.3) 2007-03-14 21:39:46.937
Header Control:
RelFno: 4, Unit: 8, Size: 6240, Flag: 9
AutoExtend: YES, Increment: 160, MaxSize: 4194302
Initial Area: 7, Tail: 6240, First: 52, Free: 695
Deallocation scn: 3723938.0
Header Opcode:
Save: No Pending Op
File Space Bitmap Block:
BitMap Control:
RelFno: 4, BeginBlock: 9, Flag: 0, First: 52, Free: 63404
FFFFFFFFFFFFEFFF 1F00FFFF00000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
 
TABLESPACE_FIX_AFFINITY
Sets instance affinity of a File Bitmap Block a in bigfile tablespace. The block can be either a Level 1 bitmap block (FFB) or a Level 2 bitmap block (FSB) dbms_space_admin.tablespace_fix_affinity(
tablespace_name IN VARCHAR2,
block_num       IN BINARY_INTEGER,
instance_id     IN BINARY_INTEGER DEFAULT NULL);
exec dbms_space_admin.tablespace_fix_affinity('UWDATA', 16464, 1);
 
TABLESPACE_FIX_BITMAPS
Marks the appropriate DBA range (extent) as free or used in bitmap dbms_space_admin.tablespace_fix_bitmaps(
tablespace_name        IN VARCHAR2,
dbarange_relative_file IN POSITIVE,
dbarange_begin_block   IN POSITIVE,
dbarange_end_block     IN POSITIVE,
fix_option             IN POSITIVE);
exec dbms_space_admin.tablespace_fix_bitmaps('UWDATA', 4, 27, 67, 8);
 
TABLESPACE_FIX_SEGMENT_EXTBLKS
Tablespace fix segment extents and blocks based on segment header entries dbms_space_admin.segment_number_extblks(tablespace_name IN VARCHAR2);
TBD
 
TABLESPACE_FIX_SEGMENT_STATES
Fixes the state of the segments in a tablespace in which migration was aborted dbms_space_admin.tablespace_fix_segment_states(
tablespace_name IN VARCHAR2);
exec space_admin.tablespace_fix_segment_states('UWDATA');
 
TABLESPACE_MIGRATE_FROM_LOCAL
Migrates a locally-managed tablespace to dictionary-managed tablespace dbms_space_admin.tablespace_migrate_from_local(
tablespace_name IN VARCHAR2);
exec space_admin.tablespace_migrate_from_local('USERS');
 
TABLESPACE_MIGRATE_TO_LOCAL
Migrates a tablespace from dictionary managed format to locally managed format dbms_space_admin.tablespace_migrate_to_local(
tablespace_name IN VARCHAR2,
unit_size       IN POSITIVE DEFAULT NULL,
rfno            IN INTEGER DEFAULT NULL);
exec space_admin.tablespace_migrate_to_local('UWDATA', 512, 4);
 
TABLESPACE_REBUILD_BITMAPS
Rebuilds tablespace bitmaps dbms_space_admin.tablespace_rebuild_bitmaps(
tablespace_name      IN VARCHAR2,
bitmap_relative_file IN POSITIVE DEFAULT NULL,
bitmap_block         IN POSITIVE DEFAULT NULL);
exec dbms_space_admin.tablespace_rebuild_bitmaps('UWDATA');
 
TABLESPACE_REBUILD_QUOTAS
Rebuilds tablespace quotas dbms_space_admin.tablespace_rebuild_quotas(tablespace_name IN VARCHAR2);
exec dbms_space_admin.tablespace_rebuild_quotas('UWDATA');
 
TABLESPACE_RELOCATE_BITMAPS
Relocates the bitmaps to the destination specified dbms_space_admin.tablespace_relocate_bitmaps(
tablespace_name IN VARCHAR2,
filno           IN POSITIVE,
blkno           IN POSITIVE);
exec dbms_space_admin.tablespace_relocate_bitmaps('UWDATA', 4, 3);
 
TABLESPACE_VERIFY
Verifies that the bitmaps and extent maps for the segments in the tablespace are in sync dbms_space_admin.tablespace_verify(
tablespace_name IN VARCHAR2,
verify_option   IN POSITIVE DEFAULT TABLESPACE_VERIFY_BITMAP);
exec dbms_space_admin.tablespace_verify('UWDATA');

Related Topics
Built-in Functions
Built-in Packages
DBMS_SPACE
DBMS_SPACE_ALERT
What's New In 21c
What's New In 23c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2023 Daniel A. Morgan All Rights Reserved
  DBSecWorx