how do see how much space is used and free in a tablespace

Answers were Sorted based on User's Feedback



how do see how much space is used and free in a tablespace..

Answer / mohapatra.gouranga@gmail.com

Best ans is:
SELECT df.tablespace_name "Tablespace",
df.bytes / (1024 * 1024) "Size (MB)",
SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "%
Free",
Round((df.bytes - SUM(fs.bytes)) * 100 /
df.bytes) "% Used"
FROM dba_free_space fs,
(SELECT tablespace_name,SUM(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) df
WHERE fs.tablespace_name (+) = df.tablespace_name
GROUP BY df.tablespace_name,df.bytes
UNION ALL
SELECT df.tablespace_name tspace,
fs.bytes / (1024 * 1024),
SUM(df.bytes_free) / (1024 * 1024),
Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 /
fs.bytes), 1),
Round((SUM(fs.bytes) - df.bytes_free) * 100 /
fs.bytes)
FROM dba_temp_files fs,
(SELECT tablespace_name,bytes_free,bytes_used
FROM v$temp_space_header
GROUP BY tablespace_name,bytes_free,bytes_used) df
WHERE fs.tablespace_name (+) = df.tablespace_name
GROUP BY
df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
ORDER BY 4 DESC;

Is This Answer Correct ?    0 Yes 0 No

how do see how much space is used and free in a tablespace..

Answer / anil kumar prajapati

olumn "Tablespace" format a13
column "Used MB" format 99,999,999
column "Free MB" format 99,999,999
column "Total MB" format 99,999,999
select
fs.tablespace_name "Tablespace",
(df.totalspace - fs.freespace) "Used MB",
fs.freespace "Free MB",
df.totalspace "Total MB",
round(100 * (fs.freespace / df.totalspace)) "Pct. Free"
from
(select
tablespace_name,
round(sum(bytes) / 1048576) TotalSpace
from
dba_data_files
group by
tablespace_name
) df,
(select
tablespace_name,
round(sum(bytes) / 1048576) FreeSpace
from
dba_free_space
group by
tablespace_name
) fs
where
df.tablespace_name = fs.tablespace_name;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB Administration Interview Questions

what is the purpose of catlaog in oracle rman?

2 Answers   Value Labs,


Explain the use of table functions.

1 Answers  


when does an alert gets signaled?

0 Answers   Oracle,


What view(s) do you use to associate a user's SQLPLUS session with his o/s process?

0 Answers  


What is the difference between online backup & offline backup?

3 Answers   CSC,






How can we know the exact updation date of a particular database?

2 Answers   Satyam,


how can you record information about current session?

0 Answers   Oracle,


Give the reasoning behind using an index.

2 Answers  


You have just compiled a PL/SQL package but got errors, how would you view the errors?

3 Answers  


How many packages we have in db

1 Answers   Tesco,


If we issue alter database begin backup. What happens to database?

2 Answers  


CTS int questions: 1.Temperory tablespace corrupted,how to resolve?If you need to recover? 2.In tablespace begin backup mode,Its possible to add the datafile? 3.How to partition the table using Hash partioning,what happened internally? 4.During rman backup,some files are missing Rman will continue the backup? 5.what are the errors occurs frequently? 6.which join method is best?why? 7.how to solve deadlock errors? please reply anyone.... regards siva

2 Answers   CTS,


Categories