4 4 3:PostgreSQL Restore
The restore of PostgreSQL database(s) is quite similar to a regular file system restore. It is possible to restore the PostgreSQL databases to the original or to a new location. Restore is triggered from the Menu bar -> Activities -> Restore. Restore wizard guides you through the process of restoring your data. For step-by-step procedure, see Standard Restore Procedure.
Note that SEP sesam provides the web Restore Assistant interface which is designed to be more intuitive and offers additional advanced options compared to GUI restore wizard while, on the other hand, it does not support the restore of special tasks types, such as MS SQL, PostgreSQL, Oracle, etc. For these task types you can only use the GUI restore wizard to restore your data.
Create a new restore task for the PostgreSQL saveset you want to restore.
- From the SEP sesam GUI menu bar, select Activities -> Restore. The New Restore Task window opens.
- Select what you want to restore. You can search savesets by task name or by filename or path.
- Under the Saved in period drop-down lists, specify the time frame for which you want to conduct the search. Click Next.
- The search results are displayed. From the list of savesets matching your query, select the version you want to restore. Click Next.
- 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.
- 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:
|You have to set up database users and roles before the database is imported to new target.|
su - postgres pg_restore template1 -C /var/opt/sesam/var/work/pgsql-SF20081128224529.tmp
|As of v. 4.4.3. Beefalo, the Expert Options button for specifying advanced restore options is only available in the Expert UI mode. It is not available for users that run the GUI in Basic or Advanced mode. In the latter case, if you want to access the Expert Options you first have to change the Basic/Advanced UI mode to Expert, as described in Selecting UI mode.|
A restore task can be scheduled like any other task. If you want to add a restore task to the schedule, see Scheduling Restore.
You can view the status of your restore jobs by selecting Job state -> Restores from the Main Selection. Restore overview provides detailed information on the last run of restore jobs, including the task name, status (successful, error, in queue ...), start and stop time of the last backup, data size, throughput, client and message.
Restoring a single database (DB)
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.
|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 case, check the restore protocol and the data in the database.|
If you have problems with PostgreSQL, check the Troubleshooting Guide.