lhs-panel Click here to expand

Manual database backup and restoration

PGSQL

Database backup

1. Bundled PGSQL database backup

  • Stop the EventLog Analyzer application.
  • Create a copy of the <EventLog Analyzer Home>/pgsql folder.

2. External PGSQL database backup

  • Stop the EventLog Analyzer application.
  • Navigate to <EventLog Analyzer Home>/pgsql/bin folder and execute the following command:
Copy to Clipboard

pg_dump -U USERNAME -h HOST_IP -p PORT -d DATABASE_NAME -f "BACKUP_PATH\FILENAME.txt"

Note: Ensure that the database is not used by other users during backup.

Database restoration

1. Bundled PGSQL database restoration

  • Stop the EventLog Analyzer appliction.
  • Replace the current <EventLog Analyzer Home>/pgsql folder with the copied folder.

2. External PGSQL database restoration to existing PGSQL instance

  • Stop the EventLog Analyzer application.
  • Open Command Prompt and set the working directory to <EventLog Analyzer Home>/pgsql/bin.
  • Login to Postgres using the following command:
    Copy to Clipboard

    psql -h HOST_IP -p PORT -U USERNAME

  • Alter the current database name using the following command:
    Copy to Clipboard

    ALTER DATABASE old_db_name RENAME TO new_db_name;

  • Create a new database in the name of the database that was backed up using the following command:
    Copy to Clipboard

    CREATE DATABASE old_db_name;

  • Disconnect the current PGSQL connection and continue on the same session using the below command:
    Copy to Clipboard

    /q

  • In the same directory, restore the dump using the following command:
    Copy to Clipboard

    psql -h HOST_IP -p PORT -U USERNAME -d DATABASE_NAME -f "BACKUP_PATH\FILENAME.txt"

  • After successful restoration, start the EventLog Analyzer application.
  • If the database resumes normal function after restoration, the renamed database can be deleted.

3. External PGSQL database restoration to fresh PGSQL instance

  • Stop the EventLog Analyzer application.
  • Navigate to <EventLog Analyzer Home>/tools and execute the following command:
    Copy to Clipboard

    changeDBServer.bat --console --config

  • Select PGSQL server and enter the new PGSQL server's HOST_NAME, PORT details and the backup database name. Enter the required credentials to configure the database.
  • Navigate to <EventLog Analyzer Home>/ pgsql/ bin directory and restore the dump using the following command:
    Copy to Clipboard

    psql -h HOST_IP -p PORT -U USERNAME -d DATABASE_NAME -f "BACKUP_PATH\FILENAME.txt"

  • After successful restoration, start the EventLog Analyzer application.
Note: Please restore the database based on the type of backup. For restoring dump backup, follow the above steps. For restoring scheduled backup, follow the steps here. Also ensure that the database is not used by other users during restoration.

MySQL

Database backup

1. Database backup using SQL server management studio

  • Stop the EventLog Analyzer application.
  • Navigate to MySQL server management studio and right click on the database.
  • Select Tasks → Back Up and click OK to take backup.

2. Database backup using commands

  • Stop the EventLog Analyzer application.
  • Open Command prompt.
  • Login to MSSQL using Windows authentication or server authentication.
    • For Windows authentication and default MSSQL instance, execute the following command:
      Copy to Clipboard

      sqlcmd -S HOST_NAME -E

    • For Windows authentication and named MSSQL instance, execute the following command:
      Copy to Clipboard

      sqlcmd -S HOST_NAME\INSTANCE_NAME -E

    • For server authentication, execute the following command:
      Copy to Clipboard

      sqlcmd -S HOST_NAME -U sa -P YourPassword

  • Take the backup using the following command:
    Copy to Clipboard

    USE DATABASE_NAME;

    GO

    BACKUP DATABASE DATABASE_NAME TO DISK = 'FILE_NAME.bak' WITH FORMAT;

    GO

  • The default backup directory is C:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Backup, where n is the number of the server instance. Click here for steps to find the default backup path.
Note: Ensure that the database is not used by other users during backup.

Database restoration

1. Database restoration using SQL server management studio

  • Stop the EventLog Analyzer application.
  • Follow the steps on this page to restore the database.

2. Database restoration to existing MSSQL instance using commands

  • Stop the EventLog Analyzer application.
  • Open Command prompt.
  • Login to MSSQL using Windows authentication or server authentication
    • For Windows authentication and default MSSQL instance, execute the following command:
      Copy to Clipboard

      sqlcmd -S HOST_NAME -E

    • For Windows authentication and named MSSQL instance, execute the following command:
      Copy to Clipboard

      sqlcmd -S HOST_NAME\INSTANCE_NAME -E

    • For server authentication, execute the following command:
      Copy to Clipboard

      sqlcmd -S HOST_NAME -U sa -P YourPassword

  • Restore backup using the following command:
    Copy to Clipboard

    USE master;

    GO

    RESTORE DATABASE DATABASE_NAME FROM DISK = "FILE_NAME.bak" WITH REPLACE;

    GO

MySQL

Database backup

  • Stop the EventLog Analyzer application.
  • Create a copy of the <EventLog Analyzer Home>\mysql folder.

Database restoration

  • Stop the EventLog Analyzer application.
  • Replace the current <EventLog Analyzer Home>\mysql folder with the copied folder.
Note: Ensure that the database is not used by other users during backup and restoration.

Other methods of database backup

  • Server snapshot

    For all types of databases, a server snapshot can be taken.

  • Scheduled backup and restoration

    Scheduled backup is applicable for all databases. For scheduled backup and restoration steps, visit this page.

Note: During the service pack installation, configuration files, PGSQL dump or MSSQL database in the existing product will be backed up by default.

Copyright © 2020, ZOHO Corp. All Rights Reserved.

Get download link