The backup of the metadata repository can be undertaken as a separate exercise from the general backup of the data warehouse. The Backup and Restore process in RED uses PostgreSQL pg_dump and pg_restore respectively. The version of pg_dump and pg_restore installed with RED is at 12.4.
Changing the tools version
If you want to use another version of the backup and restore tools, you can set their location from the User Preferences menu in RED.
To change the path to the executables, go to User Preferences > Common > Local Paths and set the path for each tool.
Backup from the RED UI
Only 'red' schema is included.
To backup the metadata database from RED, go to Backup > Export the Metadata (PostgreSQL pg_dump) then select a destination directory.
Backup from the Command Line
This example is what RED UI would execute except that this command includes all three schemas. When backing up from the command line you can optionally include all three schemas with this pg_dump switch: --schema="(red|redadmin|white)"
Note: the below is written as a batch script which could be executed as a RED Host Script so that the required environment variables are set, to run outside of RED simply replace the environment variables with their values.
setlocal EnableDelayedExpansion SET PGPASSWORD=!WSL_META_PWD! setlocal DisableDelayedExpansion "C:\Program Files\PostgreSQL\15\bin\pg_dump.exe" --host=%WSL_META_SERVER% --port=%WSL_META_DBPORT% --dbname=%WSL_META_DB% --username=%WSL_META_USER% --no-password --no-owner --no-privileges --schema="(red|redadmin|white)" --format=custom --file="c:\temp\%WSL_META_DSN%.dump" --verbose

