To back up a PostgreSQL database, use the db.pl script or the pg_dump command depending on your setup.
Note: You can use db.py to back up PostgreSQL data in all setups except the dedicated database server setup where ctf (TeamForge database) is not
installed. In a dedicated database setup, you can back up the PostgreSQL database safely while it is online by using the native
pg_dump command.
Using db.py:
-
To back up the entire PostgreSQL database, run this command.
- ./db.py -a dump -f /tmp/backup/
-
To back up only the ctf database, run this command.
- ./db.py -a dump -t ctf -f /tmp/backup/
-
To back up only the datamart, run this command.
- ./db.py -a dump -t reporting -f /tmp/backup/
Using pg_dump:
-
In a dedicated database setup, you can run one of these pg_dump commands:
In this example, the database is dumped into a GNU tar formatted file or a .dmp
file.
- pg_dump -Ft -b -o ctfdb > ctfdb.tar
- pg_dump -Fc <dbname> -f ctfdb.dmp
- pg_dump ctfdb >
/tmp/backup_dir/teamforge_data_backup.dmp
Note: For this example, the name of the CollabNet
TeamForge database is assumed to be
ctfdb.
Tip: See the PostgreSQL pg_dump man page for more information
and examples.