Show table space : dbms_space « System Packages « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » System Packages » dbms_space 
31. 25. 2. Show table space
SQL>
SQL> create or replace procedure show_spacep_segname in varchar2,
  2    p_owner   in varchar2 default user,
  3    p_type    in varchar2 default 'TABLE',
  4    p_partition in varchar2 default NULL )
  5  as
  6      l_free_blks                 number;
  7
  8      l_total_blocks              number;
  9      l_total_bytes               number;
 10      l_unused_blocks             number;
 11      l_unused_bytes              number;
 12      l_LastUsedExtFileId         number;
 13      l_LastUsedExtBlockId        number;
 14      l_last_used_block           number;
 15  begin
 16      dbms_space.free_blockssegment_owner     => p_owner,
 17        segment_name      => p_segname,
 18        segment_type      => p_type,
 19        partition_name    => p_partition,
 20        freelist_group_id => 0,
 21        free_blks         => l_free_blks );
 22
 23      dbms_space.unused_spacesegment_owner     => p_owner,
 24        segment_name      => p_segname,
 25        segment_type      => p_type,
 26        partition_name    => p_partition,
 27        total_blocks      => l_total_blocks,
 28        total_bytes       => l_total_bytes,
 29        unused_blocks     => l_unused_blocks,
 30        unused_bytes      => l_unused_bytes,
 31        last_used_extent_file_id => l_LastUsedExtFileId,
 32        last_used_extent_block_id => l_LastUsedExtBlockId,
 33        last_used_block => l_last_used_block );
 34
 35      dbms_output.put_line'Free Blocks');
 36      dbms_output.put_linel_free_blks );
 37      dbms_output.put_line'Total Blocks');
 38      dbms_output.put_linel_total_blocks );
 39      dbms_output.put_line'Total Bytes');
 40      dbms_output.put_linel_total_bytes );
 41      dbms_output.put_line'Unused Blocks');
 42      dbms_output.put_linel_unused_blocks );
 43      dbms_output.put_line'Unused Bytes');
 44      dbms_output.put_linel_unused_bytes );
 45      dbms_output.put_line'Last Used Ext FileId');
 46      dbms_output.put_linel_LastUsedExtFileId );
 47      dbms_output.put_line'Last Used Ext BlockId');
 48      dbms_output.put_linel_LastUsedExtBlockId );
 49      dbms_output.put_line'Last Used Block');
 50      dbms_output.put_linel_last_used_block );
 51  end;
 52  /

Procedure created.

SQL>
31. 25. dbms_space
31. 25. 1. Use dbms_space.free_blocks and dbms_space.unused_space
31. 25. 2. Show table space
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.