瀏覽代碼

Fixed error if dba_free_space has no free segments (Florian Gleixner)

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1529 f882894a-f735-0410-b71e-b25c423dba1c
Ton Voon 19 年之前
父節點
當前提交
94a3cf91b3
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 1 0
      THANKS.in
  2. 4 3
      plugins-scripts/check_oracle.sh

+ 1 - 0
THANKS.in

@@ -199,3 +199,4 @@ Craig Orsinger
 Robby Giffin
 Henning Schmiedehausen
 Markus Baertschi
+Florian Gleixner

+ 4 - 3
plugins-scripts/check_oracle.sh

@@ -244,13 +244,14 @@ EOF`
     result=`sqlplus -s ${3}/${4}@${2} << EOF
 set pagesize 0
 set numf '9999999.99'
-select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
+select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc
 from (
 select tablespace_name,sum(bytes)/1024/1024 total
-from dba_data_files group by tablespace_name) A,
+from dba_data_files group by tablespace_name) A
+LEFT OUTER JOIN
 ( select tablespace_name,sum(bytes)/1024/1024 free
 from dba_free_space group by tablespace_name) B
-where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}';
+ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}';
 EOF`
 
     if [ -n "`echo $result | grep ORA-`" ] ; then