![]() ![]() ![]() ![]() Because this is an empty instance of PostgreSQL, you use the postgres database, which is always available with the -d argument. -d postgres: you need to provide a database that pg_restore can connect to.-U mypostgresqldumpplanet: the admin database user.Pg_restore: error: could not execute query: ERROR: role "myjhipsterplanet" does not existĬommand was: ALTER DATABASE myjhipsterplanet OWNER TO myjhipsterplanet Pg_restore: from TOC entry 3382 1262 16384 DATABASE myjhipsterplanet myjhipsterplanet $ pg_restore -U mypostgresqldumpplanet -d postgres -C /var/lib/postgresql/data/-original.dump The PostgreSQL data is mounted to the directory ~/docker/volumes/postgresqldata. The Docker Compose file will start a PostgreSQL database containing a basic setup where the default admin user postgres is replaced with a user mypostgresqldumpplanet. The database backup and Docker Compose file used in this section are available at GitHub. Skip this section if you just want to know how to use the backup and restore commands. In this section, a database is prepared, which you will use to backup and restore. Basic knowledge of Docker and Docker Compose is needed.The database is called myjhipsterplanet and that is the one you will back up and restore in this post. It is not relevant for the remainder of the post. The schema is quite basic and is shown here for information purposes only. In order to test the commands, I will be using a database I created for a previous blog. After a while, I managed to find out the commands I needed to use, and it seemed to me a good idea to share this knowledge. It appeared that I could not find the answer very quickly by means of a Google search. Some time ago, I needed to back up a PostgreSQL database from a production server in order to be able to fix a problem that was difficult to reproduce in the test environment. In this blog, you will learn how to backup and restore a PostgreSQL database. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |