473,761 Members | 5,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL backup procedure from ASP.NET

Ed


I have a MS SQL database process that is run from ASP.NET.
I would like to be able to backup the SQL database using either
a full database or transaction log backup immediately before the
backup is done. Is this possible with ASP.NET and
what kind of permissions or role would the connection SQL connection account
need to perfom the backup. I would like to give the account the minimum
permissions needed.

--
Ed
Nov 19 '05 #1
4 1978
You can backup a database by sending T-SQL commands [1], i.e:

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1', 'c:\Program Files\Microsoft
SQL Server\MSSQL\BA CKUP\MyNwind_1. dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1

You could execute the above with a SqlConnection and a ExecuteNonQuery
on SqlCommand.

Once the devices are setup, a login need only be in the
db_backupoperat or role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevic e.
[1]
http://msdn.microsoft.com/library/de...ba-bz_35ww.asp
HTH,
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 21 Jul 2005 14:02:03 -0700, "Ed"
<Ed@discussions .microsoft.com> wrote:


I have a MS SQL database process that is run from ASP.NET.
I would like to be able to backup the SQL database using either
a full database or transaction log backup immediately before the
backup is done. Is this possible with ASP.NET and
what kind of permissions or role would the connection SQL connection account
need to perfom the backup. I would like to give the account the minimum
permissions needed.


Nov 19 '05 #2
Ed
Scott -

Thank you for your reply.
--
Ed
"Scott Allen" wrote:
You can backup a database by sending T-SQL commands [1], i.e:

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1', 'c:\Program Files\Microsoft
SQL Server\MSSQL\BA CKUP\MyNwind_1. dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1

You could execute the above with a SqlConnection and a ExecuteNonQuery
on SqlCommand.

Once the devices are setup, a login need only be in the
db_backupoperat or role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevic e.
[1]
http://msdn.microsoft.com/library/de...ba-bz_35ww.asp
HTH,
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 21 Jul 2005 14:02:03 -0700, "Ed"
<Ed@discussions .microsoft.com> wrote:


I have a MS SQL database process that is run from ASP.NET.
I would like to be able to backup the SQL database using either
a full database or transaction log backup immediately before the
backup is done. Is this possible with ASP.NET and
what kind of permissions or role would the connection SQL connection account
need to perfom the backup. I would like to give the account the minimum
permissions needed.


Nov 19 '05 #3
Ed
Scott -

Thank you for your reply.
--
Ed
"Scott Allen" wrote:
You can backup a database by sending T-SQL commands [1], i.e:

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1', 'c:\Program Files\Microsoft
SQL Server\MSSQL\BA CKUP\MyNwind_1. dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1

You could execute the above with a SqlConnection and a ExecuteNonQuery
on SqlCommand.

Once the devices are setup, a login need only be in the
db_backupoperat or role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevic e.
[1]
http://msdn.microsoft.com/library/de...ba-bz_35ww.asp
HTH,
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 21 Jul 2005 14:02:03 -0700, "Ed"
<Ed@discussions .microsoft.com> wrote:


I have a MS SQL database process that is run from ASP.NET.
I would like to be able to backup the SQL database using either
a full database or transaction log backup immediately before the
backup is done. Is this possible with ASP.NET and
what kind of permissions or role would the connection SQL connection account
need to perfom the backup. I would like to give the account the minimum
permissions needed.


Nov 19 '05 #4
Ed
Scott -

I have one more question. If I want to add dump devices (files) but not have
them appear in Enterprise Manager, is there any way to do that.

Thanks,

- Ed B.

--
Ed
"Scott Allen" wrote:
You can backup a database by sending T-SQL commands [1], i.e:

-- Create a logical backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_1', 'c:\Program Files\Microsoft
SQL Server\MSSQL\BA CKUP\MyNwind_1. dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_1

You could execute the above with a SqlConnection and a ExecuteNonQuery
on SqlCommand.

Once the devices are setup, a login need only be in the
db_backupoperat or role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevic e.
[1]
http://msdn.microsoft.com/library/de...ba-bz_35ww.asp
HTH,
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 21 Jul 2005 14:02:03 -0700, "Ed"
<Ed@discussions .microsoft.com> wrote:


I have a MS SQL database process that is run from ASP.NET.
I would like to be able to backup the SQL database using either
a full database or transaction log backup immediately before the
backup is done. Is this possible with ASP.NET and
what kind of permissions or role would the connection SQL connection account
need to perfom the backup. I would like to give the account the minimum
permissions needed.


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
16231
by: Andrew E | last post by:
I just took over DBA responsibilities for an Oracle 8i database running on Linux. Although I've been working with relational databases for some time, I'm a bit green on Oracle so forgive me. My first task was to implement a backup strategy (currently there is none). I did a great deal of research both on this board and using the Oracle Press 8i handbook. I made a cold backup (with oracle shutdown) and sucessfully moved it from my...
0
1965
by: Mirko Slavko | last post by:
Hi, I have scheduled backup job on MS SQL server which appends full backup, verifies it and then it should eject tape. But upon finishing it says that job failed. I checked backup and it seems okay, database was backup-ed on tape and tape was ejected at the end of execution but job status was failed. Here is a code of backup procedure created with "backup database" option.
2
2301
by: m3ckon | last post by:
Hi, I want to schedule a backup of three databases on a daily basis. I've written the code to run the 3 backups in TSQL and was wondering how best to automate this procedure? Should I put the code in an sproc and then schedule running that command in the DTS or should I just add the TSQL into a DTS command?? Or is there a better way of doing this???
3
10583
by: bryja_klaudiusz[at]poczta[dot]fm | last post by:
Hi, How to automate database backup (MSDE server v8.0)? Is some free tool which can help on this or can I use some stored procedure? Plan: Complete - 1 per week Differential - 1 per day -- *Best regards,* Klaudiusz Bryja
2
1758
by: anton.aleksandrov | last post by:
Hello, First of all - sorry for may be stupid question, but as I am not a Win* administrator and my field is *nix, I am a little bit stuck with a problem, presented to me by one of the customers. He has few windows boxes with some webfile and (most important) - mssql database. And he asks for a backup. I found some company, which offers us IBM's Tivoli software, but my opinion is that they want a little bit too much for it and also, from...
5
2417
by: shenanwei | last post by:
I have a primary server and backup server located in different physical sites. The primary server is live and ship logs to backup site every 5 minutes. The primary server is being full online backed up every sunday locally. Those logs are being applied to backup server every five minutes. For example, Primary site has power outage on tuesday, the last log was shipped was S0001000.LOG. Backup server was brought to live, the first active...
4
2260
by: Mark | last post by:
Good morning. I recently made some changes to my Access project, and I introduced some problems that I could not resolve. So I deleted the forms that I had altered and saved the project. Then I opened my backup copy of the project, and exported the affected forms to the working copy. Now when I invoke any event procedures in the affected forms, I receive the following error (this example is for a click event):
2
21132
by: m19peters | last post by:
We have a script that I had to rework a little bit for 2005 that does a full backup for every database on the server... For some reason on some nights the script does not backup all databases... Its like it skips over it for some reason... Output of the script below on the night in question was: Executed as user: NT AUTHORITY\SYSTEM. master (Message 0) Status is ONLINE dbname / dbdevice = master / SQLBUmaster (Message 0) Processed...
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.