• Home
  • Oracle
    • RAC
    • ODA
    • Exa DATA
    • SQL
    • PL/SQL
    • Backup
  • Cloud
  • AI
  • OS
    • Linux
    • Unix
    • Windows
  • About Us
  • Careers
  • Contact us
Ajara
Home
  • Home
  • Oracle
    • RAC
    • ODA
    • Exa DATA
    • SQL
    • PL/SQL
    • Backup
  • Cloud
  • AI
  • OS
    • Linux
    • Unix
    • Windows
  • About Us
  • Careers
  • Contact us

News

  1. Home
  2. All posts
All posts, Oracle, SQL by Team Ajara

Oracle Tablespace report in html format

Script to get Tablespace report in html format.

Run the below script on SQL prompt of oracle database .

It generates tbs_rep.html file .

SET MARKUP HTML ON ENTMAP OFF

spool tbs_rep.html
PROMPT <P><H3>Tablespace Space Allocation and Utilization</H3>
PROMPT <HTML>
PROMPT <TITLE>

SELECT ‘ Oracle  Databases Tablespace Report ran on ‘  ||  TO_CHAR(SYSDATE, ‘MON-DD-YYYY HH24:MM:SS PM’) FROM DUAL ;

PROMPT </TITLE>

set head off feed off
PROMPT <br>
SELECT ‘ Oracle  Databases Tablespace Report ran on ‘  ||  TO_CHAR(SYSDATE, ‘MON-DD-YYYY HH24:MM:SS PM’) FROM DUAL ;

select ‘Database Name :      ‘||name from v$database;

set head on

SET HEADING  ON
SET FEEDBACK OFF
— PROMPT <H3> Ensure that all tablespaces have atleast 20% of free space </H3>

set pages 200 lines 150
col TOTAL_GB format 99999999.00
col USED_GB format 99999999.00
col FREE_GB format 99999999.00
col PCT_USED format 999.99
col PCT_FREE format 999.99

select (select name from v$database) DB_NAME,
u.size_GB total_GB
,u.size_GB-f.free_GB used_GB
,f.free_GB
,((u.size_GB-f.free_GB)/u.size_GB)*100 pct_used
,(f.free_GB/u.size_GB)*100 pct_free
from
(select sum(a.bytes)/1024/1024/1024 size_GB
from dba_data_files a) u
,(select sum(b.bytes)/1024/1024/1024 free_GB
from dba_free_space b
) f
/
set feed on

select
u.tablespace_name
,u.size_GB total_GB
,u.size_GB-f.free_GB used_GB
,f.free_GB
,((u.size_GB-f.free_GB)/u.size_GB)*100 pct_used
,(f.free_GB/u.size_GB)*100 pct_free
from
(select a.tablespace_name,sum(a.bytes)/1024/1024/1024 size_GB
from dba_data_files a
group by a.tablespace_name) u
,(select b.tablespace_name,sum(b.bytes)/1024/1024/1024 free_GB
from dba_free_space b
group by b.tablespace_name ) f
where u.tablespace_name=f.tablespace_name(+)
order by pct_used desc
/

PROMPT <A href=”#TopOfPage”>Back to the Top of Report</A>

PROMPT </BODY>
PROMPT </HTML>
spool off
SET MARKUP HTML OFF ;

 

Output is in html format

Tablespace Space Allocation and Utilization

 

Oracle Database Tablespace Report ran on AUG-02-2023 14:08:09 PM

 

Database Name : ORCLP

 

DB_NAME TOTAL_GB USED_GB FREE_GB PCT_USED PCT_FREE
ORCLP 4.34 4.20 .15 96.57 3.43

 

TABLESPACE_NAME TOTAL_GB USED_GB FREE_GB PCT_USED PCT_FREE
SYSTEM 1.07 1.07 .01 99.36 .64
USERS 1.76 1.72 .04 97.56 2.44
SYSAUX 1.46 1.39 .08 94.82 5.18
UNDOTBS1 .04 .02 .02 47.22 52.78

4 rows selected.

Back to the Top of Report

See also
  • script to verify oracle tablespace usage
  • script to find load average on the OS Level
  • http://oracle.com

Previous PostNext Post

Category

  • AI
  • All posts
  • AWS
  • Backup
  • Careers
  • Cloud
  • DR
  • Exa DATA
  • Golden Gate
  • ODA
  • OEM
  • Operating Systems
    • Linux
    • Unix
    • Windows
  • Oracle
  • PL/SQL
  • postgresql
  • RAC
  • Scripting
    • Shell
  • SQL
  • Technology

Recent Posts

  • Oracle Management Server is Down. PBS may not be up August 22, 2024
  • Script to take Oracle DB full backup using networker July 19, 2024
  • Networker backup software installation on ODA July 18, 2024
Download Our Details
Home
If You’re Looking For Instantly, Find The Online Coding  Solutions at “ajara.tech”.  You With Trusted Sources of Information.

Footer Links

  • Home
  • All posts
  • Disclaimer
  • Privacy Policy
  • Contact us

Subscribe

All Technologies
‘ajara.tech’ | © Copyright 2022-2023 | by Team Ajara