Backup
On the query analyzer, make the database in use by selecting it on the drop down menu or by executing the code:
Use Northwind
Now we will create our logical backup device. Make sure the path exists when you execute this. If you execute this without errors it means that you are doing right.
EXEC sp_addumpdevice 'disk', 'NWINDBackup', 'c:\NorthwindSystems\Backup\NWind_backup.bak' --NWINDBackup will be the name of our logical backup drive
After successful execution, you cannot run this code again since it already exists1
Then we will now backup our database with the following code:
As I said(or typed :o)) earlier, you should make sure that the path you created exists2.
BACKUP DATABASE Northwind TO NWINDBackup
Restore
Now we will restore are database based on the backup file we have created.
RESTORE DATABASE Northwind FROM NWINDBackupThe syntax follows as:
RESTORE DATABASE [your db name] FROM [logical drive]
Notes:
1"Honestly, I haven't figured out yet how to alter that logical backup thing but please stay tuned for updates. You can also post some suggestions for this"-jereme
2. Tip: Or at least tell your front end application to create folders if it does not exist.
Totoo ba yan? hehe! Nice one! Thanks for this useful post. ^^,
ReplyDelete