Linux下执行bcp指令
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
先抛一个问题
[root@localhost AccountInspector]# bcp INSPECTOR_LOG.dbo.Table_NewVersionAvgDelay out t001.txt -c -U sa -P hundsun@1 -S 192.168.11.11
bash: bcp: 未找到命令...
Linux下不支持pcb,需要安装相应的工具包,安装教程如下
我的系统是CentOs7,按照Red Hat版本进行安装
1.进入超级用户模式
sudo su
2.下载配置文件
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
3.退出超级用户模式
Exit
4.如果之前安装过mssql-tools ,要将那些老版本的unixODBC卸载掉
sudo yum update
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
5.安装最新的unixODBC开发包
sudo yum update
sudo yum install mssql-tools unixODBC-devel
6.配置环境变量
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
7.为了能够在不登录会话或者是交互模式可以执行sqlcmd/bcp,需要在~/.bashrc文件中修改路径
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
再次执行指令发现可以使用pcb了
[root@localhost ~]# bcp INSPECTOR_LOG.dbo.Table_NewVersionAvgDelay out t001.txt -c -U sa -P hundsun@1 -S 192.168.11.11
Starting copy...
1000 rows successfully bulk-copied to host-file. Total received: 1000
1000 rows successfully bulk-copied to host-file. Total received: 2000
1000 rows successfully bulk-copied to host-file. Total received: 3000
1000 rows successfully bulk-copied to host-file. Total received: 4000
1000 rows successfully bulk-copied to host-file. Total received: 5000
1000 rows successfully bulk-copied to host-file. Total received: 6000
1000 rows successfully bulk-copied to host-file. Total received: 7000
1000 rows successfully bulk-copied to host-file. Total received: 8000
1000 rows successfully bulk-copied to host-file. Total received: 9000
9703 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 407 Average : (23840.3 rows per sec.)




A beautiful web dashboard for Linux
最近提交(Master分支:5 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
所有评论(0)