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.
[)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">
<identity impersonate="true" userName="AdminUser" password="AdminPassword"/>
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\" />
Vikram Singh Saini replied to SVK N on 23-Jul-12 03:53 AM
Question of backup database SQL Server
In SQL Server 2005 there is a new options called NO_LOG in backup database statement which is used to take the database backup without transaction log. I used the NO_LOG option to take the database backup and backup completed with the following message. backup database FileDB to disk = 'c: \ temp \ dbbackup
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
Unable to open Database Access Backup Database DataBase
Hi, I am using MS Access 2003 for storing some of my data. I am also creating the backup of the database on the daily basis. Yesterday I encountered some issue for which I need to open the Backup Database. But When I tried to ope the database I got the following error : database at
Differential backup with no full backup? SQL Server
When you perform a differential backup and a full backup doesn't exist you get this error message. current database backup does not exist. Perform a full database backup by reissuing BACKUP DATABASE, omitting the WITH DIFFERENTIAL option." This is good. However it seems
Insert date into filename during backup SQL Server
I'm currently doing differential backups via the following scheduled job command: BACKUP DATABASE [DATABASE] TO DISK = N'c: \ backup \ DATABASE- Differential' WITH INIT , NOUNLOAD , NAME = N'DATABASE differential backup', NOSKIP , DIFFERENTIAL, STATS = 10, NOFORMAT However, I'd like to do the backups several times
backup an instance SQL Server
hey all, i'm looking in sql books online at the backup database command and saw the following example: - - Back up the full AdventureWorks database. BACKUP DATABASE AdventureWorks TO AdvWorksData how do you tell it which instance of sql you would like to use? thanks, rodchar SQL Server Programming Discussions SQL Server (1) Backup (1) AdvWorksData (1) Database (1) AdventureWorks (1) BSc (1) PhD (1) Toronto (1) It uses the instance to which
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 would like to know the code needed on a form using On Click to perform a backup of the entire database. I realize that this may force the auto closing of the database and auto reopening after the backup is complete. I will need to be able to state where the backup file will go and what name I will give the backup. I then want the
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
ADP SQL Database Backup DataBase
From the Access ADE menu system you have an option under the TOOLS, DATABASE UTILITIES menu to Backup, Copy and Restore SQL Server Databases. I've run the Backup and Restore options and find these will serve my needs. With research I found the Docmd.TransferSQLDatabase and Docmd.CopyDataFile commands, but these two do not perform a simple backup as I'm looking for. Basically, these commands are not giving me the same results as selecting backup. Selecting the Backup option creates a single .bak file that can be restored by using