Saturday, 30 March 2013

Backup on network Drive with Map Drive


STEP 1:-
-- First Execute this command ---
Exec master.dbo.sp_configure 'show advanced option',1
reconfigure
Exec Master.dbo.SP_configure 'XP_cmdshell',1
reconfigure
--OutPut Like This
--Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
--Configuration option 'xp_cmdshell' changed from 1 to 1. Run the RECONFIGURE statement to install.

-----------------------------BIND DRIVE WITH SYSTEM------------------------------------------------------------------------
STEP 2:-
Exec XP_CMDSHELL 'net use z: \\satan\BACKUP HPDC2011@ /user:satan\ashish'
----outPut Should be like this
--The command completed successfully.
--NULL
--NULL
----------------------VARIFY DRIVE INFO------------------------
STEP 3:-

Exec XP_cmdshell 'dir z:'

--OutPut Like This
-- Volume in drive Z has no label.
-- Volume Serial Number is B481-00AF
--NULL
-- Directory of Z:\
--NULL
--03/29/2013  04:43 AM    <DIR>          .
--03/29/2013  04:43 AM    <DIR>          ..
--03/29/2013  04:43 AM         3,165,696 m.bak
--               1 File(s)      3,165,696 bytes
--               2 Dir(s)  14,739,963,904 bytes free
--NULL

--Exec XP_CMDSHELL 'net use y: \\satan\myfile HPDC2011@ /user:satan\ashish'
---------------------Run BackUp Command--------------
STEP 4:-

Backup database master to disk='\\satan\BACKUP\master.bak'

---Processed 376 pages for database 'master', file 'master' on file 2.
--Processed 3 pages for database 'master', file 'mastlog' on file 2.
--BACKUP DATABASE successfully processed 379 pages in 2.448 seconds (1.206 MB/sec).




No comments:

Post a Comment