If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Help on oracle tablespace report.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-13-06, 04:44
junaidi junaidi is offline
Registered User
 
Join Date: Oct 2004
Posts: 4
Red face Help on oracle tablespace report.

Need help here. Sample report from oracle below.

Tablespace Report for Database IMDB on Host ZZZ01
================================================== =====
------------------------------------------------------
Tablespace Name EFAULT_UNDO_TBS
Allocated Space for tablespace (MB) :198
Free Space for tablespace (MB) :197
Used (MB) :1
% Free space in tablespace :19
------------------------------------------------------
Tablespace Name :WAKINDEXES
Allocated Space for tablespace (MB) :1000
Free Space for tablespace (MB) :931
Used (MB) :69
% Free space in tablespace :23
------------------------------------------------------

I wanna grep for the line "% Free space in tablespace" and report if it's less than 20. Ok that's easy but i need the report to be like one below. Just need the Host, Database name and Tablespace name.

Tablespace Report for Database IMDB on Host ZZZ01
================================================== =====
Tablespace Name EFAULT_UNDO_TBS
% Free space in tablespace :19
Reply With Quote
  #2 (permalink)  
Old 01-13-06, 04:46
junaidi junaidi is offline
Registered User
 
Join Date: Oct 2004
Posts: 4
Is capital D being replaced by a biggie smile?
Reply With Quote
  #3 (permalink)  
Old 01-13-06, 11:24
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


Why not just run an SQL script like this one:
Code:
column "TOTAL MB" format 9999,999,999.9
column "TOTAL USED" format 9999,999,999.9
column "TOTAL FREE" format 9999,999,999.9
column "PCT FREE" format 999.9
set feedback on;

Select B.Tablespace_Name, B.Total/1048576 "Total Mb",
       Nvl((B.Total-A.Total_Free)/1048576, 100) "Total Used",
       Nvl(A.Total_Free/1048576, 0) "Total Free",
       Nvl((A.Total_Free/B.Total) * 100, 0) "Pct Free"
From (
        Select Tablespace_Name, Sum(Bytes) Total_Free
        From Sys.Dba_Free_Space
        Group By Tablespace_Name ) A
    , (
        Select Tablespace_Name, Sum(Bytes) Total
        From Sys.Dba_Data_Files
        Group By Tablespace_Name ) B
Where A.Tablespace_Name(+) = B.Tablespace_Name
Order By 5,1;

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On