Error = [Microsoft][SQL Server Native Client 11.0]Unable to open BCP host data-file
来源:互联网 发布:杭州行知中学校园网 编辑:程序博客网 时间:2024/06/07 16:00
今天执行bcp命令,将查询结果生成一个excel文件放在本地。
命令:
EXEC master..xp_cmdshell N'bcp "SELECT ''数据库ID'',''数据库名称'',''对象Id'',''表名'',''查询语句'',''总消耗CPU 时间(ms)'',''执行次数'',''平均消耗CPU 时间(ms)'',''最后一次执行时间'',''最小执行时间(ms)]'',''最大执行时间(ms)'' UNION ALL SELECT CAST(dbid AS NVARCHAR(100)),dbname,CAST(ObjectId AS NVARCHAR(100)) ,ObjectName ,SelectStatement ,CAST(total_worker_time AS NVARCHAR(100)) , CAST(execution_count AS NVARCHAR(100)) ,CAST( avg_elasped_time AS NVARCHAR(100)) ,CAST( last_execution_time AS NVARCHAR(100)),CAST(min_worker_time AS NVARCHAR(100)) ,CAST( max_worker_time AS NVARCHAR(100)) FROM dba.dbo.bdd_temp_find_top_select_cpu" queryout e:top_select_cpu.txt -c -S"10.0.8.102\sqlinstance" -T'
报错:
出错原因:
可能没有该路径或者你没有该路径的写权限。
解决办法:换一个有权限的路径即可或者赋予相应的权限。
我选择了换一个有权限的路径:
EXEC master..xp_cmdshell N'bcp "SELECT ''数据库ID'',''数据库名称'',''对象Id'',''表名'',''查询语句'',''总消耗CPU 时间(ms)'',''执行次数'',''平均消耗CPU 时间(ms)'',''最后一次执行时间'',''最小执行时间(ms)]'',''最大执行时间(ms)'' UNION ALL SELECT CAST(dbid AS NVARCHAR(100)),dbname,CAST(ObjectId AS NVARCHAR(100)) ,ObjectName ,SelectStatement ,CAST(total_worker_time AS NVARCHAR(100)) , CAST(execution_count AS NVARCHAR(100)) ,CAST( avg_elasped_time AS NVARCHAR(100)) ,CAST( last_execution_time AS NVARCHAR(100)),CAST(min_worker_time AS NVARCHAR(100)) ,CAST( max_worker_time AS NVARCHAR(100)) FROM dba.dbo.bdd_temp_find_top_select_cpu" queryout\\10.0.9.177\software\top_select_cpu.txt-c -S"10.0.8.102\sqlinstance" -T'
- Error = [Microsoft][SQL Server Native Client 11.0]Unable to open BCP host data-file
- Error = [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has o
- OGG-01091 Unable to open file (error 89, Invalid file system control data detected)
- Microsoft SQL Server 2008 Native Client
- Unable to open the physical file "F:\DATA\TestDB.mdf"
- Unable to create/open lock file: /data/mongod.lock解决方法
- Error: unable to open database "BookStore.db": unable to open database file
- VS环境下 Ibatis .Net 连接sqlserver 2005 碰到的问题 Unable to open connection to "Microsoft SQL Server, provide
- Error: Unable to open class file R.java
- Android Error: Unable to open class file R.java
- Android Error: Unable to open class file R.java
- 转载 Android Error: Unable to open class file R.java
- Android Error: Unable to open class file R.java
- Error: Unable to open class file R.java
- Android Error: Unable to open class file R.java
- ERROR: Unable to open class file R.java
- link error Unable to open file 'dclusr50.lib'
- ORA-07391: sftopn: fopen error, unable to open text file
- (经典)Hibernate多对多关系映射(五)
- Secure Web services
- Linux内存管理图解【转】
- C#中连接SqlServer数据库并且使用事务和using语句的实例
- win7,64位系统连接c#的一系列错误。
- Error = [Microsoft][SQL Server Native Client 11.0]Unable to open BCP host data-file
- SQL SERVER2008 不能修改表的解决方法
- 【Cocos2d-x 018】 CCArray
- jquery easyui 操作总结
- 矩阵转置的快速转置
- Swing的设计是MVC的典范
- php 伪静态(url rewrite)apache配置!
- Ganglia 调试技巧
- 返回圆面积