Public Cloud > Database > Backup > Importing backups

1.4 Importing backups

Microsoft SQL Server

  • Generate the script:
    • launch SQL Server Management Studio on your machine;
    • right-click the database you want to export and select Tasks > Generate Scripts...;
    • in the Generate and Publish Scripts window, select Next >;
    • on the Choose Objects page, select Script whole database and all database objects or Select specific database objects, and then select Next >;
    • in the Set Scripting Options window, select Save Scripts to a specific location and select Advanced to configure additional export options, then select Next;
    • on the summary page, select Next;
    • select Finish to close the wizard and save or publish the scripts.
  • Import SQL into the database:
    • use the following command:
    • sqlcmd -S IP_Istanza_Dbaas -d DB_Name_Dbaas -U username_dbaas -P -i C:\path\to\file.sql
    • the .sql files contain all the queries required to repopulate the database.

MySQL

  • Generate the script:
    • select Data Export under Management in the left sidebar;
    • a list of available databases is displayed;
    • select the checkbox next to the database you want to export;
    • if you want to back up a specific table, select the database name;
    • all tables in the selected database are displayed on the right;
    • select the checkbox next to the table;
    • select the appropriate option under Export Options;
      • using Export to Self-Contained File makes it easier to restore an entire database in a disaster recovery scenario; Export to Dump Project Folder creates a separate backup for each table, making it easier to restore individual tables when required; which method you choose depends on the purpose of the backup; if you simply want to archive the database, use Export to Self-Contained File;
    • select Start Export.
  • Import SQL into the database:
    • use the following command:
    • mysql -h IP_Istanza_Dbaas -u username_dbaas -p DB_Name_Dbaas < \path\to\file.sql
    • the .sql files contain all the queries required to repopulate the database.

MySQL Workbench

Connecting with MySQL Workbench

  • launch MySQL Workbench version 8 or later and create a new connection using the + button;
  • complete the following fields:
    • Connection Name: enter a name for the connection you are creating;
    • Connection Method: Standard (TCP/IP);
    • in the Parameters section:
      • Hostname: enter the instance IP address displayed in the Control Panel;
      • Port: 3306;
      • Username: enter the username;
        • if the instance is shared, the username is automatically assigned by the system and is always available in the Control Panel;
        • if the instance is dedicated, the username is selected during creation and is always available in the Control Panel;
      • Password: enter the user password;
      • Default Schema: enter the database name;
  • test the connection using Test Connection; the application will ask you to enter the password to continue;
  • close the window and select OK on the configuration screen;
  • start the connection and run the queries.

Importing an SQL backup

  • from the application menu, select Server and then Data Import;
  • select the script file in SQL format (.bak format is not supported) and import it into a specific database;
  • start the import by selecting Start Import.