oracle表空間增加監控
==========
建立記錄表:
create table hpe_m_ts
(
tsname char(20),
tssize number,
tsused number,
time timestamp
)
partition by range(time)
interval (numtoyminterval(1,'month'))
(partition p0 values less than (to_date('2010-01-01','yyyy-mm-dd')));
==========
cat >>/home/oracle/snow/tscheck.sql<<EOF
insert into hpe_m_ts(tsname,tssize,tsused,time) select * from
(SELECT
d.tablespace_name name
, NVL(a.bytes, 0)/1024/1024/1024 ts_size
, NVL(a.bytes - NVL(f.bytes, 0), 0)/1024/1024/1024 used
,c.time time
FROM
sys.dba_tablespaces d
, ( select tablespace_name, sum(bytes) bytes
from dba_data_files
group by tablespace_name
) a
, ( select tablespace_name, sum(bytes) bytes
from dba_free_space
group by tablespace_name
) f
,(
select sysdate time
from dual
) c
WHERE
d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = f.tablespace_name(+)
AND NOT (
d.extent_management like 'LOCAL'
AND
d.contents like 'TEMPORARY'
)
UNION ALL
SELECT
d.tablespace_name name
, NVL(a.bytes, 0)/1024/1024/1024 ts_size
, NVL(t.bytes, 0)/1024/1024/1024 used
,c.time time
FROM
sys.dba_tablespaces d
, ( select tablespace_name, sum(bytes) bytes
from dba_temp_files
group by tablespace_name
) a
, ( select tablespace_name, sum(bytes_cached) bytes
from v\$temp_extent_pool
group by tablespace_name
) t
,(select sysdate time
from dual
) c
WHERE
d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = t.tablespace_name(+)
AND d.extent_management like 'LOCAL'
AND d.contents like 'TEMPORARY'
ORDER BY
2
) ts
/
EOF
=============
放到crontab:
30 6 * * * su - oracle -c "sqlplus / as sysdba </home/oracle/snow/tscheck.sql"
=============
查詢:
select to_char(time,'yyyy-mm-dd hh24:mi:ss') time from hpe_m_ts;
set pagesize 5000
COLUMN TSSIZE FORMAT 9,999,999,999,999 HEADING 'TS Size(G)'
COLUMN TSUSED FORMAT 9,999,999,999,999 HEADING 'Used (G)'
select TSNAME,TSSIZE,TSUSED,to_char(time,'yyyy-mm-dd')
from hpe_m_ts
WHERE time>sysdate-7 ORDER BY TIME;
=============
查詢前一天增長情況:
set pagesize 5000
--select tsname,sum(TSUSED) TSUSED,count(*) from hpe_m_ts group by tsname order by TSUSED desc;
select
TSNAME,
TSUSED-lag(TSUSED,1,0)over(order by time) as last_increase,TSUSED,
lag(TSUSED,1,0)over(order by time) last_day_size,
to_char(time,'yyyy-mm-dd') as day
from hpe_m_ts
WHERE time>sysdate-30 and tsname='&tsname';
select sum(last_increase) from (select
TSNAME,
TSUSED-lag(TSUSED,1,0)over(order by time) as last_increase,TSUSED,
lag(TSUSED,1,0)over(order by time) last_day_size,
to_char(time,'yyyy-mm-dd') as day
from hpe_m_ts
WHERE time>sysdate-30 and tsname='&tsname') where rownum>1;
最近30添增長情況:
select sum(last_increase) from (select
TSNAME,
TSUSED-lag(TSUSED,1,0)over(order by time) as last_increase,TSUSED,
lag(TSUSED,1,0)over(order by time) last_day_size,
to_char(time,'yyyy-mm-dd') as day
from hpe_m_ts
WHERE time>sysdate-30 and tsname='&tsname') where LAST_DAY_SIZE<>0;
===================
select
TSNAME,
TSUSED-lag(TSUSED,1,0)over(order by time) as last_increase,TSUSED,
lag(TSUSED,1,0)over(order by time) last_day_size,
to_char(time,'yyyy-mm-dd') as day
from hpe_m_ts
WHERE time>sysdate-10 and tsname in ('TAB_BVS','TAB_VOM') order by day,tsname;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20747382/viewspace-2130418/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 監控oracle表空間指令碼Oracle指令碼
- 增加oracle表空間Oracle
- oracle監控表空間,JOB,rman備份Oracle
- 監控和管理Oracle UNDO表空間的使用Oracle
- Oracle 表空間增加檔案Oracle
- 表空間監控(三)tablespace detailAI
- 多臺ORACLE資料庫表空間監控方案Oracle資料庫
- [原創] 利用Oracle metric(threshold)監控表空間Oracle
- WINDOWS 環境下 監控ORACLE臨時表空間WindowsOracle
- 利用Oracle threshold(度量閥值)監控表空間Oracle
- oracle空間使用監控指令碼Oracle指令碼
- 表空間監控(二)datafile size detailAI
- Linux 自動增加oracle 表空間LinuxOracle
- 給Oracle BIGFILE表空間增加磁碟(通用的LINUX增加磁碟空間方案)OracleLinux
- 自動監控Oracle 表空間資訊併傳送郵件指令碼Oracle指令碼
- DB2表空間增加DB2
- 監控硬碟空間指令碼硬碟指令碼
- 檢視Oracle資料庫表空間大小,是否需要增加表空間的資料檔案Oracle資料庫
- linux自動增加表空間Linux
- Oracle表空間Oracle
- oracle 表空間Oracle
- oracle rac on aix 下為表空間增加資料檔案OracleAI
- linux 下監控磁碟空間Linux
- oracle 效能監控 <--轉至 陽光傾城 的空間Oracle
- db2檢視錶空間和增加表空間容量DB2
- MySQL 增加InnoDB系統表空間大小MySql
- 如何檢視Oracle資料庫表空間大小(空閒、已使用),是否要增加表空間的資料檔案...Oracle資料庫
- oracle temp 表空間Oracle
- oracle undo 表空間Oracle
- oracle users 表空間Oracle
- Oracle表空間管理Oracle
- oracle建立表空間Oracle
- Oracle 表空間管理Oracle
- oracle表空間操作Oracle
- ORACLE MOVE表空間Oracle
- ORACLE表空間概述Oracle
- Oracle表空間命令Oracle
- Oracle 表空間回收Oracle