C# .NET - creating sql db back from web application
Asked By SVK N on 19-Jun-12 10:54 PM
"BACKUP DATABASE db1 TO DISK='" + backfolder + "db1" + ".bak' WITH FORMAT
backfolder is the path given in webconfig
if i give unc path as \\servername\d\bkfolder\
i get error as cannot open backup device.
backup terminated
[)ia6l0 iii replied to SVK N on 20-Jun-12 10:10 PM
If you run this command in an ASP.Net web application, it runs under the context of the Identity of the application under the Application Pool. Change the application pool to run under a privileged account which has permissions to the UNC Share folder.
If you let the application pool run under the Network Service account, then provide the read/write permissions to the UNC share folder for the network service account.
Also note that the SQL Server service can run under a different set of account - local/network. This account needs to let SQL Server create backups on the UNC. This is valid in the case, you are not creating backups from ASP.Net web application.
This should resolve the issue.
Hope this helps.
Vikram Singh Saini replied to SVK N on 22-Jun-12 05:29 AM
As it is web application , so I would recommend you to use impersonation (for admin account which have right for taking backup) for the page from which you are trying to run the backup code.
For e.g. you have the code in Default.aspx.cs for backup. So for it impersonate in web.config as (within configuration tags):
<location path="Default.aspx" allowOverride="false">
<system.web>
<identity impersonate="true" userName="AdminUser" password="AdminPassword"/>
</system.web>
</location>
SVK N replied to Vikram Singh Saini on 23-Jul-12 03:25 AM
i got it done using the following sql stmt
BACKUP DATABASE db1 TO DISK='" + backfolder + "db1.bak' WITH FORMAT";
backfolder = frm webconfig
<add key="backup" value="d:\backup\" />
solveddddd
Vikram Singh Saini replied to SVK N on 23-Jul-12 03:53 AM
i want to create database backup on location whatever i choose. . . how to do that ??? hi, Taking backup of any specific database to your desired location is very easy using this simple SQL command backup database myDataBase to disk = 'd: \ myDbBackup.bak' Hope this will help you you can also take
i am create .net c# application for Database backup and restore i am able to backup and restore database backup from local sql server , and when i connect from remote sqlserver i get backup that time backup file will be store on remote system and it will restore from
I have to create an application which takes database backup of MySql database and generates its script file. Can anyone give me idea how to proceed? Rajesh Madhukar method is called to effectively "shell out" and run the mysqldump command to dump your database. What parameters you want to use is up to you, but you can have the the file in your GUI or timestamp it, or whatever you desire. keywords: SQL Server, backup, database, Database backup application, database backup, application description: Creating Database backup application I have to create
Hi, I am trying to backup a database from within a java program via JDBC. I want to be able to backup a database to a remote computer. BACKUP DATABASE cowboys_mng_580 TO disk = ' \ assist \ 5.1_SP1_Backups \ MSSQL \ RANS_MNG_HUMPTY_ORACLE_AWEB4.bak' doesn't work while BACKUP DATABASE
Hi, I want to take back up a database periodically. It should be automated like Schduleing. Can we write the script to run the backup process? Thanks Nagaraj http: / / www.eggheadcafe.com / PrintSearchContent.asp?LINKID = 259 keywords: SQL Server backup, database, backup database description: Qurey to backup database Hi, I want to take back up a database periodically
Hi, In my web application ( using C#.Net & SQLServer 2008), i have to get database backup from database using stored procedure and store it in my folder every day in a button click event. How can we do this. . Cheers, Samantha. hi, I have created procedure that will backup your database when you execute it USE AdventureWorks2008R2; GO BACKUP DATABASE AdventureWorks2008R2 TO DISK = 'Z: \ SQLServerBackups \ AdventureWorks2008R2.Bak' WITH FORMAT, MEDIANAME = 'Z_SQLServerBackups' , NAME = 'Full Backup
i want to give database backup option to my customer. . . could you plz tell me how to do that??? Make a Backup Copy - Now we want to make an exact copy of the data in our "table1 FROM table1 We can also use the IN clause to copy the table into another database: SELECT * INTO table1_Backup IN 'Backup.mdb' FROM table1 - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- you can just pass this sql statement in your form (Sqlcommand) thank you I would normally create a Schedule / Job for Database backup. You can refer http: / / support.microsoft.com / kb / 930615 in Microsoft support site. The
Hi hello i want to create job schedule for backup database in vb.net.(i.e) in web page i want to give date and time to take database backup.Note : not using sql agent, i want vb.net code Refer this link to Implement a Task for backup database http: / / support.microsoft.com / kb / 930615 No i want in codeing in vb.net like
Sir, How to schedule backup database in oracle 10g xe. ? plz solve my problem soon as possible. thn'x Hi, You do not need to take a backup at your base time. Just enable flashback database, create a guaranteed restore point, run your tests and flashback to the previously created restore mount mode. startup force mount; • Create the restore point. create restore point before_test guarantee flashback database; • Open the database. alter database open; • Run your tests. • Shutdown and mount the instance. shutdown
Hi, I want to take the database backup on a button click from asp.net front end. I'm using vs 2008 and do the same . thanks in advance Check this article - http: / / www.dotnetfunda.com / articles / article489-backup-and-restore-database-in-aspnet.aspx Below article gives you the complete instructions for Backup and restoring the sql server database using C#.net http: / / www.geekpedia.com / tutorial180_Backup-and-restore-SQL-databases.html and for