SQL Server 2008 Filestream:使用文件流创建数据库时出错

发布于 2024-10-20 07:02:53 字数 1363 浏览 4 评论 0原文

我正在进行练习:如何分离和附加启用 SQL Server FILESTREAM 的数据库

创建启用 FILESTREAM 的数据库步骤中,我执行以下代码

Use Master
GO
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'FileStreamDB')
DROP DATABASE FileStreamDB
GO
USE master
GO
CREATE DATABASE [FileStreamDB] ON PRIMARY 
( NAME = N'FileStreamDB', FILENAME = N'D:\FileStreamDB\FileStreamDB.mdf', 
SIZE = 10MB , MAXSIZE = UNLIMITED, FILEGROWTH = 10% )
LOG ON 
( NAME = N'FileStreamDB_log', FILENAME = N'D:\FileStreamDB\FileStreamDB_log.ldf' , 
SIZE = 10MB , MAXSIZE = UNLIMITED , FILEGROWTH = 10%)
GO
ALTER DATABASE [FileStreamDB] 
ADD FILEGROUP [FileStreamGroup] CONTAINS FILESTREAM 
GO

一切正常,直到我运行最后一步:

ALTER DATABASE [FileStreamDB] 
ADD FILE (NAME = N'FileStreamDB_FSData', FILENAME = N'D:\FileStreamDB\FileStreamData')
TO FILEGROUP FileStreamGroup
GO

执行此代码时,我收到以下错误

消息 5120,第 16 级,状态 106,第 1 行 无法打开物理文件“D:\FileStreamDB\FileStreamData”。 操作系统错误-2147024891: “0x80070005(检索文本失败 对于这个错误。原因:1815)”。

我在 Windows XP Professional 上运行 SQL Server 2008 Enterprise(评估许可证)。文件流按照 微软说明

导致该错误的原因是什么?

I am going through an exercise: How to Detach and Attach a SQL Server FILESTREAM Enabled Database

In the step Creating a FILESTREAM Enabled Database I execute the following code

Use Master
GO
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'FileStreamDB')
DROP DATABASE FileStreamDB
GO
USE master
GO
CREATE DATABASE [FileStreamDB] ON PRIMARY 
( NAME = N'FileStreamDB', FILENAME = N'D:\FileStreamDB\FileStreamDB.mdf', 
SIZE = 10MB , MAXSIZE = UNLIMITED, FILEGROWTH = 10% )
LOG ON 
( NAME = N'FileStreamDB_log', FILENAME = N'D:\FileStreamDB\FileStreamDB_log.ldf' , 
SIZE = 10MB , MAXSIZE = UNLIMITED , FILEGROWTH = 10%)
GO
ALTER DATABASE [FileStreamDB] 
ADD FILEGROUP [FileStreamGroup] CONTAINS FILESTREAM 
GO

It all works fine until I run the last step:

ALTER DATABASE [FileStreamDB] 
ADD FILE (NAME = N'FileStreamDB_FSData', FILENAME = N'D:\FileStreamDB\FileStreamData')
TO FILEGROUP FileStreamGroup
GO

When this code is execute I am getting the following error:

Msg 5120, Level 16, State 106, Line 1
Unable to open the physical file "D:\FileStreamDB\FileStreamData".
Operating system error -2147024891:
"0x80070005(failed to retrieve text
for this error. Reason: 1815)".

I run SQL Server 2008 Enterprise (Evaluation Licence) on Windows XP Professional. The filestream is configured as per microsoft instructions

What can be the cause of that error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

最近可好 2024-10-27 07:02:54

这可能是权限问题。您需要向 SQL Server 服务帐户授予对 D:\FileStreamDB 的显式权限。

It's probably a question of permissions. You need to grant the SQL Server Service Account explicit permissions on D:\FileStreamDB.

情绪操控生活 2024-10-27 07:02:54

您正在使用Windows XP。如果您还使用网络服务本地系统作为 SQL Server 帐户,则可能会遇到此错误:

http://connect.microsoft.com/SQLServer/feedback/details/435855/operating -system-error-2147024891-0x80070005-access-is-denied

最简单的修复方法是使用另一个 SQL Server 帐户。第二个选项是下载链接中提到的 XP 修补程序。我不喜欢它;该修补程序来自 2010 年,看起来没有维护并集成到较新的 XP 补丁中。至少我的 XP 系统的补丁是最新的,但我仍然遇到问题。

我刚刚浪费了三个小时寻找问题的根源,然后才找到确认这是 Windows XP 中的错误的链接。更改 SQL Server 帐户后,现在它立即可以工作了。

You are using Windows XP. If you are also using Network Service or Local System as SQL Server account, you could suffer from this bug:

http://connect.microsoft.com/SQLServer/feedback/details/435855/operating-system-error-2147024891-0x80070005-access-is-denied

The easiest fix is to use another account for SQL Server. The second option is to download the XP hotfix mentioned in the link. I don't like it; the hotfix is from 2010 and doesn't look maintained and integrated into newer XP patches. At least my XP system is up-to-date regarding patches and I still had the problem.

I've just wasted three hours looking for the source of the problem before I found the link that confirms that it's a bug in Windows XP. After changing the SQL Server account now it worked at once.

抚你发端 2024-10-27 07:02:54

在 MS SQL 2014 上遇到同样的错误。检查 ACL 3 次。
问题是我通过 NTFS 中的链接文件夹功能使用了文件流文件夹的路径。
根植于真实硬盘的真实物理路径,字母就像一个魅力。

即使通过链接的文件夹,其他数据库文件类型的 PS 文件路径也能正常工作。

Got the same error on MS SQL 2014. Checked ACL three times.
Problem was that I used the path for filestream folder via linked folders feature in NTFS.
With real phisical path rooted from the real HDD letter worked like a charm.

P.S. Filepathes for the other database filetypes are working correct even via the linked folders.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文