Backup and Restore

Copy only backup and restore.

BACKUP DATABASE [Draft]

TO DISK = N'D:\Draft.bak'

WITH NOFORMAT -- Do not format the device, it can cause the whole media be formatted

,COPY_ONLY

,INIT -- Overwrite existing backup intead of appending

,NAME = N'Draft-Full Database Backup'

,SKIP -- Dont check backup expiration date and prevent overwriting

,NOREWIND -- for tape device only. Ignored on non-tape device

,NOUNLOAD -- for tape device only. Ignored on non-tape device

,STATS = 10 -- show progress by every 10%

GO

RESTORE DATABASE [Draft]

FROM DISK = N'D:\Draft.bak' -- The backup device

WITH FILE = 1 -- The first file set in the device

,MOVE N'Draft' TO N'D:\SQL_Data\Draft.mdf'

,MOVE N'Draft_log' TO N'D:\SQL_Data\Draft.ldf'

,NOUNLOAD

,REPLACE

,STATS = 10

Go