Shell script implements Sybase data backup

Source: Internet
Author: User
Tags sybase backup

It can be created under Sybase users and named Bcpoutdata.

Then chmod a+x bcpoutdata

Run Bcpoutdata under the Sybase user.

Note:

1) Change the database_name to your database name.

2 Change the PAS to your sa password.

3 Change the server to your SQL Server name.

4 to import, change out to in.

And finally, don't forget to create a directory under Sybase users,

Put the bcpoutdata into it and run it again.

What, what? You have to pack and compress.

Ah, in the back add a few:

Tar cvf Data.tar *.bcp

Compress Data.tar

RM *.bcp

Good luck to all of you.

isql -Usa -Ppas -Sserver -otables.tmp <<-EOF
USE database_name
GO
SELECT name FROM sysobjects WHERE type='U' ORDER BY name
GO
exit
EOF
vi tables.tmp </dev/null
:1,2 d
:$ d
:1,$ <<<
: x
EOF
total=`cat tables.tmp|wc -l`
current=0
for table in `cat tables.tmp`
do
current=$current+1
echo "*** $current/$total bcpout $table ***"
bcp database_name..$table out $table.bcp -Usa -Ppas -Sserver -Jiso_1 -c
echo "*** $table done ***n"
done
rm tables.tmp

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.