An automated db backup app

Discussion in 'Control Panel API' started by CrystalCMS, Mar 11, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Similar to the other application posted in this forum, here is a ASP.NET based backup solution for SQL 2008 db's using the new Sql2008CreateBackup API method.

    This one is a Visual Studio 2008 solution / project but there's so little code in it, it will easily convert to earlier versions of VS if required. It's simple and a bit noddy to be honest but once installed and hosted in a DASP account, it can be easily be called directly from a DASP scheduled task.

    Here are a few quick tips to get it working:

    1) Enable the api for your DASP account
    2) Put your apiKey in the web.config appSettings section
    3) Put your apiSandboxKey in the web.config if you want to test with that
    4) Put your databaseName in the web.config
    5) Upload it as part of your main app in the root of your DASP account or alternatively in a separate sub folder off the root.
    6) If uploaded to a sub folder, use the web application tool to create the web app for the sub folder
    7) Create a scheduled job to call the default.aspx page. It looks like every 6 hours is the min threshold to call the Sql2008CreateBackup API method, but once or twice a day should be sufficient.
    8) Add the IP address of the webserver your account is hosted on to the api whitelist

    A couple of other things:
    1) Any exceptions are trapped and handled but simply thrown and logged.
    2) If you need exception notification setup (e.g. by email) you can just configure your own <healthMonitoring/> section in the web.config
    3) Basic logging is performed to backupLog.txt using System.Diagnostic.Trace

    That's about it - it's working well here.
    Feel free to rip the code and use it as you please.;)

    All comments and criticism very welcome..I'm sure there's room for improvement!

    All the best,
    Joe
     

    Attached Files:

  2. mjp

    mjp

    Cool! Nice concise step-by-step there too.
     
  3. Hi,

    I following your step by step list:
    Enable the apis.
    I define the subfolder 'JJS.CrystalCMS.DBBackup' as Webapp.
    Insert my apikeys in the web.config.

    I get this error, when i call default.aspx:
    Could not load type 'JJS.CrystalCMS.DBBackup.Global'.
     
  4. Hi there,

    This is the global.asax used by the app to load web.config into application state and it also manages logging through the trace class. The exception is being thrown because ASP.NET cannot locate the JJS.CrystalCMS.DBBackup.Global class code.

    Your problem sounds like a build / deployment issue. The contents of the zip file attached here is source code only because of the limitation on zip file attachment size. In other words if you want to get this working using the contents of the attached zip file, you will need to build the project in Visual Studio 2008 and then upload it to your account.

    If you don't have VS2008, just can just crib the bit's you need from the sample code and paste it into your own project..the code is pretty short, simple and self explanatory.

    Just post again if you're really stuck.
     
  5. mjp

    mjp

    The thread you referenced above has also been made "sticky" in the API forum.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page