[Oracle Script] check tablespace usage info
set pagesize 100
set timing on
select * from
(select x.tablespace_name,x.contents,x.status,x.extent_management,x.all_bytes/1024/1024 "ALL_SIZE(MB)",y.free_bytes/1024/1024 "FREE_SIZE(MB)",
(x.all_bytes-y.free_bytes)/1024/1024 "USED_SIZE(MB)",round((x.all_bytes-y.free_bytes)/x.all_bytes,4)*100 USAGE
from (select ts.tablespace_name,ts.contents,ts.status,ts.extent_management,sum(bytes) all_bytes from
dba_tablespaces ts, dba_data_files dbf
where ts.tablespace_name=dbf.tablespace_name group by ts.tablespace_name,ts.contents,ts.status,ts.extent_management) x,
(select tablespace_name,sum(bytes) free_bytes from dba_free_space fs group by tablespace_name) y
where x.tablespace_name=y.tablespace_name
union all
select h.tablespace_name,'TEMPORARY' contents,f.status,'LOCAL',sum(h.bytes_free+h.bytes_used)/1024/1024 "ALL_SIZE(MB)",sum((h.bytes_free+h.bytes_used-nvl(p.bytes_used,0)))/1024/1024 "FREE_SIZE(MB)",
sum(p.bytes_used)/1024/1024 "USED_SIZE(MB)",round(sum(p.bytes_used)/sum(h.bytes_free+h.bytes_used),4)*100 USAGE
from v$temp_space_header h,v$temp_extent_pool p,dba_temp_files f
where h.file_id=p.file_id(+) and h.file_id=f.file_id
group by h.tablespace_name,f.status)
order by 8 desc;
select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') systime from dual;
set timing on
select * from
(select x.tablespace_name,x.contents,x.status,x.extent_management,x.all_bytes/1024/1024 "ALL_SIZE(MB)",y.free_bytes/1024/1024 "FREE_SIZE(MB)",
(x.all_bytes-y.free_bytes)/1024/1024 "USED_SIZE(MB)",round((x.all_bytes-y.free_bytes)/x.all_bytes,4)*100 USAGE
from (select ts.tablespace_name,ts.contents,ts.status,ts.extent_management,sum(bytes) all_bytes from
dba_tablespaces ts, dba_data_files dbf
where ts.tablespace_name=dbf.tablespace_name group by ts.tablespace_name,ts.contents,ts.status,ts.extent_management) x,
(select tablespace_name,sum(bytes) free_bytes from dba_free_space fs group by tablespace_name) y
where x.tablespace_name=y.tablespace_name
union all
select h.tablespace_name,'TEMPORARY' contents,f.status,'LOCAL',sum(h.bytes_free+h.bytes_used)/1024/1024 "ALL_SIZE(MB)",sum((h.bytes_free+h.bytes_used-nvl(p.bytes_used,0)))/1024/1024 "FREE_SIZE(MB)",
sum(p.bytes_used)/1024/1024 "USED_SIZE(MB)",round(sum(p.bytes_used)/sum(h.bytes_free+h.bytes_used),4)*100 USAGE
from v$temp_space_header h,v$temp_extent_pool p,dba_temp_files f
where h.file_id=p.file_id(+) and h.file_id=f.file_id
group by h.tablespace_name,f.status)
order by 8 desc;
select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') systime from dual;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2141487/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [Oracle Script] check temp tablespace usageOracle
- [Oracle Script] check lock infoOracle
- [Oracle Script] Temporary Sort UsageOracle
- [Oracle Script] Rollback Segment UsageOracle
- Oracle 11g tablespace usageOracle
- [Oracle Script] check userOracle
- [Oracle Script] check latchOracle
- [Oracle Script] Undo Usage Per statusOracle
- [Oracle Script] Undo Usage Per sessionOracleSession
- [Oracle Script] check active sessionOracleSession
- [Oracle Script] check Literal SQLOracleSQL
- [Oracle Script] check object count by userOracleObject
- [Oracle Script] check File I/OOracle
- Tablespace Space Script
- [Shell] Linux monitor tablespace usageLinux
- check ftp success scriptFTP
- 4.Linux monitor tablespace usageLinux
- script of check repair ASM DISKGROUPAIASM
- Oracle10g新增的檢視dba_tablespace_usage_metricsOracle
- SAP WM中階Storage Type的Capacity Check – Usage check based on SUT
- SAP WM中階儲存型別的Capacity Check – Usage check based on material型別
- Oracle11g新增檢視查詢表空間使用率DBA_TABLESPACE_USAGE_METRICSOracle
- oracle scriptOracle
- Script to Detect Tablespace Fragmentation [ID 1020182.6]Fragment
- Oracle runInstaller 's UsageOracle
- Oracle NUMA usage recommendationOracle
- The DBA_TABLESPACE_USAGE_METRICS View Needs to be Rebuilt in 10g_738101.1ViewUI
- [Oracle Script] LockOracle
- Oracle Database ScriptOracleDatabase
- Oracle NUMA Usage Recommendation [ID 759565.1]Oracle
- [Oracle Script] Top sqlOracleSQL
- Oracle kill session scriptOracleSession
- ORACLE常用Script(轉)Oracle
- ORACLE常用Script (轉)Oracle
- Oracle OCP(48):UNDO TABLESPACEOracle
- Oracle Table and tablespace CompressOracle
- Script to Check for Foreign Key Locking Issues [ID 1019527.6]
- V$TEMPSEG_USAGE與Oracle排序Oracle排序