打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
LINUX系统和ORACLER监控脚本

#!/bash
echo 监控服务器磁盘空间
df -h|sed 's/%//g'|awk '$5>0 {print $NF,$(NF-1),$(NF-2),$(NF-3),$(NF-4),$(NF-5)}'>monitor.log

echo监控ORACLE数据库日志文件
awk /ORA-/ /u01/app/oracle/diag/rdbms/dfi/DFI/trace/alert_DFI.log >monitor.log
----监控表空间脚本
#!/bin/bash
PATH=$PATH:$HOME/bin
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product
export ORACLE_SID=DFNFDB
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
sqlplus system/syssys <<EOF
set head off
set echo off
set termout off
set trimspool on
set pagesize 0
set feedback off
set linesize 1024
spool d:\1.log
with a1 as
 (select tablespace_name, sum(bytes) / (1024 * 1024 * 1024) total
    from dba_data_files
   group by tablespace_name),
a2 as
 (select tablespace_name, sum(bytes) / (1024 * 1024 * 1024) free
    from dba_free_space
   group by tablespace_name)
select a1.tablespace_name "表空间名称",
       a1.total - a2.free "已使用大小(G)",
       a2.free "剩余大小(G)",
       a1.total "总大小(G)",
       (a1.total - a2.free) / a1.total "已使用%"
  from a1, a2
 where a1.tablespace_name = a2.tablespace_name;
spool off
exit;
<<EOF

awk '$5>0.87 {print $0}' monitor1.log >> monitor.log

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
8个DBA最常用的监控Oracle数据库的常用shell脚本
LINUX - awk命令之$NF的应用
使用shell批量生成数据整合式迁移的脚本(r8笔记第52天)
Linux(centos6.5)安装oracle10G_64位
Oracle 数据库迁移一键创建源库表空间 SQL语句
EXP,EXPDP数据导入本地性能测试的一点心得
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服