How to backup and restore sybase database tables u

2019-01-29 10:45发布

问题:

How can I backup my sybase tables and restore using command line? please help me with the command using bcp

I have tried using sybase central GUI Thanks.

回答1:

Since you didn't specify whether you are running on Windows or Unix I'll try to cover both.

Unix bcp is located in $SYBASE/$SYBASE_OCS/bin/ Windows bcp is located in %SYBASE%\%SYBASE_OCS%\bin

Export

bcp DB_NAME..TABLE_NAME out TABLE_NAME.bcp -Sservername -Uusername -Ppassword -[c or n] 

Choose either -c or -n depending if you want the file to be human readable or not. I recommend using -n unless you have a compelling need to use -c TABLE_NAME.bcp can be any filename, with any extension.

Import

$SYBASE/$SYBASE_OCS/bin/bcp DB_NAME..TABLE_NAME in TABLE_NAME.bcp -Sservername -Uusername -Ppassword -[c or n]

There are many more options and flags available, but these are the basics to get it to work.

More information abou the bcp utility can be found here:

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc30191.1570/html/utilityguide/BABGCCIC.htm

and

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc30191.1570/html/utilityguide/X14951.htm