SQL Server备份查询错误 [英] Error in Backup query of sql server

查看:73
本文介绍了SQL Server备份查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL Server中有一个数据库,我想从该数据库创建到共享文件夹的备份.

只有一个网络用户有权访问此文件夹.

我已经编写了代码以在程序中间登录该用户,然后执行Backup命令.

我想访问我的文件夹的所有代码都可以正常工作.但现在我收到此错误:

无法使用备份文件名打开备份设备的文件夹路径".操作系统错误5(由于该错误而无法检索文本,原因:1815),BACKUP DATABASE异常终止"

I have a database in SQL Server and I want to create backup from it to a shared folder.

just one of the network users has permissions to access to this folder.

I have written a code to log on this user at the middle of my program and then execute Backup command.

This code worked all ever I want to access to my folder. But now I receive this error:

"Cannot open backup device ''folder path with backup file name''.Operating system error5(failed to retrieve text for this error, Reason: 1815) BACKUP DATABASE is terminating abnormally"

推荐答案

问题是备份试图使用运行SQL Server的凭据访问网络文件夹.换句话说,备份是由SQL Server进行的,而不是由执行backup命令的用户进行的.

如果要将备份直接带到网络,则可以使用(创建一个新的)域帐户来使用SQL Server服务,并为该帐户赋予适当的特权.另一个选择是,将其放在本地,然后使用一些脚本将备份转移到网络共享.

讨论有关设置域帐户特权的一个示例文章: http://support.microsoft.com/kb/283811 [ ^ ]

如果上述内容已经正确,请检查备份设置和目标文件夹.例如,如果备份尝试写入新文件(而不覆盖旧文件),并且文件夹中存在一个具有相同名称的现有文件,则备份将失败.
The problem is that the backup is trying to access the network folder with the credentials under which SQL Server is running. In other words the backup is made by SQL Server, not by the user who executes the backup command.

You can use (create a new) domain account for SQL Server service and give proper privileges to that account if you want to take the backup directly to network. Another option is that you take it locally and then using some script transfer the backup to network share.

One example article dicussing setting the privileges for the domain account: http://support.microsoft.com/kb/283811[^]

If the thing mentioned above is already correct, check the backup settings and the target folder. For example if the backup tries to write a new file (without overwriting the old) and there''s an existing file with the same name in the folder, it would fail.


这篇关于SQL Server备份查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆