DBAToolZ - Scripts ( Tablespace ) DBAToolZ Home
 (Last updated 05/21/2003)
Home     Download     Forums     SQL Scripts     Book Review     Links     Feedback


Script Name Description

c_db_bk_HOT.sql

	Generates and runs HOT back-up script
	backup`s one tablespace at a time

c_tabsp_tmp_rebuild.sql

	This script rebuilds any LOCAL TEMPORARY tablespace
    

c_user_alter_quota.sql

	This script will:
		1. REVOKE UNLIMITED TABLESPACE FROM
		   all NON DBA users (DESIGNER and
		   SYS likes are excluded).
		2. Limit their quotas based on the
		   current usage.

e_tabsp_ctmp.sql

	example of creating temp tablespace in 8i
    

s_db_files_all.sql

	Reports all database files REDO LOG, DBF, CTL

s_db_segs1.sql

	Reports largest segment types by owner

s_db_segs2.sql

	USE s_db_segs3.sql for a detailed report of segments

	Reports SUM(bytes) for all segments by owner groupping them by
	the current size from dba_segments.

	There is a theory by which you only need 3 types
	of tablespaces:
	  160k (SMALL)
	  5MBm (MEDIUM)
	  160MB (LARGE)
	If you follow this theory you can use this script
	to "place" your segments in the "right" tablespace:
	  1. 160K ts (segs < 5MB)
	  2. 5MB ts (segs < 160MB)
	  3. 160MB ts (segs > 160MB)

s_db_segs3.sql

	Reports segments by owner groupping them by
	the current size from dba_segments.

	There is a theory by which you only need 3 types
	of tablespaces:
	  160k (SMALL)
	  5MBm (MEDIUM)
	  160MB (LARGE)
	If you follow this theory you can use this script
	to "place" your segments in the "right" tablespace:
	  1. 160K ts (segs < 5MB)
	  2. 5MB ts (segs < 160MB)
	  3. 160MB ts (segs > 160MB)

s_db_segs_all.sql

	This script gives general idea of segments and extents
	in a database for all the tablespaces

s_db_segs_alter.sql

	Alters segment`s storage parameters (NEXT  and PCTINCREASE 0)
	where  is derived based on the current size from dba_segments:

	There is a theory by which you only need 3 types
	of tablespaces:
	  160k (SMALL)
	  5MBm (MEDIUM)
	  160MB (LARGE)
	If you follow this theory you can use this script
	to "size" your segment`s future extents for the "right" tablespace:
	  1. 160K ts (segs < 5MB)
	  2. 5MB ts (segs < 160MB)
	  3. 160MB ts (segs > 160MB)

s_db_segs_blowout.sql

	THIS Script reports segments that will "blowout"
	on the next extent.

s_db_segs_map.sql

	THIS Script display top N extents map of a tablespace

 	Example:
	========
	   Display top 10 extents map of
	   SYSTEM tablespace file_id 153:
	   ------------------------------
	     SQL> s_db_segs_map.sql SYSTEM 153 10

s_dbf_ai.sql

     VERY HELPFULL TO BALANCE DBF`s on FILE SYSTEMS
     This script displays just about all you need to know
     about datafiles, storage, tablespaces and autoextend

s_dbf_free.sql

	Displays free space per datafile

s_dbf_io.sql

	This script will show IO by mount point

s_dbf_migrate.sql

	When migrating to a different host sometimes
	it is necessary to balance datafiles on new
	file systems to make sure you do not go over
	the available space.
	--
	For instance if your original host had 20GB
	file systems and your new host is only 12GB
	you can find this script very handy.
	--
	This script should be ran on the sourse instance
	before the migration.  It will display a line "---"
	when SUM of all datafiles reached the limit you
	specified

s_dbf_tmp.sql

	Reports all temp files and tablesapces (8i)
	reports sort segments summary from v$temp_space_header
	v$temp_extent_pool and dba_temp_files
    

s_tabsp.sql

	Lists freespace by tablespace

s_tabsp_alloc.sql

	Reports object types for a tablespace
	their count, size and extents

s_tabsp_check_system.sql

	Reports objects in SYSTEM tablespace
	that don`t belong there (not SYS or SYSTEM)

s_tabsp_detail.sql

	This script is from Kevin Loney "ORACLE8 DBA Handbook"
	----------------------------------------------------------------------
	Generates a mapping of the space usage
	(free space vs used) in a tablespace. It graphically
	shows segment and free space fragmentation.

	After running this script:
	if a tablespace has too many "free space gaps" you should:
	a) let SMON process coalesce extents by setting default PCTINCREASE to
	   nonzero value
	OR
	b) manually coalesce the free extents of the tablespace:
	   SQL> alter tablespace  coalesce,

s_tabsp_dif.sql

	---------------------------------------------------------
	Compares tablespace differences between current database
	and any other database.  Reports segments with different
	number of extents from these tablespaces.
	---------------------------------------------------------
	(Creates DB LINK and temp table)

s_tabsp_frag.sql

	NOTE:
	This script is from Kevin Loney "ORACLE8 DBA Handbook".
	I have noticed that for LOCAL managed tablespaces
	this ratio really does not matter.  I still use this script
	for DICTIONARY managed tablespaces.
	--
	This script measures the fragmentation of free space
	in all of the tablespaces in the database and scores them
	according to an arbitrary index for comparison

			    largest extent	              100
	FSFI = 100 * sqrt(------------------) * (-------------------------------)
			  sum of all extents     sqrt(sqrt((number of extents)))

	FSFI - Free Space Fragmentation index
	The largest possible FSFI (for an ideal single-file tablespace) is 100
	As the number of extents increases, the FSFI rating drops slowly. As the size of
	the largest extent drops, however, the FSFI rating drops rapidly.

	After running this script look at the rating number if FSFI < 30 then run
	s_tabsp_detail.sql (see s_tabsp_detail.sql)

s_tabsp_frag2.sql

	Displays count of empty "holes" in every
	tablespace.  When you see this count reaching
	thousands I whould say it`s time to reorg TS
	or at least try to COALESCE ...

s_tabsp_top_10_segs.sql

	Displays top 10 biggest segments by tablespace
	WARNING:
	Uses ORDER BY with INLINE VIEWS not supported for <8i

s_user_obj.sql

	Reports counts of segments per user/tablespace

DBAToolZ Home | Contact Us
Copyright© 2001 DBAToolZ.com All Rights Reserved.