尝试使用 sqlcmd 从大型 .sql 文件恢复数据库 - 错误

发布于 2024-07-26 18:06:51 字数 247 浏览 6 评论 0原文

我尝试使用以下命令从大型 .sql 文件恢复数据库数据时

Type myfile.sql | sqlsmd –S server –U username –P password

出现以下错误:

Sqlcmd: Error: Scripting error.

我无法打开该文件,内存不足。

I am trying to restore database data using the following command from a large .sql file

Type myfile.sql | sqlsmd –S server –U username –P password

I get the following error:

Sqlcmd: Error: Scripting error.

I am unable to open the file, there is not enough memory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

对岸观火 2024-08-02 18:06:51

SQLCMD 还有一个“-i”输入文件参数 - 我建议使用它。 “键入”文件并将输出传输到 SQLCMD 是一种运行文件的黑客方式,尤其是当命令行包含对从文件读取的本机支持时。 尝试这个:

sqlcmd –S server –U username –P password -i MyFile.sql

SQLCMD has a "-i" inputfile parameter as well - I'd recommend using that. "Type"-ing the file and piping your output into SQLCMD is a hackish way to run the file, especially when the command line includes native support for reading from a file. Try this:

sqlcmd –S server –U username –P password -i MyFile.sql
℡寂寞咖啡 2024-08-02 18:06:51

您可以尝试使用 isql ,它有 -我输入文件选项 - 这失去了令人讨厌的

Type myfile.sql |

你没有说你正在使用哪个版本的 Sql,但你可能可以使用 DTS/SSIS 运行你的文件,如果你采用这种方法,你将能够打开记录并实际查看哪些行失败,并为可接受的失败行数设置阈值。

另一种方法是使用management studio打开文件然后执行它。

you could try using isql which has a -i input file option - that loses the nasty

Type myfile.sql |

You don't say which version of Sql you're using, but you could probably run your file in using DTS/SSIS, if you go with that approach you'll be able to turn on logging and actually see which line(s) fail, and set a threshold for an acceptable number of failing lines.

Another way is to use management studio to open the file and then execute it.

画骨成沙 2024-08-02 18:06:51

尝试这个

@echo Server:   %1
@echo Database: %2
@echo User: %3
@echo Password:   %4


set ISQLCMD=SQLCMD -S %1 -d %2 -U %3 -P %4 -m1 -i 

Try this

@echo Server:   %1
@echo Database: %2
@echo User: %3
@echo Password:   %4


set ISQLCMD=SQLCMD -S %1 -d %2 -U %3 -P %4 -m1 -i 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文