Saturday, 16 February 2013

Backup a database to a network share

USE MASTER
GO
-- ADD A NEW BACKUP DEVICE
--                   TYPE       NAME            PHYSICAL LOCATION
EXEC SP_ADDUMPDEVICE 'disk','networkdrive','\\W2k8.CONTOSSO.COM\AdventureWorks\AdventureWorks2008R2.bak'
-- EXECUTE THE BACKUP OPERATION
BACKUP DATABASE AdventureWorks2008R2 TO networkdrive
 
-- DROP THE DEVICE
--                      NAME            , PHYSICAL FILE (OPTIONAL - IF PRESENT, THE FILE IS DELETED)
EXEC SP_DROPDEVICE 'networkdrive'

No comments:

Post a Comment