*** empty log message ***
[csql.git] / test / cache / Recovery / test006.ksh
blobaca9c21ad41760c24c9a0169e3ccd6a0fbe0e343
1 #!/bin/ksh
3 # Table recovery with primary composite and secondary 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)) create index idx2 on t1 (f3,f4)
6 # Add entry for t1 table in csqltable.conf file.
7 # Recover with csqlserver -c option.
8 # Verify that it recovers the table with both the index information and all
9 # the records using csqldump tool
11 input=${PWD}/cache/Recovery/createt1.sql
12 REL_PATH=.
13 if [ -s "$input" ]
14 then
15 REL_PATH=${PWD}/cache/Recovery
17 echo "create table t1(f1 int , f2 int,f3 int,f4 char(10),primary key(f1,f2));">$REL_PATH/t1.sql
18 echo "create index idx2 on t1(f3,f4);">>$REL_PATH/t1.sql
20 rm /tmp/csql.conf
21 cp $REL_PATH/csql.conf /tmp
22 export CSQL_CONFIG_FILE=/tmp/csql.conf
24 echo DSN=$DSN >>$CSQL_CONFIG_FILE
25 DS="$DSN $DBUSER $PASSWORD"
26 rm -f /tmp/csql/csqlds.conf
27 touch /tmp/csql/csqlds.conf
28 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
29 if [ $? -ne 0 ]
30 then
31 rm -f $REL_PATH/t1.sql
32 exit 1;
35 isql $DS < $REL_PATH/t1.sql > /dev/null 2>&1
36 if [ $? -ne 0 ]
37 then
38 rm -f $REL_PATH/t1.sql
39 exit 2;
42 # edit /tmp/csql/csqltable.conf
43 rm -f /tmp/csql/csqltable.conf
44 touch /tmp/csql/csqltable.conf
45 echo "1 t1 NULL NULL NULL $DSN" > /tmp/csql/csqltable.conf
47 $CSQL_INSTALL_ROOT/bin/csqlserver -c > /dev/null 2>&1 &
48 pid=$!
49 sleep 5
51 rm -f /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
52 touch /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
53 echo "drop table t1;">>$REL_PATH/drt1.sql
55 $CSQL_INSTALL_ROOT/bin/csqldump
56 if [ $? -ne 0 ]
57 then
58 rm -f $REL_PATH/t1.sql
59 isql $DS < $REL_PATH/drt1.sql > /dev/null 2>&1
60 rm -f $REL_PATH/drt1.sql
61 exit 3;
64 kill -9 $pid > /dev/null 2>&1
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;