How To: Backup a Database Using Command Line

There is a command line tool coming with dbForge SQL Azure Backup with the help of which you can backup a database.

To backup a database you have to follow the procedure below:

  1. Open the Command Prompt.
  2. Type CD followed by the path to the azbackup.exe file and press ENTER. The command line path will be set to the C:\Program Files\Devart\dbForge SQL Azure Backup\.
  3. Type azbackup.exe and press ENTER The list of available command line parameters will come up:
    • -bD - backup destination type:
            LS - local Sql Server.
            DS - Devart Azure Backup service.
            AS - DAC Azure Export/Import service.
            BF - Backup file.
    • -S <srvr> - SQL Azure server name.
    • -U <id> - SQL Azure login ID.
    • -P <pwd> - SQL Azure login password.
    • -d <name> - SQL Azure database name.
    • -schema - backup the structure of database schema objects only.
    • -data - backup table data only.
    • -t - transaction-safe backup mode.
    • -o <path> - backup name.
    • -lS <srvr> - local SQL Server name.
    • -lU <id> - login ID for local SQL Server.
    • -lP <pwd> - login password for local SQL Server (if empty use -lP "").
    • -lE - use Windows authentication for local SQL Server.
    • -lN - encrypt connection for local SQL Server.
    • -lC - trust local SQL Server's certificate.
    • -ld <name> - target database name on local SQL Server.
    • -B - Windows Azure BLOB storage address.
    • -SK - use BLOB storage shared key (primary access key if not defined).
    • -AK - BLOB storage access key.
    • -w - Windows Azure service address.
  4. Type azbackup.exe followed by command line arguments and press ENTER. For instance:

    • SQL Server
      azbackup.exe -bD LS -S sqlazureservername -U sqlazurelogin -P sqlazurepassword -d ListMembersTest -lS MSSQL2008RTM -lU localsqlserverlogin -lD ListMembersTest
    • Devart Service
      azbackup.exe -bD DS -S sqlazureservername -U sqlazurelogin -P sqlazurepassword -d ListMembersTest -w windowsazureserviceaddress -b windowsazureblobstorageaddress -AK blobstorageaccesskey -o sqlbackups\
    • DAC Service
      azbackup.exe -bD AS -S sqlazureservername -U sqlazurelogin -P sqlazurepassword -d ListMembersTest -b windowsazureblobstorageaddress -AK blobstorageaccesskey -o sqlbackups\my_backup.bacpac
    • Backup File
      azbackup.exe -bD BF -S sqlazureservername -U sqlazurelogin -P sqlazurepassword -d ListMembersTest -o d:\temp\
  5. Press ENTER to run the process.

See Also