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

how can you generate profile of pl/sql applications to identify performance bottlenecks?

0 Answers   Oracle,


deleted of control file how will u recover control file?

4 Answers   CTS,


What are the different sql server versions you have worked on? : sql server DBA

0 Answers  


i have 10gp file.now i need store in database..but database have only 7gb memory only..how do u store the file ?

0 Answers   IBM,


Explain how you would restore a database using RMAN to Point in Time?

1 Answers  






What are the different authentication modes in sql server and how can you change authentication mode? : sql server DBA

0 Answers  


You have just had to restore from backup and do not have any control files. How would you go about bringing up this database?

3 Answers  


How would you determine who has added a row to a table?

4 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,


Explain the difference between a data block, an extent and a segment.

2 Answers  


What are the commands used in dcl? : sql server DBA

0 Answers  


Database is hung. Old and new user connections alike hang on impact. What do you do? Your SYS SQLPLUS session IS able to connect.

0 Answers  


Categories