Question

I need to create a new database for an application. I planned to put the data files on NAS server (Synology 812). I tried to create the database using different paths for 2 days but nothing worked. At the bottom you can see an example path N'\\10.1.1.5\fileserver\...

I also tried 'N\\10.1.1.5\**volume1\fileserver**\payroll.ldf' because from synology admin interface properties dialog shows this path for fileserver shared directory.

fileserver is a shared folder. I can reach that folder from file explorer.

\\10.1.1.5\fileserver\

And I can create new file or folders inside it using windows explorer. But unluckily the create statement does not work.

    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

I will be very happy if someone has a solution for my problem.

Thank you for your time.

Ferda

Was it helpful?

Solution

SQL Server doesn't support UNC paths by default. See the KB at http://support.microsoft.com/kb/304261 - Description of support for network database files in SQL Server.

Extracts:

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.

It can be enabled, but you must ensure your hardware meets some strict conditions:

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.

Performance can also be heavily compromised:

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.

So in summary, if you can't gurantee that your hardware supports these requirements, you're playing with fire. It might work for a small test environment, but I'd not host a Live database like this lest data gets corrupted or performance severely suffers.

To enable, use trace flag 1807 as decribed in the KB.

OTHER TIPS

You need SQL Server 2008R2 or later. Starting with 2008R2 the UNC names are supported, although not encouraged (for all the reasons Chris mentions). An SMB 3.0 capable environment goes a long way into solving most of UNC storage problems. Prior to 2008R2 the trace flag 1807 would work, but was not a supported deployment (CSS could refuse to help you if you asked for help on any issue). See SQL Server Can Run Databases from Network Shares & NAS.

I think the best thing you can do is configure a ISCSI volume in your nas device creating a RAID 5 if you have 3 or more available disk, after that you should connect your NAS and your server in an independient VLAN connected to a different network device or even in a diferent phisical network to avoid impact on your LAN due to operations traffic, in this way you will be using your NAS as a SAN

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top