Click here to Skip to main content
Click here to Skip to main content

Backup and Restore SQL Server database

By , 22 Nov 2011
 
Say, we have a database named "Employee" in SQL Server. Now we want to backup the database and then restore the backup database file.
 
Execute the following SQL to backup Employee to Disk:
Backup Database Employee to Disk='D\DatabaseBack\emp_backup.bak'
 
After successfully backup, if we want to restore the backup(.bak) file, we have to execute the following SQL:
 
Restore Database Employee From Disk='D\DatabaseBack\emp_backup.bak' 
 
Differential backups only backup the data pages that have changed since the last full backup. Following is the SQL backup command to perform a differential backup:
 
BACKUP DATABASE Employee
TO DISK = ‘C:\DatabaseBack\Employee .bak’
WITH DIFFERENTIAL

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ahmed Naqibul Arefin
Software Developer
Bangladesh Bangladesh
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralCannot open backup device 'C:\Program Files\Microsoft SQL Se...memberSunil Mane 00722 Nov '11 - 22:40 
Cannot open backup device 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008\MSSQL\Backup\D\emp_backup.bak'. Operating system error 3(The system cannot find the path specified.).
 
I have get the following error web try to get the backup
GeneralRe: hi Sunil, this is very common problem of operation system se... PinmemberAhmed Naqibul Arefin23 Nov '11 - 5:31 
hi Sunil, this is very common problem of operation system security issue (Windows 7). In that case, we have to back up at a different location except C:(operation system installed drive). I think, your problem will be solved.
GeneralRe: Try d:\emp_backup.bak I'm guessing the ...\Backup\D folder d... PinmemberMember 831111628 Nov '11 - 17:56 
Try d:\emp_backup.bak
I'm guessing the ...\Backup\D folder does not exist.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 22 Nov 2011
Article Copyright 2011 by Ahmed Naqibul Arefin
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid