求一个oracle数据库表空间监控程序或工具,能及时监控到表空间超出等情况,最好能发邮件或短信提醒的,谢谢,公司给安排的工作,今天必须完成,希望大神帮帮我啊!可以发我邮箱 296580677@qq.com
Oracle 数据库 监控工具
------解决方案--------------------
-- 我是用 存储过程 + job循环调度 + 139邮箱实时接收雉通知实现的。
--
------解决方案--------------------
-- 下面是我的实现代码(当然,在写过程前,你得有你们的邮件服务器,且在oracle中配置好ACL)
-- 一、监控土豆北京Oracle数据库服务器各表空间的使用情况:
-- 在以上4台服务器的data_monitor用户中创建视图:
GRANT SELECT ON DBA_FREE_SPACE TO DATA_MONITOR;
GRANT SELECT ON DBA_DATA_FILES TO DATA_MONITOR;
GRANT CREATE VIEW TO DATA_MONITOR;
CREATE OR REPLACE VIEW data_monitor.tablespace_info
AS
SELECT a.tablespace_name as tablespace_name,
to_char(b.total/1024/1024,999999.99) as Total,
to_char((b.total-a.free)/1024/1024,'9999990D99') as Used,
to_char(a.free/1024/1024,'9999990D99') as Free,
to_char(round((total-free)/total,4)*100,'9999990D99')
------解决方案--------------------
'%' as Used_Rate
FROM (SELECT tablespace_name, sum(bytes) 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
AND round((total-free)/total,4)*100 > 90
ORDER BY round((total-free)/total,4) DESC;
----------------------------------------
-- *1). 创建存储过程用以监控各表空间的使用情况
create or replace PROCEDURE pro_get_tbs_info
AS
/******************************************************************************