473,407 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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 1966
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\BACKUP\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_backupoperator role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevice.
[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\BACKUP\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_backupoperator role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevice.
[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\BACKUP\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_backupoperator role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevice.
[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\BACKUP\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_backupoperator role to use BACKUP. The diskadmin role is needed for
sp_adddumpdevice.
[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
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...
0
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...
2
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...
3
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 --...
2
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....
5
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...
4
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...
2
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......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.