Backing up SQL Server with ASP.NET

I have shared hosting with SQL Server. I don't have physical access to SQL Server. I want to make a backup and download it. How can I do this from an asp.net page?

+2


source to share


3 answers


You can issue BACKUP commands from ASP.NET just like any other query or SQL command.

http://msdn.microsoft.com/en-us/library/ms186865.aspx



  • Build a unique name for the backup file
  • Connect to SQL and execute the appropriate BACKUP commands
  • Check that the backup was successful, the backup file exists and transfers it back to your browser (using Response.TransmitFile )
+1


source


Even if you do not have physical access to mssql, your hosting provider may be able to backup and download mssql through the control panel GUI. You can check them first.



John

+2


source


I think some people use mental keys and offer you a SQL backup as if you had full access to the machine (which you specifically state you don't have).

You cannot perform a standard backup to C: \ Backup or C: \ [All] in a hosted environment.

You need to find out if you can remotely access the SQL Server instance using SQL Server Management Studio (I used hosts that allow remote access to the SQL Server port) and then instead of a normal backup for the BAK file (which implies having access to the local hard drive in SQL Server), right click on the database and try to create a script from there. You will end up with a script similar to the scripts mysqldump creates for MySQL.

If that fails, take a look at the dashboard, they might have a tool that does it, or one that sends you a BAK file generated through the dashboard.

Otherwise, ask your host.

+1


source







All Articles