sql-server - 在 Synology NAS 服务器上使用数据和日志文件创建 SQL Server 数据库

标签 sql-server synology

我需要为应用程序创建一个新数据库。我计划将数据文件放在NAS服务器(Synology 812)上。我尝试使用不同的路径创建数据库两天,但没有任何效果。在底部您可以看到示例路径 N'\\10.1.1.5\fileserver\...

我也尝试过'N\\10.1.1.5\**volume1\fileserver**\payroll.ldf'因为 Synology 管理界面属性对话框显示了文件服务器共享目录的路径。

fileserver是一个共享文件夹。我可以从文件资源管理器访问该文件夹。

\\10.1.1.5\fileserver\

我可以使用 Windows 资源管理器在其中创建新文件或文件夹。但不幸的是 create 语句不起作用。

    CREATE DATABASE Payroll
    ON
    ( NAME = Payroll_dat,
       FILENAME = N'\\10.1.1.5\fileserver\payrolldat.mdf',
       SIZE = 20MB,
       MAXSIZE = 70MB,
       FILEGROWTH = 5MB )
    LOG ON
    ( NAME = 'Payroll_log',
       FILENAME = N'\\10.1.1.5\fileserver\payroll.ldf',
       SIZE = 10MB,
       MAXSIZE = 40MB,
       FILEGROWTH = 5MB )
    GO

如果有人能解决我的问题,我会非常高兴。

感谢您的宝贵时间。

费尔达

最佳答案

默认情况下,SQL Server 不支持 UNC 路径。请参阅知识库 http://support.microsoft.com/kb/304261 - SQL Server 中网络数据库文件支持的说明

摘录:

Microsoft generally recommends that you use a Storage Area Network (SAN) or locally attached disk for the storage of your Microsoft SQL Server database files because this configuration optimizes SQL Server performance and reliability. By default, use of network database files (stored on a networked server or Network Attached Storage [NAS]) is not enabled for SQL Server.

它可以启用,但您必须确保您的硬件满足一些严格的条件:

However, you can configure SQL Server to store a database on a networked server or NAS storage server. Servers used for this purpose must meet SQL Server requirements for data write ordering and write-through guarantees, which are detailed in the "More Information" section.

[...]

Any failure by any software or hardware component to honor this protocol can result in a partial or total data loss or corruption in the event of a system failure.

[...]

Microsoft does not support SQL Server networked database files on NAS or networked storage servers that do not meet these write-through and write-order requirements.

性能也会受到严重影响:

In its simplest form, an NAS solution uses a standard network redirector software stack, standard network interface card (NIC), and standard Ethernet components. The drawback of this configuration is that all file I/O is processed through the network stack and is subject to the bandwidth limitations of the network itself. This can create performance and data reliability problems, especially in programs that require extremely high levels of file I/O, such as SQL Server. In some NAS configurations tested by Microsoft, the I/O throughput was approximately one-third (1/3) that of a direct attached storage solution on the same server. In this same configuration, the CPU cost to complete an I/O through the NAS device was approximately twice that of a local I/O.

总而言之,如果您不能保证您的硬件支持这些要求,那么您就是在玩火。它可能适用于小型测试环境,但我不会像这样托管实时数据库,以免数据损坏或性能严重受损。

要启用,请使用知识库中所述的跟踪标志 1807。

关于sql-server - 在 Synology NAS 服务器上使用数据和日志文件创建 SQL Server 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16516515/

相关文章:

mysql - 在 Synology DS218play 上,WordPress 无法连接到用户数据库,但 phpmyadmin 可以

SQL 'stuff' 和 'FOR XML PATH' 生成奇怪的符号

sql - 如何识别特定时间范围内发生的行?

python 从 Synology FileStation API 下载文件

mysql - 容器 WordPress 关闭且没有错误消息(Docker、Bitnami、MySQL)

linux - 如果测试 - 检查超过 7 天的文件 - Unix

synology - 如何在 Synology 上使用命令行?

c# - 如何将 GUID 值传递到 SqlCommand 对象 SQL INSERT 语句中?

sql-server - SSIS 中的 Azure Blob 目标

sql-server - Visual Studio 2013与MS SQL Server 2014不兼容