adding test scripts
[csql.git] / test / cache / Recovery / test005.ksh
blob67af1ff0faabb04f0208e689270e707a5949b05f
1 #!/bin/ksh
3 # Table recovery with composite index.
4 # Start TDB and create table in TDB t1 (f1 int,f2 int,f3 int,f4 char(10),i
5 # primary key(f1,f2)), Add entry for t1 table in csqltable.conf file.
6 # Recover with csqlserver -c option.
7 # Verify that it recovers the table with both the index information i
8 # and all the records using csqldump tool
10 CSQL_CONF=${PWD}/cache/Recovery/csql.conf
11 input=${PWD}/cache/Recovery/createt1.sql
12 REL_PATH=.
13 if [ -s "$input" -a -s "$CSQL_CONF" ]
14 then
15 REL_PATH=${PWD}/cache/Recovery
17 rm -f /tmp/csql.conf
18 if [ $DSN = "db2" ]
19 then
20 echo "create table t1(f1 int not null, f2 int not null,f3 int,f4 char(10),primary key(f1,f2));">$REL_PATH/t1.sql
21 else
22 echo "create table t1(f1 int , f2 int,f3 int,f4 char(10),primary key(f1,f2));">$REL_PATH/t1.sql
24 cp $REL_PATH/csql.conf /tmp
25 export CSQL_CONFIG_FILE=/tmp/csql.conf
27 echo DSN=$DSN >>$CSQL_CONFIG_FILE
28 DS="$DSN $DBUSER $PASSWORD"
29 rm -f /tmp/csql/csqlds.conf
30 touch /tmp/csql/csqlds.conf
31 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
32 if [ $? -ne 0 ]
33 then
34 rm -f $REL_PATH/t1.sql
35 exit 1;
38 isql $DS < $REL_PATH/t1.sql > /dev/null 2>&1
39 if [ $? -ne 0 ]
40 then
41 rm -f $REL_PATH/t1.sql
42 exit 2;
45 # edit /tmp/csql/csqltable.conf
46 rm -f /tmp/csql/csqltable.conf
47 touch /tmp/csql/csqltable.conf
48 echo "1 t1 NULL NULL NULL $DSN" >> /tmp/csql/csqltable.conf
49 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
50 pid=$!
51 sleep 5
53 rm -f /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
54 touch /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
56 $CSQL_INSTALL_ROOT/bin/csqldump
57 if [ $? -ne 0 ]
58 then
59 rm -f $REL_PATH/t1.sql
60 exit 5;
63 kill -9 $pid > /dev/null 2>&1
64 echo "drop table t1;">>$REL_PATH/drt1.sql
65 isql $DSN < $REL_PATH/drt1.sql > /dev/null 2>&1
66 rm -f $REL_PATH/t1.sql
67 rm -f $REL_PATH/drt1.sql
68 ipcrm -M 1199 -M 2277
69 rm -f /tmp/csql/csqltable.conf
70 touch /tmp/csql/csqltable.conf
71 exit 0;