How to restore roles into new Database server?

Started by Sridhar Parepalliover 4 years ago7 messagesgeneral
Jump to latest
#1Sridhar Parepalli
Sridhar.Parepalli@sas.com

Hello Pros,
Is there a quick way to create roles from database server to another db server?
Regards,
Sridhar Parepalli

#2Ninad Shah
nshah.postgres@gmail.com
In reply to: Sridhar Parepalli (#1)
Re: How to restore roles into new Database server?

This can be accomplished by taking a global dump. pg_dumpall utility has an
option "-g" to accomplish that.

Regards,
Ninad Shah

On Wed, 15 Sept 2021 at 19:24, Sridhar Parepalli <Sridhar.Parepalli@sas.com>
wrote:

Show quoted text

Hello Pros,
Is there a quick way to create roles from database server to another db
server?
Regards,
Sridhar Parepalli

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Sridhar Parepalli (#1)
Re: How to restore roles into new Database server?

On 9/15/21 6:53 AM, Sridhar Parepalli wrote:

Hello Pros,
Is there a quick way to create roles from database server to another db server?

pg_dumpall -g the_database -f globals.sql

psql -d other_database -f globals.sql

Though this will include other global objects e.g. tablespaces.

See:

https://www.postgresql.org/docs/current/app-pg-dumpall.html

Regards,
Sridhar Parepalli

--
Adrian Klaver
adrian.klaver@aklaver.com

#4Thomas Kellerer
shammat@gmx.net
In reply to: Sridhar Parepalli (#1)
Re: How to restore roles into new Database server?

Sridhar Parepalli schrieb am 15.09.2021 um 15:53:

Hello Pros,
Is there a quick way to create roles from database server to another db server?

You can use pg_dumpall with the --globals-only parameter to create a SQL script
that contains all roles from the source server

#5Sridhar Parepalli
Sridhar.Parepalli@sas.com
In reply to: Ninad Shah (#2)
RE: How to restore roles into new Database server?

Thank you! Ninad

From: Ninad Shah <nshah.postgres@gmail.com>
Sent: Wednesday, September 15, 2021 10:11 AM
To: Sridhar Parepalli <Sridhar.Parepalli@sas.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to restore roles into new Database server?

EXTERNAL
This can be accomplished by taking a global dump. pg_dumpall utility has an option "-g" to accomplish that.

Regards,
Ninad Shah

On Wed, 15 Sept 2021 at 19:24, Sridhar Parepalli <Sridhar.Parepalli@sas.com<mailto:Sridhar.Parepalli@sas.com>> wrote:
Hello Pros,
Is there a quick way to create roles from database server to another db server?
Regards,
Sridhar Parepalli

#6Sridhar Parepalli
Sridhar.Parepalli@sas.com
In reply to: Adrian Klaver (#3)
RE: How to restore roles into new Database server?

Thank you, Adrian!

-----Original Message-----
From: Adrian Klaver <adrian.klaver@aklaver.com>
Sent: Wednesday, September 15, 2021 10:13 AM
To: Sridhar Parepalli <Sridhar.Parepalli@sas.com>; pgsql-general@lists.postgresql.org
Subject: Re: How to restore roles into new Database server?

EXTERNAL

On 9/15/21 6:53 AM, Sridhar Parepalli wrote:

Hello Pros,
Is there a quick way to create roles from database server to another db server?

pg_dumpall -g the_database -f globals.sql

psql -d other_database -f globals.sql

Though this will include other global objects e.g. tablespaces.

See:

https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgresql.org%2Fdocs%2Fcurrent%2Fapp-pg-dumpall.html&amp;amp;data=04%7C01%7CSridhar.Parepalli%40sas.com%7C33d6e5184b134c1fa0ee08d97852e376%7Cb1c14d5c362545b3a4309552373a0c2f%7C0%7C0%7C637673120233711031%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&amp;amp;sdata=AYl6WE8Dc%2B0ZiBtFnVuaPrF%2BdMQRUHthdMsoQgJ5KgI%3D&amp;amp;reserved=0

Regards,
Sridhar Parepalli

--
Adrian Klaver
adrian.klaver@aklaver.com

#7Sridhar Parepalli
Sridhar.Parepalli@sas.com
In reply to: Thomas Kellerer (#4)
RE: How to restore roles into new Database server?

Thank you, Thomas!

-----Original Message-----
From: Thomas Kellerer <shammat@gmx.net>
Sent: Wednesday, September 15, 2021 10:55 AM
To: pgsql-general@lists.postgresql.org
Subject: Re: How to restore roles into new Database server?

EXTERNAL

Sridhar Parepalli schrieb am 15.09.2021 um 15:53:

Hello Pros,
Is there a quick way to create roles from database server to another db server?

You can use pg_dumpall with the --globals-only parameter to create a SQL script that contains all roles from the source server