how to take backup of only roles/users in postgresql?
Asked Answered
A

1

11

I am trying to restore the backup of the database but it's giving me the error of roles, so I got to know that first, we have to take backup of roles/users then we take complete backup but I am unaware of command that can be used. can anyone help me with the command?

Ammeter answered 9/9, 2021 at 11:40 Comment(0)
I
13

You can use pg_dumpall for that with the --globals-only option:

pg_dumpall --globals-only --file=all_roles_and_users.sql -p postgres -h ... 

The file all_roles_and_users.sql will contain all roles and role memberships currently defined in the instance (aka "cluster") you connect to.

This nee

Inconclusive answered 9/9, 2021 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.