File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ REM Script Name : proc_extents.sql
2+ REM Author : Craig Richards
3+ REM Created : 16-Mar-2009
4+ REM Last Modified :
5+ REM Version : 1.0
6+ REM
7+ REM Modifications :
8+ REM
9+ REM Description : Creates a procedure which shows the largest available extent for each tablespace
10+
11+ CREATE OR REPLACE PROCEDURE extents
12+ AUTHID CURRENT_USER
13+ AS
14+
15+ -- Variable Declaration
16+
17+ LV_TABLESPACE_NAME dba_free_space.tablespace_name%TYPE;
18+ LV_BYTES dba_free_space.bytes%TYPE;
19+
20+ -- Create the cursor
21+
22+ CURSOR c_extent IS
23+ SELECT rpad(tablespace_name,15,' '), MAX(bytes)
24+ FROM dba_free_space
25+ GROUP BY tablespace_name
26+ UNION
27+ SELECT rpad(tablespace_name,15,' '), MAX(bytes)
28+ FROM dba_temp_files
29+ GROUP BY tablespace_name;
30+
31+ -- Output the information
32+
33+ BEGIN
34+ DBMS_OUTPUT.PUT_LINE('Tablespace Name'||CHR(9)||CHR(9) ||'Bytes');
35+ DBMS_OUTPUT.PUT_LINE('==============='||CHR(9)||CHR(9) ||'=====');
36+ OPEN c_extent;
37+ LOOP
38+ FETCH c_extent INTO LV_TABLESPACE_NAME,LV_BYTES;
39+ EXIT WHEN c_extent%NOTFOUND;
40+ DBMS_OUTPUT.PUT_LINE(LV_TABLESPACE_NAME||CHR(9)||CHR(9) ||LV_BYTES);
41+ END LOOP;
42+ CLOSE c_extent;
43+
44+ END extents;
45+ /
46+
47+ REM End of Script
You can’t perform that action at this time.
0 commit comments