INFORMIX--unload備份

unload備份腳本

#vi unload.sh

  echo "begin_dbaflag date +%Y-%m-%d date +%H-%M-%S"
  cd /exp/backup/backupdata

  day=`date +%w`

  dbaccess sysmaster<<!

       unload to db.txt delimiter '|' select name

       from sysdatabases where name not like "sys%"

  !

  if [ -e $day ];

  then

       rm -rf $day

  fi

  mkdir $day

  cd $day

  cat ../db.txt |while read line

  do

       mkdir $line

       cd $line

       echo "******$line****"

       dbaccess sysmaster<<!

       unload to $line.sql delimiter '#'

       select "unload to ",tabname,"delimiter '|' select * from",tabname,";"

       from systables where tabname not like "sys%“ and tabname='T'

       !

       sed 's/#//g' $line.sql >line1.sql

       cat line1.sql >$line.sql

       rm line1.sql

       dbaccess $line $line.sql

       cd ..

  done

  cd ..

  echo "end_dbaflag  date +%Y-%m-%d date +%H-%M-%S"

你可能感兴趣的:(Date)