Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Database Administration >> Growth of tablespace

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Growth of tablespace
 vikhardba  Posted: Nov 17, 2007 01:56:16 PM

 Total Post: 86
 Joined: Apr, 2007






 Hi

How do we monitor growth of tablespace, is there is automated scripts. If yes, can you please provide the same or please provide the complete steps.


 Mohammed Taj
Posted: Nov 17, 2007 11:56:00 PM  

 Total Post: 704
 Joined: Jul, 2007






 
Use OEM (Oracle Enterprise Manager Console).

 sm_ahmeds
Posted: Nov 19, 2007 03:27:52 AM  

 Total Post: 53
 Joined: Apr, 2007






 
use EM or Toad or any other Tool

Or else u can use these queries :

1)
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


2)

CLEAR
SET HEAD ON
SET VERIFY OFF
spool frt1

col tspace form a25 Heading "Tablespace"
col tot_ts_size form 99999999999999 Heading "Size (Mb)"
col free_ts_size form 99999999999999 Heading "Free (Mb)"
col ts_pct form 9999 Heading "% Free"
col ts_pct1 form 9999 Heading "% Used"
break on report
compute sum of free_ts_size on report
compute sum of tot_ts_size on report
SELECT /* + RULE */ df.tablespace_name tspace,
df.bytes/(1024*1024) tot_ts_size,
sum(fs.bytes)/(1024*1024) free_ts_size,
nvl(round(sum(fs.bytes)*100/df.bytes),1) ts_pct,
round((df.bytes-sum(fs.bytes))*100/df.bytes) ts_pct1
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 /* + RULE */
df.tablespace_name tspace,
fs.bytes/(1024*1024) tot_ts_size,
sum(df.bytes_free)/(1024*1024) free_ts_size,
nvl(round((sum(fs.bytes)- df.bytes_used) *100/fs.bytes),1) ts_pct,
round((sum(fs.BYTES) - df.BYTES_free )*100/fs.bytes) ts_pct1
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
/
spool off

 sm_ahmeds
Posted: Nov 19, 2007 03:28:08 AM  

 Total Post: 53
 Joined: Apr, 2007






 
use EM or Toad or any other Tool

Or else u can use these queries :

1)
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


2)

CLEAR
SET HEAD ON
SET VERIFY OFF
spool frt1

col tspace form a25 Heading "Tablespace"
col tot_ts_size form 99999999999999 Heading "Size (Mb)"
col free_ts_size form 99999999999999 Heading "Free (Mb)"
col ts_pct form 9999 Heading "% Free"
col ts_pct1 form 9999 Heading "% Used"
break on report
compute sum of free_ts_size on report
compute sum of tot_ts_size on report
SELECT /* + RULE */ df.tablespace_name tspace,
df.bytes/(1024*1024) tot_ts_size,
sum(fs.bytes)/(1024*1024) free_ts_size,
nvl(round(sum(fs.bytes)*100/df.bytes),1) ts_pct,
round((df.bytes-sum(fs.bytes))*100/df.bytes) ts_pct1
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 /* + RULE */
df.tablespace_name tspace,
fs.bytes/(1024*1024) tot_ts_size,
sum(df.bytes_free)/(1024*1024) free_ts_size,
nvl(round((sum(fs.bytes)- df.bytes_used) *100/fs.bytes),1) ts_pct,
round((sum(fs.BYTES) - df.BYTES_free )*100/fs.bytes) ts_pct1
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
/
spool off

 sm_ahmeds
Posted: Nov 19, 2007 03:36:05 AM  

 Total Post: 53
 Joined: Apr, 2007






 

Vikhar you can use...

select f.tablespace_name,f.bytes/(1024*1024),u.bytes/(1024*1024) from sm$ts_free f,sm$ts_used u where f.tablespace_name=u.tablespace_name;


when are you comming to SA


 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar814
  Mohammed Taj704
  Jayanta Sur479
  positive fanatic416
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi242
  neeraj sharma231
  Ramesh Jois226
  Bishal Khetan196






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software