测试环境:
服务器:piii866+512mb +raid5
windows 2000 server+sp4 ;sqlserver2000+sp3
客户端:windows 2000 pro+sp4+sqlserver2000 client+sp3
1.先在server端建立一个dts包:
这可以根据向导一步一步的完成,我就不多说了。比如我门建立了一个导入excel文件到 sqlserver的dts包:dts_exceltosqlserver
2.在客户端建立一个批处理文件
crundts.bat
3.用文本编辑器编辑:
@@echo off
if [%1] == [] goto usage
if [%2] == [] goto usage
if [%3] == [] goto usage
if [%4] == [] goto usage
cls
set logfile=c:/dtsrun.log
echo %time% manual dts package start run......... >> %logfile%
echo ------------------------------------------ >> %logfile%
@dtsrun /s %1 /u %2 /p %3 /n %4 >> %logfile%
if errorlevel 1 goto error
echo %time% manual dts package end......... >> %logfile%
echo ------------------------------------------ >> %logfile%
pause
goto finish
:error
echo ------------------------------------------- >> %logfile%
echo dtsrun error pls check log .........
echo %time% globalstore backup abnormal end. >> %logfile%
pause
goto finish
:usage
echo.
echo usage:crundts %1 servername %2 use_name %3 password %4 dts_name
:finish
4.保存该文件:
然后你可以在任何程序中调用,也可以手工执行,输入参数
5.测试运行:
在dos提示符下运行:crundts servername sa password dts_exceltosqlserver
6.日志信息:
10:24:29.38 manual dts package start run.........
------------------------------------------
dtsrun: loading...
error: -2147217900 (80040e14); provider error: 14262 (37b6)
error string:
error source:
help file:
help context: 0
10:24:29.66 manual dts package end.........
------------------------------------------
10:27:29.41 manual dts package start run.........
------------------------------------------
dtsrun: loading...
dtsrun: executing...
dtsrun onstart: dtsstep_dtsdatapumptask_1
dtsrun onprogress: dtsstep_dtsdatapumptask_1; 23 rows have been transformed or copied.; percentcomplete = 0; progresscount = 23
dtsrun onfinish: dtsstep_dtsdatapumptask_1
dtsrun: package execution complete.
10:27:30.02 manual dts package end.........
------------------------------------------
新闻热点
疑难解答