Creating a test environment from a production repository

The following article will cover PostgresSQL, SQL, And Oracle databases.


When using Postgres as the Pyramid repository, to create a copy of an existing environment, you first need to install Pyramid using the same version of the environment you are copying from, then replace the newly created repository with the backup taken from the existing environment.

The first step is to confirm the Pyramid version on the production environment.
You can get to it by clicking on your initials on the tab at the top right-hand side of the screen, as shown below. 

Here, we can see it's Pyramid version 2020.11.030.
In this case, we will run the installer version 2020.11.030 in our test environment.

When running the installer, we will choose a new internal repository or new remote repository > PostgresSQL:

After completing the installation, go back to the production environment and back up the repository.

To create the backup, run the following command in your production server:

"C:\Program Files\Pyramid\postgres\pgsql\bin\pg_dump.exe" -U pyramid -h localhost -p 12130 -F t -f C:\backup\pyramidDbBackup.tar pyramidg2

The default password for the DB is: pyramid

From version 2020.15 and above, the password for the internal PostgreSQL instance will be the name of the DB with ! after the word “pyramid”
example: DB name:pyramid123 password: pyramid!123

The way to change the Postgres password via CMD is with the following commands, which need to run on the server running the Pyramid Postgres service.

1. cd C:\Program Files\Pyramid\postgres\pgsql\bin
2. set PGPASSWORD=CurrentPassowrd
3. psql -h localhost -d DB name -U pyramid -p 12130 -c "ALTER USER pyramid WITH PASSWORD 'NewPassword';"

To get your DB name, go to your pyramid folder and open the config.ini file.
There, under data, you will see the database, and this is the name of your DB.
NOTE: The path to your pyramid folder in Windows is C:\Program Files\Pyramid
and in Linux, it's - /opt/pyramid.

If you are using a version lower than 2020.20 and want to update the password in the config, you need to use the tool and follow the instructions from this link:
How to update the Pyramid repository credentials.

To change the password in Pyramid version 2020.20 or higher, a maintenance tool named "run" can be used. It's located at C:\Program Files\Pyramid\core\maintenance

Now copy the file to your Test environment and run the following command in the CMD to restore the database:

"C:\Program Files\Pyramid\postgres\pgsql\bin\pg_restore.exe" --clean -h localhost -p 12130 -U pyramid -d pyramidg2 C:\backup\pyramidDbBackup.tar

The following article describes How to back up and restore a PostgreSQL database via DBeaver.

After restoring has been completed, you'll need to truncate the server table by running the file you can download here or by connecting to the database via a 3rd party app.

After truncating the tables, restart all Pyramid services, wait a few minutes, and try to log in.

NOTE: you will need to change the data sources so they won't point to production data sources.

If you are using IMDB, you must copy the IMDATA folder from the production server.
The IMDATA folder is located in C:\Program Files\Pyramid\repository\imdata

Ensure everything is working fine and all the reports can be opened without errors.

Now, if you restored the backup to a new instance, the following command should be run on cmd :

1. cd C:\Program Files\Pyramid\postgres\pgsql\bin
2. psql -h localhost -d DB name -U pyramid -p 12130 -c "CREATE EXTENSION IF NOT EXISTS ""uuid-ossp"";"

Or you can use a 3rd party app, like Dbeaver, to run it directly on the database:


The above is needed because the Pyramid installer uses this extension when running scripts to update the Pyramid database.
Note: The above command should NOT be run on a local Pyramid Postgres instance.


MS SQL Server and Oracle

When using these DB's as a repository for Pyramid, the process is first to create a backup and then restore it in the destination, then install using the copy of the repository.

You will need the same Pyramid or higher Pyramid versions for SQL and Oracle databases.
For example, if you have Pyramid 2020.05.30, you can run installer build 2020.11.030.

The first step is to create a repository backup from the production environment and restore it on your SQL or Oracle test environment.

After you have restored the repository into your SQL or Oracle test environment, you can run the Pyramid installer and choose "Reuse Pre-existing Repository" > Microsoft SQL Server Or Oracle.

Point Pyramid to your SQL database:

Or Point Pyramid to your Oracle database:

And finish the installation.

Log in to your test environment and make sure you can open the reports.

Make sure to stop all the models and stop all publications.

Once the test environment is working, you need to deactivate its license (admin console -> licensing -> deactivate instance), get the machine key(after reloading the page -> new deployment -> generate machine key), and send it to your account manager to get a test pyramid license.

Each pyramid environment must have its license and not use the same one as another environment.