新聞中心
導(dǎo)讀:Sybase數(shù)據(jù)備份之BCP用法是大家不常見(jiàn)的,不為大家所熟悉,但也是一種很好的Sybase數(shù)據(jù)備份的方法之一,下文中就為大家介紹,希望對(duì)大家有用處。

BCP一般存放在所安裝的ASE或者Open Client 的BIN目錄中。12版本以前的ASE,bcp存放目錄為 $SYBASE/bin,12版本(含12版本)以后存放目錄為 $SYBASE/OCS-12_x/bin。其中$SYBASE為SYBASE安裝目錄,12_x代表12.0、12.5版本,顯示為12_0或者12_5,可執(zhí)行文件名稱為bcp.EXE。
參數(shù)列表如下:(可用 bcp – 得到)
- usage: bcp [[database_name.]owner.]table_name[:slice_number] {in | out} datafile
- [-m maxerrors] [-f formatfile] [-e errfile]
- [-F firstrow] [-L lastrow] [-b batchsize]
- [-n] [-c] [-t field_terminator] [-r row_terminator]
- [-U username] [-P password] [-I interfaces_file] [-S server]
- [-a display_charset] [-q datafile_charset] [-z language] [-v]
- [-A packet size] [-J client character set]
- [-T text or image size] [-E] [-g id_start_value] [-N] [-X]
- [-M LabelName LabelValue] [-labeled]
- [-K keytab_file] [-R remote_server_principal]
- [-V [security_options]] [-Z security_mechanism] [-Q]
常用的數(shù)據(jù)庫(kù)備份格式為:
bcp dbname..tablename out c:tempfilename -Usa -Ppassword –Sservername –c
其中 –U后為SYBASE登錄名稱,–P后為SYBASE登錄口令,–S后為SYBASE服務(wù)名稱,–c代表使用可見(jiàn)文本方式導(dǎo)出數(shù)據(jù),如果為數(shù)據(jù)恢復(fù)只需要將out 替換為 in 即可。
可用如下方法生成一個(gè)可以一次導(dǎo)出一個(gè)數(shù)據(jù)庫(kù)中所有表的數(shù)據(jù)的執(zhí)行腳本。
編輯一個(gè)如下文本文件,文件名稱例為 bcpscript:
use dbname 選中將要導(dǎo)出數(shù)據(jù)的數(shù)據(jù)庫(kù)
go
select 'bcp dbname..' + name + ' out c:temp' + name + ' -Usa -P -Ssybcdsrv -c' from sysobjects where type = 'U' (在sysobjects系統(tǒng)表中type為U的表為用戶表,系統(tǒng)表為S)
go
用如下格式執(zhí)行:
isql –Usa –Ppassword –Sservername –i bcpscript –o bcpout.bat(i參數(shù)后為輸入文件,o參數(shù)后文件為輸入文件執(zhí)行后得到的輸出文件)
這就是我要為大家講解的Sybase數(shù)據(jù)備份之BCP用法的全部知識(shí),當(dāng)然這只是Sybase數(shù)據(jù)備份之BCP用法的一部分,如果大家感興趣,我還會(huì)繼續(xù)為大家介紹,希望大家都能夠從中收獲。
網(wǎng)頁(yè)題目:Sybase數(shù)據(jù)備份之BCP用法簡(jiǎn)介
鏈接分享:http://fisionsoft.com.cn/article/copieod.html


咨詢
建站咨詢
