How to take MS SQL server DB backup on network mapped drive::
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'xp_cmdshell',1
GO
RECONFIGURE
GO
The syntax of this command is:
NULL
NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]
NULL
NET USE {devicename | *} [password | *] /HOME
NULL
NET USE [/PERSISTENT:{YES | NO}]
NULL
NULL
EXEC XP_CMDSHELL 'net use H: \\xx.xx.xx.xx\bkp\ /user:<domain>\<username> <password> '
EXEC XP_CMDSHELL 'Dir H:'
Now you can able to see H: drive in the backup window.
To Delete the Mapped Drive::
EXEC XP_CMDSHELL 'net use H: /delete'
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'xp_cmdshell',1
GO
RECONFIGURE
GO
The syntax of this command is:
NULL
NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]
NULL
NET USE {devicename | *} [password | *] /HOME
NULL
NET USE [/PERSISTENT:{YES | NO}]
NULL
NULL
EXEC XP_CMDSHELL 'net use H: \\xx.xx.xx.xx\bkp\ /user:<domain>\<username> <password> '
EXEC XP_CMDSHELL 'Dir H:'
Now you can able to see H: drive in the backup window.
To Delete the Mapped Drive::
EXEC XP_CMDSHELL 'net use H: /delete'
No comments:
Post a Comment