Calculating free space in tablespace
Oracle 11.0.1.7:
I am trying to calculate free space in the tablespace but I am not sure if Allocated Space (bytes_used) also has some free space that doesn't get reflected in the query below. Is it correct to assume that bytes_used is the space allocated to extents but may not have been really used (no data or LOB) yet? How do I calculate space that's currently been used by row data, index data or blob data?
I am currently using below query:
select a.TABLESPACE_NAME,
a.BYTES bytes_used,
b.BYTES bytes_free,
b.largest,
round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used
from
select TABLESPACE_NAME,
sum(BYTES) BYTES
from dba_data_files
group by TABLESPACE_NAME
a,
select TABLESPACE_NAME,
sum(BYTES) BYTES ,
max(BYTES) largest
from dba_free_space
group by TABLESPACE_NAME
b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME
order by ((a.BYTES-b.BYTES)/a.BYTES) desc
DBA_FREE_SPACE give you the free space information which has not been allocated to any segment. The segments can also have free space in their allocated space and in order to find that, use DBMS_SPACE.SPACE_USAGE procedure. To find out free space in LOB segments refer to metalink doc: 386341.1
Thanks
Daljit Singh
Similar Messages
-
Hi All,
Is it possible to collect data about free space in tablespaces in GC (in some table)?
I'd like to have history of free space in tablespaces. Now I have some sql script which is triggered once per day and store output in the file.Hi All,
Is it possible to collect data about free space in tablespaces in GC (in some table)?
I'd like to have history of free space in tablespaces. Now I have some sql script which is triggered once per day and store output in the file. -
Stange free space in tablespace
Checking a space usage of my tablespace using those queries http://vsbabu.org/oracle/sect03.html (especially query which name USAGE) shows me that one of my table is about 100GB big, but 90GB is free space?! So only 10% of space is used. Can I do something with this "empty" space?
Sure. Below is listing from my all tablespaces files:
'FILE_NAME' USER_BYTES/1024/1024 BYTES/1024/1024 MAXBYTES/1024/1024 AUTOEXTENSIBLE
file_name_1 4,9375 5 32767,984375 YES
file_name_2 32767,875 32767,984375 32767,984375 YES
file_name_3 613,125 613,1875 32767,984375 YES
file_name_4 5219,9375 5220 32767,984375 YES
file_name_5 32767,875 32767,984375 32767,984375 YES
file_name_6 9071,625 9071,6875 32767,984375 YES
file_name_7 74,9375 75 32767,984375 YES
file_name_8 32767,875 32767,984375 32767,984375 YES
file_name_9 32767,875 32767,984375 32767,984375 YES
file_name_10 24,9375 25 32767,984375 YES
file_name_11 32767,875 32767,984375 32767,984375 YES
file_name_12 191,75 191,8125 32767,984375 YES
file_name_13 124,9375 125 32767,984375 YES
file_name_14 9669,9375 9670 32767,984375 YES
file_name_15 29851,875 29852 32767,984375 YES
file_name_16 1000,6875 1000,75 32767,984375 YES
file_name_17 32767,875 32767,984375 32767,984375 YES
file_name_18 32761,9375 32762,0625 32767,984375 YES
file_name_19 20031,9375 20032 32767,984375 YES
file_name_20 22171,9375 22172 32767,984375 YES
file_name_21 3999,9375 4000 0 NO
file_name_22 49,9375 50 32767,984375 YES
22 rows selected At this output it doesn't look as bad as in previous queries, does it?
Edited by: lesak on Jun 18, 2011 11:29 AM -
Incorrect trapping of free space in tablespace
Hi,
We have a script that monitors tablespaces, and flags if they are getting full. The code is shown below......
select tablespace_name from
(select a.tablespace_name, a.physsp/1024/1024 psm,
nvl(b.freesp,0)/1024/1024 fsm,
nvl(b.mfreecnk,0)/1024/1024 mfs,
nvl((a.physsp + c.extdf - c.extdfact),a.physsp)/1024/1024 maxpos,
100*(a.physsp - nvl(b.freesp,0))/nvl((a.physsp + c.extdf - c.extdfact),a.physsp) maxpospct
from
(select tablespace_name, sum(bytes) physsp
from dba_data_files
group by tablespace_name) a,
(select tablespace_name, sum(bytes) freesp, max(bytes) mfreecnk
from dba_free_space
group by tablespace_name) b,
(select distinct tablespace_name, autoextensible ext,sum(maxbytes) extdf
,sum(bytes) extdfact
from dba_data_files
where autoextensible='YES'
group by tablespace_name,autoextensible) c
where b.tablespace_name (+) = a.tablespace_name
and c.tablespace_name (+) = a.tablespace_name
and a.tablespace_name not like '%UNDO%') outer
where ((outer.maxpos - outer.psm) + outer.mfs) < 500
and maxpospct > 90 ;
One tablespace is showing as either failing this test (of being > 90% full and less than 500MB free), but while it is 92% full, it has over 5gb free.....
SELECT a.name, b.tablespace_name,
substr('Free : '||sum(b.bytes)/1024/1024,1,30) File_Size
FROM dba_free_space b, v$database a
GROUP BY b.tablespace_name, a.name
UNION
SELECT a.name, b.tablespace_name,
substr('Total: '||sum(b.bytes)/1024/1024,1,30)
FROM dba_data_files b, v$database a
GROUP BY b.tablespace_name, a.name
ORDER BY 1,2,3;
NAME TABLESPACE_NAME FILE_SIZE
DB12 DATA Free : 5368.75
DB12 DATA Total: 70000
DB12 SYSAUX Free : 10.375
DB12 SYSAUX Total: 280
DB12 SYSTEM Free : 33.0625
DB12 SYSTEM Total: 500
DB12 UNDOTBS1 Free : 3055.75
DB12 UNDOTBS1 Total: 3185
DB12 USERS Free : 4.6875
DB12 USERS Total: 5
10 rows selected.
It is tablespace DATA that is complaining in the first script. This was flagged up first during a session of creating a lot of dropped indexes (data had been reimported), and at first I though it might have been something to do with the recycle bin, but a purge of that made no difference.
What's wrong?
Thanks for your help.Hi,
We have a script that monitors tablespaces, and flags if they are getting full. The code is shown below......
select tablespace_name from
(select a.tablespace_name, a.physsp/1024/1024 psm,
nvl(b.freesp,0)/1024/1024 fsm,
nvl(b.mfreecnk,0)/1024/1024 mfs,
nvl((a.physsp + c.extdf - c.extdfact),a.physsp)/1024/1024 maxpos,
100*(a.physsp - nvl(b.freesp,0))/nvl((a.physsp + c.extdf - c.extdfact),a.physsp) maxpospct
from
(select tablespace_name, sum(bytes) physsp
from dba_data_files
group by tablespace_name) a,
(select tablespace_name, sum(bytes) freesp, max(bytes) mfreecnk
from dba_free_space
group by tablespace_name) b,
(select distinct tablespace_name, autoextensible ext,sum(maxbytes) extdf
,sum(bytes) extdfact
from dba_data_files
where autoextensible='YES'
group by tablespace_name,autoextensible) c
where b.tablespace_name (+) = a.tablespace_name
and c.tablespace_name (+) = a.tablespace_name
and a.tablespace_name not like '%UNDO%') outer
where ((outer.maxpos - outer.psm) + outer.mfs) < 500
and maxpospct > 90 ;
One tablespace is showing as either failing this test (of being > 90% full and less than 500MB free), but while it is 92% full, it has over 5gb free.....
SELECT a.name, b.tablespace_name,
substr('Free : '||sum(b.bytes)/1024/1024,1,30) File_Size
FROM dba_free_space b, v$database a
GROUP BY b.tablespace_name, a.name
UNION
SELECT a.name, b.tablespace_name,
substr('Total: '||sum(b.bytes)/1024/1024,1,30)
FROM dba_data_files b, v$database a
GROUP BY b.tablespace_name, a.name
ORDER BY 1,2,3;
NAME TABLESPACE_NAME FILE_SIZE
DB12 DATA Free : 5368.75
DB12 DATA Total: 70000
DB12 SYSAUX Free : 10.375
DB12 SYSAUX Total: 280
DB12 SYSTEM Free : 33.0625
DB12 SYSTEM Total: 500
DB12 UNDOTBS1 Free : 3055.75
DB12 UNDOTBS1 Total: 3185
DB12 USERS Free : 4.6875
DB12 USERS Total: 5
10 rows selected.
It is tablespace DATA that is complaining in the first script. This was flagged up first during a session of creating a lot of dropped indexes (data had been reimported), and at first I though it might have been something to do with the recycle bin, but a purge of that made no difference.
What's wrong?
Thanks for your help. -
Calculating Used Space in Tablespace
Is there some way that I could calculate memory used by a particular schema or user in a particual tablespace?
If U meant the size usage of the table space then u can do so by using the following query;
Select bytes/(1024*1024) from dba_ts_quotas where tablespace_name='xyz'(ie,ur tablespace name).
this will give the size in MB . -
Doubt in considering temp tablespace's free space
Hi All,
Database: oracle 11.2
Operating System: AIX
I want to know how much free space available in my temp tablespace
I ran below scripts
select sum((bytes_free)/1024/1024/1024) GB from v$temp_space_header
+52.904296875+
select (tablespace_size)/1024/1024/1024 tablespace_size_in_gb,
+(allocated_space)/1024/1024/1024 allocated_space_in_gb,+
+(free_space)/1024/1024/1024 free_space_in_gb+
from dba_temp_free_space
tablespace_size_in_gb: 98.9990234375
allocated_space_in_gb: 46.0947265625
free_space_in_gb:151.81640625
So my doubt is which one from above two script gives actual free space information ?
Also in dba_temp_free_space view why free space size > tablespace size ?v$temp_space_header shows you how big the temp tablespace has got since the database was restarted. It doesn't give you the current free/used space.
See the link for dba_temp_free_space, but I think it may be the way it reports free space which is why you're seeing it as more than the actual tablespace. As you can see form the description "space that is currently allocated and available for resuse" is calculated for both allocated space and free space.
http://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_5056.htm
>
ALLOCATED_SPACE = space that is currently allocated and used + space that is currently allocated and available for reuse
FREE_SPACE = space that is currently allocated and available for reuse + space that is currently unallocated>
I use the below script which I've plagiarised from somewhere ages ago to get the used/free temp space.
SELECT A.tablespace_name tablespace, D.mb_total,
SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM v$sort_segment A,
SELECT B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
FROM v$tablespace B, v$tempfile C
WHERE B.ts#= C.ts#
GROUP BY B.name, C.block_size
) D
WHERE A.tablespace_name = D.name
GROUP by A.tablespace_name, D.mb_total; -
How to find free space in datafiles of perticular schema?
hai,
whats the query to find out free space in datafiles and index files related free space for perticular schmea?
Regards
dbaThere are lots of scripts available on Metalink which report free space in tablespaces/datafiles.
Note: 1019999.6 - Script: To List Tablespace, Datafiles and Free Space
https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=1019999.6
Note: 145531.1 - How to Determine Which Tablespaces Do Not Have Enough Free Space
https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=145531.1 -
Strange calculation of free space
Hi!
I can't understand how size of free space is calculated.
For example:
in my mailbox i have 3 folders
Incoming 40.4 Mb
Sent 13.1 Mb
Junk 302 Kb
In total about 55 Mb
but in Statistic writtent, that ocupied 161.7 Mb
Same situation3 with Documents and Application data:
My Measures 252.5 Mb
Mail 160.1 Mb
Pages 22.6 Mb
Numbers 14.6 Mb
Keynote 13.4 Mb
All other in sum less than 1 Mb
In total should be less than 500 Mb
ps: I deleted all photos and turned off PhotoStream.
How to solve this problem?I have the same issue. I have just 68.5MB of documents in iCloud and it says it's full. I tried to delete photos from photo stream. I have no backups in iCloud and I don't sync my mail to iCloud.
https://www.evernote.com/shard/s24/sh/a8fc9ce7-0b24-4b24-a306-617a824b9333/5bbc8 d18d8fb43ef713088057c8d830e
https://www.evernote.com/shard/s24/sh/58447450-8089-4bc6-8a0f-d133747d05ff/17fc6 e9d31b5d68242ea2f8f1024ac73 -
Performance problem - Tablespace Free Space
Hi,
Version 10204
I am running the following statment in order to monitor tablespace free space.
There are some tablespaces that i am not interesting to monitor , and i also whant to be alert
only when less than 4 GB left in the tablespace.
I build the following statment.
Using the hint : /*+ NO_CPU_COSTING */ gave me the best performance but there are alot of time
that its took to this statment few minute to run befor it finished.
Could one help to improve its performance ?
Please note that it performe even less good when i used the RULE hint or not using hint at all.
SELECT /*+ gather_plan_statistics */ 'tablespace_free_space;'||to_char(pct_used,'999.99')||','||TBSNAME
FROM( SELECT *
FROM( SELECT NVL(b.tablespace_name, NVL(a.tablespace_name,'UNKOWN')) TBSNAME,
MBytes_alloc,
maxbytes,
MBytes_max,
ROUND(MBytes_alloc-NVL(MBytes_free,0),2) used,
ROUND(NVL(MBytes_free,0),2) free,
MBytes_free,
ROUND(DECODE( MBytes_max, 0,((MBytes_alloc-NVL(MBytes_free,0))/MBytes_alloc)*100,100*(MBytes_alloc) / maxbytes),2)PCT_USED
FROM ( SELECT /*+ NO_CPU_COSTING */ SUM(bytes)/1024/1024 MBytes_free,
MAX(bytes)/1024/1024 largest,
tablespace_name
FROM sys.DBA_FREE_SPACE
WHERE TABLESPACE_NAME NOT IN
('Q405_CALLS_TS','Q405_ICALLS_TS',
'Q305_CALLS_TS','Q305_ICALLS_TS',
'Q205_ICALLS_TS','Q306_CALLS_TS',
'Q406_CALLS_TS','Q206_CALLS_TS',
'Q205_CALLS_TS','Q105_CALLS_TS',
'Q105_ICALLS_TS','Q206_CALLS_TS','Q106_CALLS_TS',
'Q306_ICALLS_TS','Q107_ICALLS_TS','Q406_ICALLS_TS',
'Q206_ICALLS_TS','UNLMT_INTERNET_CALLS_2006_TS',
'UNLMT_INTERNET_CALLS_2007_TS',
'UNLMT_INTERNET_CALLS_2008_TS',
'Q107_ICALLS_TBS','Q107_CALLS_TBS',
'Q207_ICALLS_TBS','Q207_CALLS_TBS',
'Q307_ICALLS_TBS','Q307_CALLS_TBS',
'Q407_ICALLS_TBS','Q407_CALLS_TBS',
'Q408_ICALLS_TS','Q408_CALLS_TS',
'Q308_ICALLS_TS','Q308_CALLS_TS',
'Q208_ICALLS_TS','Q208_CALLS_TS',
'Q108_ICALLS_TS','Q108_CALLS_TS',
'Q109_ICALLS_TS','Q109_CALLS_TS',
'UNLMT_INT_CALLS_Q308_TS',
'UNLMT_INT_ICALLS_Q308_TS',
'UNLMT_INT_CALLS_Q408_TS',
'UNLMT_INT_ICALLS_Q408_TS'
GROUP BY tablespace_name ) a,
( SELECT SUM(bytes)/1024/1024 MBytes_alloc,
SUM(maxbytes)/1024/1024 MBytes_max,
SUM(DECODE (autoextensible,'YES',maxbytes/1024/1024,'NO', BYTES/1024/1024 )) maxbytes,
tablespace_name
FROM DBA_DATA_FILES
WHERE TABLESPACE_NAME NOT IN
('Q405_CALLS_TS','Q405_ICALLS_TS',
'Q305_CALLS_TS','Q305_ICALLS_TS',
'Q205_ICALLS_TS','Q306_CALLS_TS',
'Q406_CALLS_TS','Q206_CALLS_TS',
'Q205_CALLS_TS','Q105_CALLS_TS',
'Q105_ICALLS_TS','Q206_CALLS_TS',
'Q106_CALLS_TS','Q306_ICALLS_TS',
'Q107_ICALLS_TS','Q406_ICALLS_TS',
'Q206_ICALLS_TS','UNLMT_INTERNET_CALLS_2006_TS',
'UNLMT_INTERNET_CALLS_2007_TS',
'UNLMT_INTERNET_CALLS_2008_TS',
'Q107_ICALLS_TBS','Q107_CALLS_TBS',
'Q207_ICALLS_TBS','Q207_CALLS_TBS',
'Q307_ICALLS_TBS','Q307_CALLS_TBS',
'Q407_ICALLS_TBS','Q407_CALLS_TBS',
'Q408_ICALLS_TS','Q408_CALLS_TS',
'Q308_ICALLS_TS','Q308_CALLS_TS',
'Q208_ICALLS_TS','Q208_CALLS_TS',
'Q108_ICALLS_TS','Q108_CALLS_TS',
'Q109_ICALLS_TS','Q109_CALLS_TS',
'UNLMT_INT_CALLS_Q308_TS',
'UNLMT_INT_ICALLS_Q308_TS',
'UNLMT_INT_CALLS_Q408_TS',
'UNLMT_INT_ICALLS_Q408_TS'
GROUP BY tablespace_name) b
WHERE a.tablespace_name (+) = b.tablespace_name
AND (a.MBytes_free<4000 or a.MBytes_free is null)
ORDER BY PCT_USED DESC
WHERE TBSNAME not in (select tablespace_name from dba_tablespaces where contents in ('UNDO'))
and ROWNUM =1;
select * from table(dbms_xplan.display_cursor('42hppgtx2h1gb',0,'ALLSTATS LAST'));
Plan hash value: 2979461796
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
|* 1 | COUNT STOPKEY | | 1 | | 1 |00:00:15.52 | 146K| 8927 | | | |
|* 2 | FILTER | | 1 | | 1 |00:00:15.52 | 146K| 8927 | | | |
| 3 | VIEW | | 1 | 3 | 1 |00:00:15.52 | 146K| 8927 | | | |
| 4 | SORT ORDER BY | | 1 | 3 | 1 |00:00:15.52 | 146K| 8927 | 2048 | 2048 | 2048 (0)|
|* 5 | FILTER | | 1 | | 16 |00:00:15.52 | 146K| 8927 | | | |
|* 6 | HASH JOIN OUTER | | 1 | 3 | 25 |00:00:15.52 | 146K| 8927 | 561K| 561K| 982K (0)|
| 7 | VIEW | | 1 | 2 | 25 |00:00:02.95 | 105K| 0 | | | |
| 8 | HASH GROUP BY | | 1 | 2 | 25 |00:00:02.95 | 105K| 0 | 447K| 447K| 977K (0)|
| 9 | VIEW | DBA_DATA_FILES | 1 | 2 | 217 |00:00:03.25 | 105K| 0 | | | |
| 10 | UNION-ALL | | 1 | | 217 |00:00:03.25 | 105K| 0 | | | |
| 11 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.67 | 219 | 0 | | | |
| 12 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.67 | 219 | 0 | | | |
| 13 | MERGE JOIN CARTESIAN | | 1 | 1 | 52297 |00:00:00.22 | 0 | 0 | | | |
|* 14 | FIXED TABLE FULL | X$KCCFN | 1 | 1 | 217 |00:00:00.01 | 0 | 0 | | | |
| 15 | BUFFER SORT | | 217 | 100 | 52297 |00:00:00.06 | 0 | 0 | 11264 | 11264 |10240 (0)|
| 16 | FIXED TABLE FULL | X$KCCFE | 1 | 100 | 241 |00:00:00.01 | 0 | 0 | | | |
|* 17 | TABLE ACCESS BY INDEX ROWID| FILE$ | 52297 | 1 | 0 |00:00:00.52 | 219 | 0 | | | |
|* 18 | INDEX UNIQUE SCAN | I_FILE1 | 52297 | 1 | 217 |00:00:00.24 | 2 | 0 | | | |
|* 19 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 20 | INDEX UNIQUE SCAN | I_TS# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 21 | NESTED LOOPS | | 1 | 1 | 217 |00:00:02.58 | 105K| 0 | | | |
| 22 | NESTED LOOPS | | 1 | 1 | 52297 |00:00:01.89 | 104K| 0 | | | |
| 23 | MERGE JOIN CARTESIAN | | 1 | 1 | 52297 |00:00:00.22 | 217 | 0 | | | |
| 24 | NESTED LOOPS | | 1 | 1 | 217 |00:00:00.02 | 217 | 0 | | | |
|* 25 | FIXED TABLE FULL | X$KCCFN | 1 | 1 | 217 |00:00:00.01 | 0 | 0 | | | |
|* 26 | FIXED TABLE FIXED INDEX | X$KTFBHC (ind:1) | 217 | 1 | 217 |00:00:00.01 | 217 | 0 | | | |
| 27 | BUFFER SORT | | 217 | 100 | 52297 |00:00:00.11 | 0 | 0 | 11264 | 11264 |10240 (0)|
| 28 | FIXED TABLE FULL | X$KCCFE | 1 | 100 | 241 |00:00:00.01 | 0 | 0 | | | |
|* 29 | TABLE ACCESS CLUSTER | TS$ | 52297 | 1 | 52297 |00:00:01.41 | 104K| 0 | | | |
|* 30 | INDEX UNIQUE SCAN | I_TS# | 52297 | 1 | 52297 |00:00:00.37 | 2 | 0 | | | |
|* 31 | TABLE ACCESS BY INDEX ROWID | FILE$ | 52297 | 1 | 217 |00:00:00.57 | 219 | 0 | | | |
|* 32 | INDEX UNIQUE SCAN | I_FILE1 | 52297 | 1 | 217 |00:00:00.28 | 2 | 0 | | | |
| 33 | VIEW | | 1 | 1401 | 25 |00:00:12.56 | 40846 | 8927 | | | |
| 34 | HASH GROUP BY | | 1 | 1401 | 25 |00:00:12.56 | 40846 | 8927 | 465K| 465K| 982K (0)|
| 35 | VIEW | DBA_FREE_SPACE | 1 | 1401 | 73133 |00:00:14.19 | 40846 | 8927 | | | |
| 36 | UNION-ALL | | 1 | | 73133 |00:00:14.04 | 40846 | 8927 | | | |
| 37 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 45 | 0 | | | |
| 38 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 45 | 0 | | | |
| 39 | TABLE ACCESS FULL | FET$ | 1 | 1 | 0 |00:00:00.01 | 45 | 0 | | | |
|* 40 | INDEX UNIQUE SCAN | I_FILE2 | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 41 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
| 42 | NESTED LOOPS | | 1 | 5 | 7271 |00:00:00.20 | 1156 | 0 | | | |
| 43 | NESTED LOOPS | | 1 | 6 | 7271 |00:00:00.14 | 1154 | 0 | | | |
|* 44 | TABLE ACCESS FULL | TS$ | 1 | 2 | 25 |00:00:00.01 | 45 | 0 | | | |
|* 45 | FIXED TABLE FIXED INDEX | X$KTFBFE (ind:1) | 25 | 3 | 7271 |00:00:00.11 | 1109 | 0 | | | |
|* 46 | INDEX UNIQUE SCAN | I_FILE2 | 7271 | 1 | 7271 |00:00:00.04 | 2 | 0 | | | |
| 47 | NESTED LOOPS | | 1 | 1394 | 65862 |00:00:17.73 | 39476 | 8927 | | | |
| 48 | NESTED LOOPS | | 1 | 30528 | 65862 |00:00:16.94 | 39474 | 8927 | | | |
|* 49 | HASH JOIN | | 1 | 2540 | 8927 |00:00:00.03 | 90 | 0 | 811K| 811K| 1397K (0)|
| 50 | TABLE ACCESS FULL | RECYCLEBIN$ | 1 | 8319 | 8935 |00:00:00.01 | 45 | 0 | | | |
|* 51 | TABLE ACCESS FULL | TS$ | 1 | 2 | 25 |00:00:00.01 | 45 | 0 | | | |
|* 52 | FIXED TABLE FIXED INDEX | X$KTFBUE (ind:1) | 8927 | 12 | 65862 |00:00:11.66 | 39384 | 8927 | | | |
|* 53 | INDEX UNIQUE SCAN | I_FILE2 | 65862 | 1 | 65862 |00:00:00.45 | 2 | 0 | | | |
|* 54 | TABLE ACCESS BY INDEX ROWID | RECYCLEBIN$ | 1 | 1 | 0 |00:00:00.01 | 169 | 0 | | | |
| 55 | NESTED LOOPS | | 1 | 1 | 1 |00:00:00.01 | 169 | 0 | | | |
| 56 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 169 | 0 | | | |
| 57 | NESTED LOOPS | | 1 | 1 | 0 |00:00:00.01 | 169 | 0 | | | |
| 58 | TABLE ACCESS FULL | UET$ | 1 | 1 | 0 |00:00:00.01 | 169 | 0 | | | |
|* 59 | INDEX UNIQUE SCAN | I_FILE2 | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 60 | TABLE ACCESS CLUSTER | TS$ | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 61 | INDEX UNIQUE SCAN | I_TS# | 0 | 1 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 62 | INDEX RANGE SCAN | RECYCLEBIN$_TS | 0 | 1188 | 0 |00:00:00.01 | 0 | 0 | | | |
|* 63 | TABLE ACCESS FULL | TS$ | 1 | 1 | 0 |00:00:00.01 | 45 | 0 | | | |
Predicate Information (identified by operation id):
1 - filter(ROWNUM=1)
2 - filter( IS NULL)
5 - filter(("A"."MBYTES_FREE"<4000 OR "A"."MBYTES_FREE" IS NULL))
6 - access("A"."TABLESPACE_NAME"="B"."TABLESPACE_NAME")
14 - filter(("INST_ID"=USERENV('INSTANCE') AND "FNNAM" IS NOT NULL AND BITAND("FNFLG",4)<>4 AND "FNTYP"=4))
PLAN_TABLE_OUTPUT
17 - filter(("F"."SPARE1" IS NULL AND "F"."TS#" IS NOT NULL))
18 - access("FE"."FENUM"="F"."FILE#")
filter("FNFNO"="F"."FILE#")
19 - filter(("TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' ... AND "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
20 - access("F"."TS#"="TS"."TS#")
25 - filter(("INST_ID"=USERENV('INSTANCE') AND "FNNAM" IS NOT NULL AND BITAND("FNFLG",4)<>4 AND "FNTYP"=4))
26 - filter("FNFNO"="HC"."KTFBHCAFNO")
29 - filter(("TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' AND ... AND "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
30 - access("HC"."KTFBHCTSN"="TS"."TS#")
31 - filter("F"."SPARE1" IS NOT NULL)
32 - access("FE"."FENUM"="F"."FILE#")
filter("FNFNO"="F"."FILE#")
40 - access("F"."TS#"="FI"."TS#" AND "F"."FILE#"="FI"."RELFILE#")
PLAN_TABLE_OUTPUT
filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
41 - filter(("TS"."TS#"="F"."TS#" AND "TS"."BITMAPPED"=0 AND "TS"."NAME"<>'Q405_CALLS_TS' AND "TS"."NAME"<>'Q405_ICALLS_TS' AND
"TS"."NAME"<>'Q305_CALLS_TS' AND "TS"."NAME"<>'Q305_ICALLS_TS' AND ... "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
44 - filter(("TS"."BITMAPPED"<>0 AND INTERNAL_FUNCTION("TS"."ONLINE$") AND .... "TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
45 - filter("TS"."TS#"="F"."KTFBFETSN")
46 - access("F"."KTFBFETSN"="FI"."TS#" AND "F"."KTFBFEFNO"="FI"."RELFILE#")
filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
49 - access("TS"."TS#"="RB"."TS#")
51 - filter(("TS"."BITMAPPED"<>0 AND INTERNAL_FUNCTION("TS"."ONLINE$") AND...."TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
52 - filter(("U"."KTFBUESEGTSN"="RB"."TS#" AND "U"."KTFBUESEGFNO"="RB"."FILE#" AND "U"."KTFBUESEGBNO"="RB"."BLOCK#"))
53 - access("RB"."TS#"="FI"."TS#" AND "U"."KTFBUEFNO"="FI"."RELFILE#")
filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
PLAN_TABLE_OUTPUT
54 - filter(("U"."SEGFILE#"="RB"."FILE#" AND "U"."SEGBLOCK#"="RB"."BLOCK#"))
59 - access("U"."TS#"="FI"."TS#" AND "U"."SEGFILE#"="FI"."RELFILE#")
filter(("FI"."TS#" IS NOT NULL AND "FI"."RELFILE#" IS NOT NULL))
60 - filter(("TS"."BITMAPPED"=0 AND "TS"."NAME"<>'Q405_CALLS_TS' AND .... AND "TS"."NAME"<>'UNLMT_INT_CALLS_Q408_TS' AND
"TS"."NAME"<>'UNLMT_INT_ICALLS_Q408_TS'))
61 - access("TS"."TS#"="U"."TS#")
62 - access("U"."TS#"="RB"."TS#")
63 - filter((DECODE("TS"."CONTENTS$",0,DECODE(BITAND("TS"."FLAGS",16),16,'UNDO','PERMANENT'),1,'TEMPORARY')='UNDO' AND "TS"."ONLINE$"<>3 AND
BITAND("FLAGS",2048)<>2048 AND LNNVL("TS"."NAME"<>:B1)))
Note
PLAN_TABLE_OUTPUT
- cpu costing is off (consider enabling it)Version 10204
I am running the following statment in order to monitor tablespace free space.
There are some tablespaces that i am not interesting to monitor , and i also whant to be alert
only when less than 4 GB left in the tablespace.
And just adding to Dan's reply, if you are on 10g as you mentioned, why not to use the built in Alert mechanism to monitor and get alerts about the tablespace usage using the GC or Database Console than creating a home grown solution like the one you have posted?
Aman.... -
To know the amount of free space in a tablespace
hi,
I'm learning oracle 9i release 9.2.0.1.0 .I'd created a tablespace 'TOOLS' for being used as the default tablespace for Statspack.
I wish to know the amount of free space available in this tablespace. For this purpose I ran the following query but there was no rows selected :-
SQL> select tablespace_name,bytes from dba_free_space
2 where tablespace_name='TOOLS';
no rows selected
SQL> select name from v$tablespace;
NAME
CWMLITE
DRSYS
EXAMPLE
INDX
ODM
SYSTEM
TOOLS
UNDOTBS1
USERS
XDB
TEMP
Can anyone tell the reason for this.I tried your query
SQL> select TABLESPACE_NAME,
2 sum(BYTES) Total_free_space,
3 max(BYTES) largest_free_extent
4 from dba_free_space
5 group by TABLESPACE_NAME;
♀TABLESPACE_NAME TOTAL_FREE_SPACE LARGEST_FREE_EXTENT
CWMLITE 11141120 10878976
DRSYS 10813440 10813440
EXAMPLE 131072 131072
INDX 26148864 26148864
ODM 11206656 11206656
SYSTEM 3211264 3080192
UNDOTBS1 199229440 196149248
USERS 26083328 26083328
XDB 196608 196608
9 rows selected.
Again there were no rows for TOOLS tablespace. -
How to find free space in a Tablespace?
Hi,
I have a limited access to objects in my database ( do not have access to many tables).
I have been allocated 300GB of size in my tablespace which allows me to create my objects.
Now, I want to find out how much of this tablespace size allocated to me have been used up. I do not have access to dba_data_files or dba_segments.
Is there a way out for me? Could anyone show me a way please?This query will give you the required information but it makes use of DBA tables.
SELECT B.TABLESPACE_NAME, TBS_SIZE SIZEGB, A.FREE_SPACE FREEGB
from (select tablespace_name, round(sum(bytes)/1024/1024/1024 ,2) as free_space
from dba_free_space
GROUP BY TABLESPACE_NAME) A,
(select tablespace_name, sum(bytes)/1024/1024/1024 as tbs_size
from dba_data_files
group by tablespace_name) b
where a.tablespace_name(+)=b.tablespace_name;
However, you said that you are aware of your tablespace details so the above query can be modified to get the free space in your tablespace. Now I am using user_frees_space and not dba_free_space. Generally user* tables are and should be made accessible to the users.
select tablespace_name, round(sum(bytes)/1024/1024/1024 ,2) as free_space
from user_free_space
where tablespace_name = 'Your tablespace name'
GROUP BY TABLESPACE_NAME;
Ishan -
Hi,
in DB version 9.2.0, after all transactions are committed, the occupied blocks in UNDO tablespace will be free or not ?
The same just after startup, before any transaction the free space in UNDO tablespace would be at max ?
Many thanks.Hello Dear copy this script and paste in the sql prompt and it will show your how much total space table have, or how much is used and how much it is free
SELECT Total.name "Tablespace Name",
nvl(Free_space, 0) Free_space,
nvl(total_space-Free_space, 0) Used_space,
total_space
FROM
(select tablespace_name, sum(bytes/1024/1024) Free_Space
from sys.dba_free_space
group by tablespace_name
) Free,
(select b.name, sum(bytes/1024/1024) TOTAL_SPACE
from sys.v_$datafile a, sys.v_$tablespace B
where a.ts# = b.ts#
group by b.name
) Total
WHERE Free.Tablespace_name(+) = Total.name
ORDER BY Total.name -
Checking tablespace used space, free space in ASM
Hi,
I want to find the tablespace used space, free space, total space in an ASM (Automatic Storage Management) environment. What is the query for that ?
Thankswant to find the tablespace used space, free spaceUse same script that u are used in non-asm environment.
dba_data_files
dba_free_space
total space in an ASM (Automatic Storage Management) environment.select name, type, total_mb, free_mb, required_mirror_free_mb,
usable_file_mb from v$asm_diskgroup;
Thanks
Kuljeet -
SQL> show parameter block
NAME TYPE VALUE
db_block_buffers integer 0
db_block_checking boolean FALSE
db_block_checksum boolean TRUE
db_block_size integer 8192
db_file_multiblock_read_count integer 8
SQL> SELECT tablespace_name,
total_blocks,
used_blocks,
free_blocks,
(total_blocks*8)/1024 as total_MB,
(used_blocks*8)/1024 as used_MB,
(free_blocks*8)/1024 as free_MB
FROM v$sort_segment;
2 3 4 5 6 7 8
TABLESPACE_NAME TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS TOTAL_MB USED_MB FREE_MB
TEMP 72704 2944 69760 568 23 545
SQL> select (sum(bytes_free)/1024/1024) Size_MB from v$temp_space_header
order by file_id 2
3 /
SIZE_MB
1479
SQL>
My version is 9.2.0.7
why temp free space is different in both queries above..
which one is correct.....why temp free space is different in both queries above..Because you are looking at two different values.
V$SORT_SEGMENT gives details about the sort segment created in a temporary tablespace. The sort segment created may or may not be of the same size as the complete temporary tablespace. In your case, the sort segment has a total size of 568 MB but only 23 MB is being used.
V$TEMP_SPACE_HEADER refers to the physical files allocated to the temporary tablespace; so the other query is giving you the free bytes in those files. -
Set tablespace free space (mb) for a single large tablespace?
It seems that in EM, setting the free space (mb) for locally managed tablespaces affects all of my locally managed tablespaces in the database and not just one.
I clicked on Tablespace, Edit (button), Thresholds and set the Free Space (MB) Warning and Critical. I thought I was setting it for a particular tablespace (because I chose Edit on a single tablespace). But then I got alerts from much smaller tablespaces because those tablespaces had much smaller MB than the thresholds that I just set.
Using EM GC, is there a way to set the free space (mb) to alert for a single large tablespace where defining a critical free space mb is better than setting a free space percent?ok, go to the database you want to manage.
Then click on Metric and Policy Settings (link at the very bottom).
Scroll down to the 'Tablespace Space Used (%)' metric, and click on the edit button
Now, click on the 'add' button to setup settings for individual tablespaces.
Bazza
Maybe you are looking for
-
Please Help - Want to Keep Video at "normal" Size
Hi I would appreciate if there is a solution for this very much !!! I am making a movie in iMovie for my mums 60th Birthday the idea is to get a loads of people and relatives to leave a video birthday message which she will be able to watch on her Bi
-
This started about two weeks ago. I had been using personas and firefox without any trouble, but now it takes 5x's as long to load if not longer and the persona I've chosen from my previous web visit is not up, but rather a default persona is. == Thi
-
Output not sorted when using group by clause
Recently we migrated our application from Forms5 to Forms10g and database from 7.3.2 to 10gR2. More than 400 applications using sql stmt with "group by" clause and without "order by". In Earlier version of oracle 7.3.2 "group by" clause in SQL stmt s
-
Iphone 3G - Youtube Native App Problem
Hi all, I'm using Iphone with with firmware 3.1.3. For last 3-4 days Iphone cannot connect to Youtube. Every time I try "Cannot connect to Youtube" screen appears prior to the "No Videos" screen. So far I tried different networks as Edge/3G/Wi-fi but
-
Where can I find some Dreamweaver templates?
I'm want to redo my website and need a new look. Where can I find some nice Dreamweaver templates?