T-SQL 备份数据库命令用于带空格的文件路径?
如何编写T-SQL备份数据库命令来指定包含空格的文件? 这是我得到的:
BACKUP DATABASE AMDMetrics TO DISK = 'C:\Documents and Settings\daultrd\My Documents\DatabaseBackups\AMD_METRICS.DAT'
这是我得到的错误:
消息 3201,级别 16,状态 1,第 1 行 无法打开备份设备“C:\Documents and Settings\daultrd\My Documents\DatabaseBackups\AMD_METRICS.DAT”。操作系统错误3(系统找不到指定的路径。)。 消息 3013,16 级,状态 1,第 1 行 备份数据库异常终止。
How do I write a T-SQL backup database command to specify a file containing spaces?
Here is what I have:
BACKUP DATABASE AMDMetrics TO DISK = 'C:\Documents and Settings\daultrd\My Documents\DatabaseBackups\AMD_METRICS.DAT'
And this is the error I get:
Msg 3201, Level 16, State 1, Line 1
Cannot open backup device 'C:\Documents and Settings\daultrd\My Documents\DatabaseBackups\AMD_METRICS.DAT'. Operating system error 3(The system cannot find the path specified.).
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试共享您想要的目标文件夹并使用 UNC 路径从服务器备份到本地计算机。
Try sharing your intended destination folder and using a UNC path to backup from the server to your local machine.
这对我有用,你确定目录正确吗?
将其复制并粘贴到资源管理器中,看看是否可以到达 C:\Documents and Settings\daultrd\My Documents\DatabaseBackups
这当然必须是同一台计算机,否则您需要映射驱动器到该位置或使用 UNC 路径
This works for me, are you sure that the directory is correct?
copy and paste this into explorer and see if you can get there
C:\Documents and Settings\daultrd\My Documents\DatabaseBackups
This of course has to be the same machine, otherwise you need to map a drive to the location or use UNC paths
我也在解决这个问题。
可能是 SQL Server 运行的服务(默认为网络服务)没有指定文件夹的权限。
以上应该备份到默认备份文件夹
如果没有问题,那就是所指出的问题。
I was working through this issue as well.
It's possibly that the Service that SQL Server is running under (Network Service by Default) doesn't have permission to the folder specified.
The above should backup to the default backup folder
if that works with no problem it'll be the problem stated.