[关闭]
@liuruicai 2017-07-20T15:48:09.000000Z 字数 878 阅读 572

Sql Server 使用网络数据库文件


参考:Description of support for network database files in SQL Server
Microsoft SQL Server: How to attach database from network drive?
Attach a remotely stored database

  1. CREATE DATABASE [DestinedForGreatness]
  2. ON PRIMARY
  3. ( NAME = N'DestinedForGreatness', FILENAME = N'\\LittleBlackBox\SQL2012data\MSSQL\Data\DestinedForGreatness.mdf' )
  4. LOG ON
  5. ( NAME = N'DestinedForGreatness_log', FILENAME = N'\\LittleBlackBox\SQL2012data\MSSQL\Data\DestinedForGreatness_log.ldf')
  6. GO
  1. Turn On Allow Attach from Network Drive (UNC)
  2. DBCC TraceOn(1807)
  3. Attach the database
  4. EXEC sp_attach_db @dbname = NDatabaseName’,
  5. @filename1 = N\\ServerName\SQL Data\DatabaseName_Data.MDF’,
  6. @filename2 = N\\ServerName\SQL Log\DatabaseName_Log.LDF
  7. Turn Off Allow Attach from Network Drive (UNC)
  8. DBCC TraceOff(1807)
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注