SQL Script for take backup of Database in sql server

No.of Views639
Bookmarked0 times
Downloads 
Votes0
By  youngmurukan   On  08 May 2010 23:05:20
Tag : Sql Servers , Database Administrator
In sql server there are 2 built-in stored procedures for drop the already existing backup device and create the new device in the user defined path.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

In sql server there are 2 built-in stored procedures for drop the already existing backup device and create the new device in the user defined path.
Before create the backup device, must drop the device. Because when you create a backup device, if backup device had already been created, sql server throw a error. So very first time have to create a backup device manually.Afterwards you can use this script. This is very use ful as user can take backup where user wants it since this procedure takes the path as parameter.

Create Backup device manually in Sql Server 2008

Go to Server Object where right click on Backup Device, Then choose New Backup Device. if you choose that, sql server let you to create the New Backup Device.
(Please refer the figures as shown below)

Figure 1: 

Image Loading

Figure 2: 

Image Loading

Figure 3: 

Image Loading

Figure 4: 

Image Loading

Figure 5: 

Image Loading

Script for Drop the Backup Device

EXEC sp_dropdevice 'Time_Attendance'

Script for Create the Backup Device

EXEC sp_addumpdevice 'disk', 'Time_Attendance', @Path

Script for initializes the backup with user specified name

BACKUP DATABASE Time_Attendance
TO Time_Attendance with name= @Name, INIT

Conclusion

In this article, i have to shared with  create database backup by sql script in sql server.

 
Sign Up to vote for this article
 
About Author
 
youngmurukan
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Not Provided
Joined date-12 May 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top