Database Backup and Recovery
Once you've completed all the steps in your Vizlib Server installation and configuration, it's a good idea to implement back up and recovery procedures for your database. This article contains instructions on the information you'll need for backing up Vizlib Server, the location of this information e.g. Vizlib Management Console (VMC) and any other requirements.
Important: Vizlib Server does not have any specific database backup functions. We recommend you use the backup methods/principles advised for your database instance and apply the process to the information mentioned in this article
This topic contains the following sections:
- Vizlib Server Backup Information
- VMC Server Configu ration
- Attachments Backup
- Vizlib Server Database Recovery - Snapshot
- Vizlib Server Database Recovery - New Machine
- Postgres Database Backup
Vizlib Server Backup Information
Regular database backups will store a version of your database which can be used to rebuild it, helping protect you against events like table corruption, general system problems and unsuccessful upgrades. Each Vizlib Server installation sets up a Postgres database instance as a default, which hosts backend functions for Vizlib Finance and Vizlib Collaboration products. Table 1 lists the information you'll need to include for a backup, including application data, configuration settings and certificate information.
| Data Type | Location and Backup Requirements |
|---|---|
Comments Data (Vizlib Finance and Vizlib Teamwork) |
The location for Comments data is held in the database integration settings in the VMC. Comments are written to a database server, then the data is stored and backed up in line with any other database in your environment. If the default database is used, it should be backed up from Vizlib Server as often as required, either by using a snapshot of the local server or restoring a database from a back up. |
Writeback Audit Data |
The location for Writeback Audit data is held in the database integration settings in the VMC. |
Writeback Data |
If Writeback data uses the default Postgres integration, additional tables are created by users or database admins, and should be identified and backed up as required. Table names and locations will depend on the details entered by the user/admin during the table setup process. |
Attachments (Writeback) |
Attachment metadata is stored in the vzb-writeback-attachments table of the Vizlib Server config database. File contents are stored in the attachment storage selected for the destination. Back up both at the same point in time. For more information, see Attachments Backup. |
Configuration/Settings |
Vizlib Server settings and configuration options are stored in the local Postgres database. The server hosting the Vizlib Server installation can have the previous day's settings restored using a daily snapshot, but the recommended solution is to export the server configuration after each change (for a more up-to-date backup). The exported file should be stored in a secure location that can be reached during recovery, with a step by step guide on how to export and import the configuration. Server configuration can be exported and imported using the VMC (see VMC Server Configuration below). |
Certificates |
Full details of SSL certificate requirements are held in the prerequisites article here. Save the certificate files to a location which can be reached easily from Vizlib Server. |
Oracle Files |
If you are working an Oracle database, back up and store the files tnsnames.ora, sqlnet.ora and cwallet.sso) as they will be required for restoring the database on a new server. |
VMC Server Configuration
In the VMC under System Settings > Server, there is an Export Config button you can use to create and export a JSON file containing the server configuration settings. There's also an Import Config button which can be used to import a JSON configuration file. Import Config is enabled when a valid file path is entered in Path to config JSON file.
Attachments Backup
Attachment metadata and file contents are stored separately, so you need to back up the config database and the attachment storage at the same point in time. If you restore only one of them, some files will show as "not available", or orphaned files will remain in storage with nothing to remove them.
The backup method depends on the attachment storage type. Vizlib Server supports PostgreSQL storage and S3 storage.
PostgreSQL Storage
With PostgreSQL storage, files are saved as large objects.
- Use a separate storage database. You can also store files in the config database, but this increases the size of the database and of every backup of it. The advantage is that a single backup then covers both.
- A whole-database pg_dump includes large objects and their comments. If you limit the dump with -n or -t, also add --large-objects (-b).
- Do not use --no-large-objects (-B) or --no-comments. Each file has a COMMENT ON LARGE OBJECT ownership tag, and without it Vizlib Server cannot serve or delete the file.
- Restore the backup into an empty database as the integration's database user. Large objects keep their original OIDs.
- Do not run vacuumlo or any other large-object cleanup on the storage database, as it deletes all attachments.
S3 Database Backup
With S3 storage, only the file contents are stored in your Amazon S3 bucket or S3-compatible store. File details (name, size, and who uploaded it) stay in the vzb-writeback-attachments table of the Vizlib Server config database, so you need to back up both the config database and the bucket.
- Back up the bucket using the backup methods advised for your S3 provider (for example bucket versioning, replication, or a scheduled copy to a second bucket). Back it up at the same point in time as the config database.
- Keep each object's key, content type and custom object metadata when you copy or restore files. Vizlib Server reads, reports or deletes only objects that carry its marker with the attachment id, and it finds each file by the key the file was saved under.
- Do not add, rename or edit objects under the integration's prefix by hand.
- If the bucket is versioned, a deleted file stays in the bucket (and is billed) until a lifecycle rule removes it. The number of days you set in the rule for noncurrent versions is also how long you can recover a deleted file.
- Never use a lifecycle rule that expires current objects or moves objects to Glacier or Deep Archive. Files would show as "not available", or downloads would fail. Standard-IA and Intelligent-Tiering are fine.
- Record the integration settings (bucket, region, endpoint, key pattern, and authentication mode) and store them securely. The secret access key is stored encrypted and shown masked in the VMC, so keep a copy of it in a secure location as well.
To restore S3 attachments, do the following:
- Restore the config database and the bucket contents to the same point in time.
- Make sure the integration points to the bucket, region and endpoint that hold the restored files. If the integration points to another bucket or endpoint, files will show as "not available".
- If you need to restore the files to a different bucket or endpoint, copy the files first, then edit the existing integration. Do not change the destination to another storage integration.
Important: Changing a destination to another storage integration, turning attachments off, or deleting the destination permanently deletes all its attachment files. Never point a test server that runs on a copy of the production database at the production bucket: deleting a file or destination there would delete the production file. Give each Vizlib Server its own bucket or prefix.
For information on setting up S3 storage, see our article here.
Vizlib Server Database Recovery - Snapshot
The instructions in this section are a guide on recovering a database integration using a snapshot. We recommend checking the recovery instructions for the server hosting the Vizlib Server installation, in case any specific actions are required (e.g. Windows Server manages services in Task Manager).
- Recover the database from the snapshot.
- Stop the Vizlib Server service running.
- Restore the database according to the steps outlined for the database type.
- Start the Vizlib Server service again.
- Import the exported server configuration (if needed).
Vizlib Server Database Recovery - New Machine
The instructions in this section are a guide on recovering a database integration on a new host server. We recommend checking the recovery instructions for the database, in case specific actions are required.
- Install and configure Vizlib Server, using the instructions here.
- Stop the Vizlib Server service running.
- Restore the database (consulting database documentation if required).
- Start the Vizlib Server service.
- Import the exported server configuration (if needed).
Postgres Database Backup
Vizlib Server installs a Postgres database by default. You can find more information on Postgres backup here, and we've included an example of a batch backup script below. The script is an example that you can adapt and schedule, for instance with Windows Task Scheduler.
This example applies to the default installation only (port 1982, database Vizlib). Other databases, such as comments, audit, writeback data and attachment storage, must be backed up separately.
Note: The script contains the database password. Store the file securely, for example in a location with restricted access.
REM Version 1.1, This File needs to be filled manually
REM Set backup folder, default ?:\VizlibServer\Backup\DB
SET BACKUP_FOLDER=D:\VizlibServer\Backup\DB\
REM BACK_FILE is the name of the backup coming out.
SET BACKUP_FILE=VizlibDB_%date%_%random%.backup
REM Verification of the backup filename, this row can be commented and used for troubleshooting.
echo backup file name is %BACKUP_FILE%
REM Set the log of the backup execution, default is ?:\VizlibServer\Backup\Logs\
SET LogFolder=D:\VizlibServer\Backup\Logs\
REM File the database password
SET PGPASSWORD=PASSWORD
REM Execution of the backup with all Collected options:
echo on
"%ProgramFiles%\VizlibServer\postgres\bin\pg_dump" -h localhost -p 1982 -U postgres -F c -b -v -f %BACKUP_FOLDER%%BACKUP_FILE% Vizlib>>%LogFolder%%date%_%random%_log.txt
REM %date:~10,4%-%date:~4,2%-%date:~7,2%