forked from joe-speedboat/linux.scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oracle-check-invalid-objects.sh
46 lines (39 loc) · 1.39 KB
/
oracle-check-invalid-objects.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# DESC: search for invalid objects
# $Revision: 1.2 $
# $RCSfile: oracle-check-invalid-objects.sh,v $
# $Author: chris $
# Copyright (c) Chris Ruettimann <[email protected]>
# This software is licensed to you under the GNU General Public License.
# There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/gpl.txt
SUBJ="INVALID OBJECTS for $ORACLE_SID on $(uname -n)"
TO='[email protected]'
sqlplus -S -L "/ as sysdba" << EOF | egrep -v 'PUBLIC|OLAPSYS'
set linesize 300;
set pagesize 300;
set feedback off;
column object_name format a30
spool invalid_object.alert
SELECT OWNER, OBJECT_NAME, OBJECT_TYPE, STATUS
FROM DBA_OBJECTS
WHERE STATUS = 'INVALID'
ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
spool off
EOF
if [ `cat invalid_object.alert | egrep -v 'PUBLIC|OLAPSYS' | wc -l` -gt 3 ]
then
cat invalid_object.alert | egrep -v 'PUBLIC|OLAPSYS' | mail -s "$SUBJ" $TO
fi
rm -f invalid_object.alert
################################################################################
# $Log: oracle-check-invalid-objects.sh,v $
# Revision 1.2 2012/06/10 19:18:48 chris
# auto backup
#
# Revision 1.1 2010/01/17 20:40:15 chris
# Initial revision
#