-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstat_dumps.sh
More file actions
executable file
·55 lines (55 loc) · 1.4 KB
/
stat_dumps.sh
File metadata and controls
executable file
·55 lines (55 loc) · 1.4 KB
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
47
48
49
50
51
52
53
54
55
#set -x
pages="pages-xxxxx"
len=0
for d in `cat dbs`
do
dbtbl=`mysql -NBe "SELECT NAME FROM SYS_TABLES WHERE NAME LIKE '$d/%'" test`
for dt in $dbtbl
do
l="`echo $dt | wc -c`"
if [ $l -gt $len ]; then len=$l; fi
done
done
printf "%${len}s %8s %8s %16s %6s %6s\n" "Table" "Index" "Dir" "Recs,d/t" "Lost" "Complete"
for d in `cat dbs`
do
dbtbl=`mysql -NBe "SELECT NAME FROM SYS_TABLES WHERE NAME LIKE '$d/%'" test`
for dt in $dbtbl
do
t=`echo $dt | awk -F/ '{ print $2}'`
index_id=""
table_id=`mysql -NBe "SELECT ID FROM SYS_TABLES WHERE NAME = '$d/$t'" test`
if ! test -z "$table_id"
then
index_id=`mysql -NBe "SELECT ID FROM SYS_INDEXES WHERE TABLE_ID = '$table_id' ORDER BY ID LIMIT 1" test`
fi
dir="N"
if test -d "$pages/FIL_PAGE_INDEX/0-$index_id"
then
dir="Y"
fi
dump="N"
recs="0"
lost="NA"
if test -f "dumps/$d/$t"
then
dump="Y"
recs="`grep -v '^--' dumps/$d/$t | wc -l`"
recs_a="`mysql -NBe "select count(*) from $d.$t"`"
if test -z "`cat dumps/$d/$t | grep "Lost records: YES"| grep -v "Leaf page: NO"`"
then
lost="NO"
else
lost="YES"
fi
fi
complete="NO"
index_id_ok="NO"
if ! test -z "$index_id"
then
index_id_ok="OK"
if [ "`./index_chk -f $pages/FIL_PAGE_INDEX/0-$index_id`" = "OK" ] ; then complete="YES"; fi
fi
printf "%${len}s %8s %8s %16s %6s %6s\n" $d/$t $index_id_ok $dir $recs/$recs_a $lost $complete
done
done