|
-
Dec 18th, 2021, 02:18 AM
#1
Thread Starter
PowerPoster
RESOLVED - create sql bacpac from asp.net code
Hello. The situation is, we have an ASP.NET application running on a shared hosting site. I would like to be able to somehow run a backup of the SQL database on a regular interval (say once per day), and have that backup ultimately reside in an area of the local website storage - i.e. "Server.MapPath("MyDBBackupFolder"). When I say "backup", this can be, but is not limited to, a standard SQL "bak" file, as bacpac would also be good, and if all else fails plain text script statements for create and insert.
The host does not allow outside (remote) access to the SQL database (so I can't get to the DB via SSMS - I have to use their control panel tool MyLittleAdmin, but that is besides the point). Also, the host does not provide the ability to set up scheduled, automated backups of the SQL DB. (They do provide the ability to run a SQL backup manually thru their control panel.)
I would like to know if it is possible to do something on the client website side (i.e., the directory where my aspx pages reside) to either create a bacpac, backup, or even a set of scripted create/insert commands. The website/aspx of course connects to the database as it needs to do to run the application.
However, to do a command such as "BACKUP DATABASE MyDb TO DISK = 'C:\blah .." would be to no avail, since the target refers to the server on which the SQL DB resides, which the aspx application does not have direct access to. But of course the aspx application does have access to its own "local" storage ("Server.MapPath("blah")).
The ideal thing here, if possible, would the ability to create a SQL backup, or bacpac, thru the aspx application, where the output destination is the local (Server.MapPath) storage.
Failing this, would there be an appropriate scripting solution that you know of that would iterate thru each table and generate the create table and insert statements and save it off to a text or zip file? (I know that this could be "home-grown", but I would prefer not to have to write that myself if there is an existing utility/library/nuget package that can do this).
I hope I have presented the problem clearly and look forward to any proposed solutions ...
Thanks,
Bruce
Last edited by BruceG; Feb 14th, 2022 at 07:45 AM.
Reason: Resolved
"It's cold gin time again ..."
Check out my website here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|