*** empty log message ***
[csql.git] / test / cache / Recovery / test003.ksh
blobaf3e0744c325f56e61c44bbbd5dcc81118446f3c
1 #!/bin/ksh
2 # Start TDB and create table in TDB t1(f1 int primary key, f2 int ),
3 # create index idx2 on t1 (f2) and insert 10 records each.
4 # Add entry for t1 table in csqltable.conf file.
5 # Recover with csqlserver -c option.
6 # Verify that it recovers the table with both the index information and
7 # all the records using the csqldump tool.
9 CSQL_CONF=${PWD}/cache/Recovery/csql.conf
10 input=${PWD}/cache/Recovery/createt1.sql
11 REL_PATH=.
12 if [ -s "$input" -a -s "$CSQL_CONF" ]
13 then
14 REL_PATH=${PWD}/cache/Recovery
17 rm -f /tmp/csql.conf
18 cp $REL_PATH/csql.conf /tmp
19 export CSQL_CONFIG_FILE=/tmp/csql.conf
20 echo DSN=$DSN >>$CSQL_CONFIG_FILE
21 DS="$DSN $DBUSER $PASSWORD"
22 rm -f /tmp/csql/csqlds.conf
23 touch /tmp/csql/csqlds.conf
24 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
25 if [ $? -ne 0 ]
26 then
27 exit 1;
30 if [ $DSN = "oracle" ]
31 then
32 isql $DS < $REL_PATH/createt1.oracle > /dev/null 2>&1
33 if [ $? -ne 0 ]
34 then
35 exit 2;
37 else
38 isql $DS < $REL_PATH/createt1.sql > /dev/null 2>&1
39 if [ $? -ne 0 ]
40 then
41 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
50 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
51 pid=$!
52 sleep 5
54 rm -f /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
55 touch /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
57 $CSQL_INSTALL_ROOT/bin/csqldump
58 if [ $? -ne 0 ]
59 then
60 isql $DS < $REL_PATH/drop.sql > /dev/null 2>&1
61 exit 5;
64 kill -9 $pid > /dev/null 2>&1
66 isql $DS < $REL_PATH/drop.sql > /dev/null 2>&1
67 ipcrm -M 1199 -M 2277
68 rm -f /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
69 touch /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
70 exit 0;