SQL Server: database on network share

。_饼干妹妹 提交于 2019-12-24 15:03:29

问题


I have a SQL Server installed on my PC (a terminal). I want to create a new database which its files (mdf & ldf) will be located on a network share.

From the files explorer I can easily see the share, but from the user interface of the SSMS - I don't.

Is it possible technically to do it? Is it possible to configure the instance to "see" remote drives?


回答1:


The reason for not being able to see network shares in SSMS is probably becuase of performance and reliability issues when placing database files on a network share. SSMS is trying to help you to avoid doing the wrong choice.

As you probably know remote storage in a database is typically attached/mounted as disks to the OS, e.g. SAN disks. And that is the typical way of storing data outside the restrictions of the local disks on the local machine.

There may of course be reasons for using a network share and I found this article which provides guideance on how to achieve this: http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx. The fix is to set trace flags which disable the check... It applies to SQL Server 2008 R2, if you are using SQL Server 2012 then let's hope that it still applies!




回答2:


Was looking for the exact same issue - now in the newer versions these are officially supported.

From SQL Server 2012, network shares are 'officially' supported for creating the database files

Source

Starting with SQL Server 2012, system databases (Master, Model, MSDB, and TempDB), and Database Engine user databases can be installed with Server Message Block (SMB) file server as a storage option.

So essentially, the data files could be in network shares.

Also, regarding the drives to be visible in SSMS, there following blog gives the details

Essentially, we need to do the following:

xp_cmdshell 'net use X: \\server name\share name'

Voila, the drive is now visible:



来源:https://stackoverflow.com/questions/12881455/sql-server-database-on-network-share

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!