查询备份文件系统中其他位置的数据库 [英] query for backup a database at another location in file system
问题描述
BACKUP DATABASE <myDataBaseName> TO DISK = 'C:\PathtoBackup\FileName.bak'
此查询适用于在SQLServer Express Edition的gui中创建的数据库
this query is worked for a database which is created in the gui of SQLServer express edition
我已使用SQlServer Mgmt Studio中的GUI将物理上位于D驱动器(D:\ testing.mdf)的数据库附加到SQLServer.附加后,SSMS在对象中将数据库名称显示为"D:\ testing.mdf"资源管理器而不是测试.
SELECT DB_NAME() AS DatabaseName
.
I have attached my database which is physically at D drive(D:\testing.mdf) to SQLServer using GUI in SQlServer Mgmt Studio.After attaching, SSMS displays the database name as "D:\testing.mdf" in Object explorer rather than testing.
SELECT DB_NAME() AS DatabaseName
.
此查询的结果与"D:\ testing.mdf"相同
This query results the same that "D:\testing.mdf"
上述BACKUP查询在以后无法使用
The above mentioned BACKUP query is not worked for later
BACKUP DATABASE testing TO DISK = 'C:\PathtoBackup\testing.bak'
已显示以下错误
Msg 911, Level 16, State 11, Line 1
Could not locate entry in sysdatabases for database 'testing'. No entry found with that name. Make sure that the name is entered correctly.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally
我已经尝试过了
BACKUP DATABASE D:\testing.mdf TO DISK = 'C:\PathtoBackup\testing.bak'
已显示以下错误
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'D'.
如何备份文件系统中不同位置的文件
What should I do to backup that file which is at different location in filesystem
推荐答案
谢谢@ u07ch
我明白了.最后,你的提示得到了想要的结果.
I got it.Finally I got the desired result by your tip.
BACKUP DATABASE [D:\testing.mdf] TO disk = 'C:\PathToBackup\BackupFileName.bak'
备份文件已成功创建.
这篇关于查询备份文件系统中其他位置的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!