I am attempting to create a database snapshot with SQL Server 2008 R2 using the following T-SQL code.
我正在尝试使用以下T-SQL代码使用SQL Server 2008 R2创建数据库快照。
CREATE DATABASE SNAP_myDB_0900
ON
(NAME = myDB, FILENAME = 'C:\myDB_0900.SNAP')
AS SNAPSHOT OF myDB
I get the following error:
我收到以下错误:
The file 'myDB' does not exist in database 'myDB'
数据库'myDB'中不存在'myDB'文件
This code works with other databases in the same instance but not this one. I have double checked the file name and it is correct.
此代码适用于同一实例中的其他数据库,但不适用于此实例。我已经仔细检查了文件名,这是正确的。
Why am I getting this error?
为什么我收到此错误?
1 个解决方案
#1
5
Verify the database file name that you are trying to create the snapshot based off of:
根据以下内容验证您尝试创建快照的数据库文件名:
select name, physical_name
from myDB.sys.database_files;
The NAME
you give you snapshot file(s) needs to match the source database file name.
您为快照文件提供的NAME需要与源数据库文件名匹配。
In other words, if myDB
's data file has a name of datafile1
, then you will have to use ... NAME = 'datafile1' ...
when creating your snapshot.
换句话说,如果myDB的数据文件名为datafile1,那么在创建快照时必须使用... NAME ='datafile1'....
#1
5
Verify the database file name that you are trying to create the snapshot based off of:
根据以下内容验证您尝试创建快照的数据库文件名:
select name, physical_name
from myDB.sys.database_files;
The NAME
you give you snapshot file(s) needs to match the source database file name.
您为快照文件提供的NAME需要与源数据库文件名匹配。
In other words, if myDB
's data file has a name of datafile1
, then you will have to use ... NAME = 'datafile1' ...
when creating your snapshot.
换句话说,如果myDB的数据文件名为datafile1,那么在创建快照时必须使用... NAME ='datafile1'....