[英]SQL - How to attach FileStream enabled db without log file
I'm trying to attach a FileStream enabled database without a log file.我正在尝试附加一个没有日志文件的启用 FileStream 的数据库。 My SQL looks something like this:
我的 SQL 看起来像这样:
USE master
CREATE DATABASE MyDB
ON PRIMARY(NAME = N'MyDB', FILENAME = 'C:\myDB.MDF' ),
FILEGROUP myFileGroup CONTAINS FILESTREAM ( NAME = myData, FILENAME = 'C:\myFileGroup')
For Attach
Here is the error I'm receiving:这是我收到的错误:
Msg 5173, Level 16, State 3, Line 2
消息 5173,16 级,State 3,第 2 行
One or more files do not match the primary file of the database.一个或多个文件与数据库的主文件不匹配。
If you are attempting to attach a database, retry the operation with the correct files.如果您尝试附加数据库,请使用正确的文件重试该操作。
If this is an existing database, the file may be corrupted and should be restored from a backup.如果这是现有数据库,则该文件可能已损坏,应从备份中恢复。
Does anyone know if it's possible to attach a FileStream enabled database without the original log file?有谁知道是否可以在没有原始日志文件的情况下附加启用 FileStream 的数据库?
I'm trying to attach a FileStream enabled database without a log file.我正在尝试附加没有日志文件的启用FileStream的数据库。 My SQL looks something like this:
我的SQL看起来像这样:
USE master
CREATE DATABASE MyDB
ON PRIMARY(NAME = N'MyDB', FILENAME = 'C:\myDB.MDF' ),
FILEGROUP myFileGroup CONTAINS FILESTREAM ( NAME = myData, FILENAME = 'C:\myFileGroup')
For Attach
Here is the error I'm receiving:这是我收到的错误:
Msg 5173, Level 16, State 3, Line 2
Msg 5173,第16级,状态3,第2行
One or more files do not match the primary file of the database.一个或多个文件与数据库的主文件不匹配。
If you are attempting to attach a database, retry the operation with the correct files.如果您尝试附加数据库,请使用正确的文件重试该操作。
If this is an existing database, the file may be corrupted and should be restored from a backup.如果这是现有数据库,则该文件可能已损坏,应该从备份中还原。
Does anyone know if it's possible to attach a FileStream enabled database without the original log file?有谁知道是否可以在没有原始日志文件的情况下附加启用FileStream的数据库?
I'm trying to attach a FileStream enabled database without a log file.我正在尝试在没有日志文件的情况下附加启用 FileStream 的数据库。 My SQL looks something like this:
我的 SQL 看起来像这样:
USE master
CREATE DATABASE MyDB
ON PRIMARY(NAME = N'MyDB', FILENAME = 'C:\myDB.MDF' ),
FILEGROUP myFileGroup CONTAINS FILESTREAM ( NAME = myData, FILENAME = 'C:\myFileGroup')
For Attach
Here is the error I'm receiving:这是我收到的错误:
Msg 5173, Level 16, State 3, Line 2
Msg 5173, Level 16, State 3, Line 2
One or more files do not match the primary file of the database.一个或多个文件与数据库的主文件不匹配。
If you are attempting to attach a database, retry the operation with the correct files.如果您正在尝试附加数据库,请使用正确的文件重试该操作。
If this is an existing database, the file may be corrupted and should be restored from a backup.如果这是现有数据库,则该文件可能已损坏,应从备份中恢复。
Does anyone know if it's possible to attach a FileStream enabled database without the original log file?有谁知道是否可以在没有原始日志文件的情况下附加启用 FileStream 的数据库?
Try this blog post:试试这篇博文:
http://blog.sqlauthority.com/2010/04/26/sql-server-attach-mdf-file-without-ldf-file-in-database/ http://blog.sqlauthority.com/2010/04/26/sql-server-attach-mdf-file-without-ldf-file-in-database/
I would personally go with this one:我个人会用这个 go:
CREATE DATABASE TestDb ON
(FILENAME = N'C:\Database\Test\TestDb.mdf')
FOR ATTACH_REBUILD_LOG
GO
And when you have your log rebuilt, you can enable filestream;当您重建日志时,您可以启用文件流; or try to reattach with the filestream location.
或尝试重新附加文件流位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.