简体   繁体   English

SQL - 如何在没有日志文件的情况下附加启用了 FileStream 的数据库

[英]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.

相关问题 SQL 2008 FILESTREAM-如何在更改数据库之前检查数据库是否已启用文件流 - SQL 2008 FILESTREAM - How to Check if DB Has Filestream Enabled Before Altering It SQL Server 2005-如何分离和附加数据库而不创建T日志文件? - SQL Server 2005— How can I detach & attach a DB and not create a T-Log File? 实体框架4和sql filestream从db读取文件 - Entity framework 4 and sql filestream to read a file from db 无法删除FileStream FileGroup或将其重新附加到SQL Server数据库 - Unable to remove or re-attach FileStream FileGroup to a SQL Server Database 如何在没有index.idx文件的情况下附加SQL Server 2008 R2中的数据库 - How to attach database in SQL Server 2008 R2 without index.idx file 使用VBScript将二进制文件上传到已启用文件流的表(来自cmd) - Uploading a binary file to a filestream enabled table using VBScript (from cmd) 如何将.sql 文件附加到我的 php 应用程序 - How to attach .sql file to my php application 如何通过installshield附加数据库? - How to attach DB by installshield? SQL Server 2008 - 附加没有日志的 mdf - 操作系统错误 5:5(访问被拒绝。) - SQL Server 2008 - Attach mdf without log - Operating system error 5: 5(Access is denied.) 如何使用 Powershell 启用 SQL 文件流 - How to enable SQL Filestream using Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM