# Being Cautious: Database backup + restore process when testing things

**URL:** <https://meta.discourse.org/t/being-cautious-database-backup-restore-process-when-testing-things/135716>\
**Category:** Product Support\
**Tags:** unsupported-install\
**Created:** [12 december 2019 om 04:06 UTC](https://meta.discourse.org/t/being-cautious-database-backup-restore-process-when-testing-things/135716 "2019-12-12T04:06:57Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mreach](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mreach](https://meta.discourse.org/u/mreach)\
**Post date:** [12 december 2019 om 04:06 UTC](https://meta.discourse.org/t/being-cautious-database-backup-restore-process-when-testing-things/135716/1 "2019-12-12T04:06:57Z")

</div>

I’m about to test a process of importing a boatload of content, but want to make sure I can revert properly in case things go sideways on me.

I run an external PostgreSQL instance, so my thought is that I don’t really need to backup the Discourse Rails instance in Docker, but simply the database via the following steps:

BACKUP:

1. `./launcher stop app`
2. `pg_dump -U username -p 12345 -W -F p databasename | xz > ~/backup/database/$(date +"%d-%m-%Y_%H.%M.%S").databasename.pgsql.xz`
3. `./launcher start app`
4. `### IMPORT CONTENT ###`

If things went badly, RESTORE:

1. `./launcher stop app`
2. `xzcat ~/backup/database/DATE.databasename.pgsql.xz | psql -U username -p 12345 -W databasename`
3. `./launcher start app`

And things should be back to sane and functional… correct?

---

_[View the full topic](https://meta.discourse.org/t/being-cautious-database-backup-restore-process-when-testing-things/135716)._
