SQL - How to attach FileStream enabled db without log file
-
2012년 3월 5일 월요일 오후 5:57
I'm trying to attach a FileStream enabled database without a log file. My SQL looks something like this:
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
Does anyone know if it's possible to attach a FileStream enabled database without the original log file? Thanks!
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.
모든 응답
-
2012년 3월 5일 월요일 오후 6:44
Attachment of File stream DB is doable without Log
file like any DB to give a chance to
rebuild new Transaction log file since File stream groups are totally separated
groups rather than log file
However , it looks like here File stream files are irrelevant
to that DB that couldn’t be attached with that primary file.
Think more deeply of performance terms
- 편집됨 Shehap 2012년 3월 5일 월요일 오후 6:44
-
2012년 3월 5일 월요일 오후 7:18
Try this,
CREATE DATABASE MyDB
ON (FILENAME = '<drive>:\<file path>\MyDB.mdf')
FOR ATTACH_REBUILD_LOG ; -
2012년 3월 5일 월요일 오후 7:36I gave that a try, but, no luck. Same error.
-
2012년 3월 7일 수요일 오전 8:24중재자
Hi cgregory,
The error might occur if the database is not shutdown cleanly. In this case, log file is required, or, you will have some data lost. Please pay attention to this thread addressing this type of issue: attaching DB without .ldf file ???
For attach a database with FILESTREAM enabled, please refer to this article: How to Detach and Attach a SQL Server FILESTREAM Enabled Database.
Stephanie Lv
TechNet Community Support
- 답변으로 표시됨 Kalman TothMicrosoft Community Contributor, Moderator 2012년 3월 13일 화요일 오후 5:59
- 답변으로 표시 취소됨 cgregory 2012년 3월 13일 화요일 오후 6:17
-
2012년 3월 7일 수요일 오후 5:26
The database appears to be clean. I detached like this:
USE master
GO
ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE master
GO
EXEC master.dbo.sp_detach_db @dbname = N'MyDB'
GOThen try to attach like this:
USE master
GO
CREATE DATABASE FCD ON
( FILENAME = N'C:\MyDB.MDF' ),
FILEGROUP FileStreamGroup CONTAINS FILESTREAM DEFAULT
( NAME = N'MyFileGroup', FILENAME = N'C:\MyFileGroup' )
FOR ATTACH_REBUILD_LOG
GO -
2012년 3월 13일 화요일 오후 6:19I verified that the database was detached cleanly. Still no luck. Any other ideas?
-
2012년 3월 13일 화요일 오후 6:31
Can you try using sp_attach_db or sp_attach_single_file
http://msdn.microsoft.com/en-us/library/ms174385.aspx
-
2012년 3월 13일 화요일 오후 8:39
Hi sqlrockz,
No luck with sp_attach_db or sp_attach_single_file.
-
2012년 3월 19일 월요일 오후 1:34No luck so far.

