SQLServer使用NAS SMB檔案卷的步驟如下:
- 在SQLServerManagementStudio上建立查詢,輸入如下,啟用xp_cmdshell。
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
- 建立映射盤。
exec master..xp_cmdshell 'net use z: \xxx.xxx.nas.aliyuncs.com\myshare'
- 建立完成後,驗證映射盤建立完成。
exec master..xp_cmdshell 'net use'
- 關閉xp_cmdshell指令
EXEC sp_configure 'xp_cmdshell', 0;
注意:Windows Server 2019可以在Powershell ISE使用
New-SmbGlobalMapping -LocalPath z: -RemotePath \file-system-id.region.nas.aliyuncs.com\myshare -Persistent $true
建立全局挂載。執行指令如需輸入身份,請您輸入工作域任何一個合法身份即可。例如workgroup\administrator。
這樣SQLServerManagementStudio可以直接看到。
另外注意:Windows NTFS檔案系統本身不支援超過8PB的卷,而我們容量型有10PB,SQLServer會出現挂載錯誤。建議使用者用1PB标稱的NAS SMB性能卷,才能被SQLServer挂載和識别。