4 4 3:PostgreSQL Restore

From SEPsesam
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
Deutsch • ‎English
Copyright © SEP AG 1999-2022. All rights reserved.

Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.

Draft.png WORK IN PROGRESS
This page is a draft. Treat the information on this page with caution as it may be incomplete.


Docs latest icon.png Welcome to the latest SEP sesam documentation version 4.4.3 Beefalo/5.0.0 Jaglion. For previous documentation version(s), check PostgreSQL archive.


Overview

The restore of PostgreSQL database(s) is quite similar to a regular file system restore. SEP sesam enables you to restore all or only one database from a PostgreSQL server, provided that it was backed up with a separate backup task.
Before you begin, check that all the prerequisites are met.

Key features

  • PostgreSQL restore is simple, guided and similar to a regular file system restore.
  • You can restore the PostgreSQL database(s) to the original or to a new location.
  • There are two ways to restore PostgreSQL database(s) in SEP sesam: via the GUI restore wizard or via the web Restore Assistant (as of v. ≥ SEP sesam 5.0.0 Jaglion V2). Although most options are the same in both restore interfaces, the web Restore Assistant interface is more intuitive and offers additional advanced options.

Prerequisites

Before performing PostgreSQL restore, check the following prerequisites:

  • For a successful restore, all preparation steps must be performed properly. For details, see PostgreSQL Backup.
  • Depending on what you want to restore, make sure you have the required restore permissions and access rights. For details, see User Roles and Permissions.
  • Make sure that there is sufficient free space on the target system to which you are restoring your data.

Restoring PostgreSQL

Depending on the interface you are using, follow the appropriate procedure to restore PostgreSQL DB:

Restoring a single database (DB)

Information sign.png Note
To be able to restore a single DB from a PostgreSQL server, you have to create a separate backup task for each PostgreSQL DB. If the PostgreSQL source in the backup task is set as all, you cannot restore an individual database. For details, see PostgreSQL Backup.

PostgreSQL restore via the GUI

Create a new restore task for the PostgreSQL saveset you want to restore.

  1. From the SEP sesam GUI menu bar, select Activities -> Restore. The New Restore Task window opens.
  2. Select what you want to restore. You can search savesets by task name or by filename or path.
  3. Under the Saved in period drop-down lists, specify the time frame for which you want to conduct the search. Click Next.
  4. The search results are displayed. From the list of savesets matching your query, select the version you want to restore. Click Next.
  5. PostgreSQL restore select task Beefalo V2.jpg

  6. Under the Target Settings, set additional options.
    • Under the Target path settings, select one of the following options:
      • Restore to original target path (set by default): Restores the data to the same location from which it was backed up. If it is set together with the option Overwrite existing items the target database will be deleted first and a new one will be created from the backup saveset.
      • If you select the option New restore target and enter a new database name, the PostgreSQL command createdb creates a database with the specified name. The data is imported into the new database.
      • Information sign.png Note
        You have to set up database users and roles before the database is imported to new target.
    • Under the Execution options drop-down list, select one of the following options:
      • Do not overwrite existing items (set by default): The database will not be restored if it already exists on the target server.
      • Overwrite existing items: If the database exists on the target server, it will be replaced by the restored version.
      • Auto recover (and online) after restore: The data will be stored directly into the database without caching in the file system. Because the data is written directly into the database, it is not possible to modify it.
      • No recover after restore: Use this option if you want to modify the data before you import it into the database. The restored data will be stored on the file system first. The import of data has to be started on the command line interface of the server's operating system. The data will be written as a dump file onto the file system (usually in the directory <SESAM_VAR>/work). You can use this file as input file for the PostgreSQL program pg_restore as follows:
      • su - postgres
        pg_restore template1 -C /var/opt/sesam/var/work/pgsql-SF20081128224529.tmp
        
    • Click the Expert Options button if you want to specify additional restore settings, e.g., modify the log level, define the pre/post script for restore, etc. For details, see the Restore wizard.
    • Information sign.png Note
      The Expert Options button for specifying advanced restore options is available only in advanced UI mode (formerly expert GUI mode). To use Expert Options, make sure your UI mode is set to advanced. For details, see Selecting UI mode.

    PostgreSQL restore target Beefalo V2.jpg

  7. In the final step of the restore wizard, you can review all the settings of your restore task. You can also edit the settings by using Change Selection button. If you want to start your restore immediately, click Start. If you want to save the restore task, click Save.

A restore task can be scheduled like any other task. If you want to add a restore task to the schedule, see Scheduling Restore.

PostgreSQL restore via the Restore Assistant

You can access the Restore Assistant in one of the following ways:

  • via the GUI: by clicking the Restore Assistant icon in the toolbar or from Activities -> Restore Assistant
  • from SEP sesam Web UI: left menu -> Restore Assistant
  • or by entering the following address in the browser bar: http://[sesamserver]:11401/sep/ui/restore/.
Information sign.png Note
  • If you cannot access the web Restore Assistant, check if you have received the appropriate permissions for online restore.
  • The operations and options available after logging in may differ depending on the user type. Other Web UI display restrictions may depend on the custom roles with specific permissions and the UI mode.
    For details, see About Authentication and Authorization and User Roles and Permissions.

With the web Restore Assistant, you can restore PostgreSQL DB to the original or another location using simple or advanced UI mode. When using advanced UI mode, an additional Options tab is available for setting advanced restore options. You can also restore backup into dump file and restore the data to a single file rather than to original location. In this case, you must specify a restore destination path in the Target window (by browsing or typing the path). Optionally, you can also change the name of the dump file. If the dump file name is not specified, it is generated automatically. For more details, see Restore Assistant.

Information sign.png Note
You can only restore one database if it was backed up alone, with one task per database.

Monitoring restore

You can monitor the restore progress using the Web UI (Monitoring -> Restores) or view the status in the GUI (Main Selection -> Job State -> Restores). The restore overview provides detailed information on the last run of restore jobs, including task name, status (successful, error, in queue...), start and stop time of the last backup, data size, throughput, etc. For details, see SEP sesam Web UI or Restores by State in the GUI.

Information sign.png Note
In case of errors during the restore (e.g., primary key error), the restore status in the SEP sesam GUI/Web UI is displayed as erroneous. In such a case, check the restore protocol and the data in the database.

Known issues

If you have problems with PostgreSQL, check the Troubleshooting Guide.