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 enable flashback feature?

0 Answers   Oracle,


What column differentiates the V$ views to the GV$ views and how?

3 Answers  


what functionality does oracle provide to secure sensitive information?

0 Answers   Oracle,


How would you edit your CRONTAB to schedule the running of /test/test.sh to run every other day at 2PM?

1 Answers  


who owns the operating system files created by the utl_file package?

0 Answers   Oracle,






1)how to Take Backup in sql server 2005 from Flash Drive

1 Answers  


What is dcl? : sql server DBA

0 Answers  


what is incremental checkpoint?

1 Answers   CTS,


If CPU is very slow What can u do to speed up?

1 Answers  


When creating a user, what permissions must you grant to allow them to connect to the database?

3 Answers  


Hi This is request to DBA man Q. I have installed Oracle 10g Express edition in Linux fedora Core 6.When i have run the following script for ORACLE _HOME environment variable setting . script is ". /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh" variable is set but it is working only in current session. If i restart the system again i should run that script. So haw to set permanently ? even i have try with export command for that environment set it also does not work. Q. When i run sqlplus in shell prompt It is working but when i give user name and password the following error come out i.e # sqlplus SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 2 19:45:40 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Enter user-name: system Enter password: ERROR: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory I have also proper partition of disk means swap memory are available. # fdisk -l Disk /dev/sda: 40.0 GB, 40060403712 bytes 255 heads, 63 sectors/track, 4870 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 1275 10241406 7 HPFS/NTFS /dev/sda2 1276 4870 28876837+ f W95 Ext'd (LBA) /dev/sda5 1276 3187 15358108+ 7 HPFS/NTFS /dev/sda6 3188 4672 11928231 83 Linux /dev/sda7 4673 4863 1534176 82 Linux swap / Solaris

1 Answers  


How to start SQL Server in minimal configuration mode?

1 Answers  


Categories