sql server database on UNC network drive trace flag 1807
Microsoft does not recommend using network drive or UNC path to create database, also SQL Server does not support this by default (creating a databases on network drive). You should be using locally attached drive or SAN (Storage area network) drives to create data and log files.
What is UNC or Network Drive
A network attached storage (NAS) system is a file based storage system that is used over the network using any network protocol. If access to a disk requires that a share be mapped, or if the disk resource appears through a UNC path, example: \\Servername\Sharename on the network, then it is a network attached storage or network drive.
Important Note : Before creating a database on network drive or on a local drive it is a good idea to download SQLIOSim utility from http://support.microsoft.com/kb/231619 . This will ensure that disk you are using is capable of running SQL Server and transactional database system.
How to enable trace flag 1807
You can enable trace flag 1807 using DBCC command which will tell SQL Server to bypass the checks when creating a database on network drive.
DBCC TraceOn(1807)
To disable the trace you can use Trace off
DBCC TraceOff(1807)
To create a database or attach a database file on UNC path, make sure your SQL Server is running under network account which have atleast read and write access to network path. If you are running SQL Server services as local account then you will receive Access is denied error.
DBCC TraceOn(1807)
GO
CREATE DATABASE DATABASE_NAME
ON
(NAME = DATABASE_DAT,
FILENAME = '\\ServerName\ShareName\database_dat.mdf' )
GO
DBCC TraceOff(1807)