MSSQL. Restore from network share



Map network drive/path, hosting file, under SAME user as MS-SQL Server.
Use xp_cmdshell extended stored procedure to map network drive from inside of MS SQL




-- allow changes to advanced options
EXEC sp_configure 'show advanced options', 1
GO

-- Update currently configured values for advanced options.
RECONFIGURE
GO

-- To enable xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
GO

-- Update currently configured values for advanced options.
RECONFIGURE
GO

EXEC xp_cmdshell 'NET USE Z: \\Srv\Path password1 /USER:Domain\UserName'
Afterwards drive Z: will be visible in Server Managment studio, or just


RESTORE DATABASE DataBaseNameHere FROM DISK = 'Z:\BackNameHere.BAK'
GO