Labels

Monday, 25 April 2016

SQL Server backup commands


Full Backup :

 BACKUP DATABASE <DatabaseName> TO DISK = 'DriveName:\PathName\DatabaseName.bak'

Differential Backup :

BACKUP DATABASE <DatabaseName> TO DISK =  'DriveName:\PathName\DatabaseName.diff' WITH DIFFERENTIAL

Transaction Log Backup :

 BACKUP LOG <DatabaseName> TO DISK = 'DriveName:\PathName\DatabaseName.trn'

Partial Backup : Taking backup of specific file on a group from the available file groups is called as partial backup.


BACKUP DATABASE <DatabaseName> <FileGroupName> 
TO DISK = 'DriveName:\PathName\DatabaseName.bak'

BACKUP DATABASE AdventureWorks READ_WRITE_FILEGROUPS 
TO DISK = 'C:\TestBackup_Partial.bak'

File Backup :

BACKUP DATABASE TestBackup FILE = 'TestBackup' 
TO DISK = C:\TestBackup_TestBackup.fil'

File Group Backup :

BACKUP DATABASE TestBackup FILEGROUP = 'ReadOnly' 
TO DISK = 'C:\TestBackup_ReadOnly.flg'

No comments:

Post a Comment