Select to view content in your preferred language

Rename PostgreSQL Geodatabase

2274
7
04-02-2021 03:59 AM
Status: Open
Labels (1)
MMBR
by
Occasional Contributor

Add the capability to rename PostgreSQL Geodatabases. Currently if the PostgreSQL Database is renamed it breaks the sde geodatabase repository because the database name is stored in many tables/rows in the sde repository tables. If the database administrator could rename the database then copies of the same geodatabase could be created in the same PostgreSQL Instance. This would be extremely helpful.

7 Comments
AndréGraf

This would be extremely helpful, because we want to load data in a Geodatabase during the day and at 5 am we switch the database with the read-only-database (this is the Geodatabase, the users connect to).  Unfortunately the database name is stored in many tables/rows and this prevents this idea.

MikeFallon

We routinely refresh our database from production to lower environments using postgresql. This would be helpful for our refresh process and also provide some additional protection to support having a different database name in lower environments. Currently, we refresh with the production database name and it causes confusion to have multiple environments with the same name.

RonRiel

We have been refreshing our lower level environments in Oracle for many years, but can't really do this in PostgreSQL.  Please include this in the roadmap for this database technology!

RiccardoKlinger

As we are using a pgdump to build a new database for different usecases which reuqire similar data, we would definitely love to see such a solution!
So same usecases as @RonRiel and @MikeFallon .

Kiril_Petkov

Hi! Is this solved already!
I see, that for the SQL Server it is already done (the GDB name is no longer "hardcoded" in the system tables), but what about the PostgreSQL?
It's a pity, that this is still issue, we are 2024 already....

IvanDImitrov

UPDATE: 
Hi, guys!
You can easily make a copy of a PostgreSQl database with different name, as follows:
1. Backup the GDB( for example, named "gdb_sourse");
2. Make new  GDB via psql, named "gdb_destination";

3. Restore the dump to the new GDB;

4. Replace the strings "gdb_sourse" with "gdb_destination" in the tables:
gdb_items, gdb_tables, gdb_featureclasses, gdb_columns, gdb_relationship, gdb_domains, sde_layers, sde_table_registry,
with the following script:

UPDATE sde.<mentioned_above_tablename>
SET <column_that_have_the_string> = REPLACE(<column_that_have_the_string>, 'gdb_sourse', 'gdb_destination')
WHERE <column_that_have_the_string> LIKE '%gdb_sourse%';

Of course, you have to set up "gdb_sourse", "gdb_destination", <mentioned_above_tablename> and <column_that_have_the_string> to the appropriate values and to repeat the script few times for the tables in the note (or make more complex script for automatic replacement, but this is not recommended- different GDBs have different setup of tables, depending of the their content)

I just managed to make this procedure for a PostgreSQL 14 Enterprise GDB (ST_Geometry based) and it is working excellent! 

MarceloMarques

This has not be implemented yet and we still cannot rename the PostgreSQL Database that stores the ArcSDE Geodatabase.

Please, open a ticket with Esri Technical Support and request the enhancement, if more customers ask for this important feature via support, then it will increase the changes for this feature to get implemented in a future release soon.

Note!!!
If you attempt to change the database name and then edit the columns in the ArcSDE repository tables that contain the database name then you will corrupt your geodatabase, the PostgreSQL database name is stored on many rows on many different tables in the ArcSDE repository, including XML columns, and changes are that you will miss a location where you need to change the database name, and this will make your geodatabase invalid and will cause issues. Hence, it is highly recommended that you do not attempt to do this.

community.esri.com - PostgreSQL white papers recommended

How to Move the PostgreSQL Enterprise Geodatabase with pg_dump and pg_restore

How to Configure Windows Authentication for the PostgreSQL Enterprise Geodatabase

How to Upgrade the PostgreSQL and PostGIS version for the Enterprise Geodatabase

How to Install Database Clients for ArcGIS

For more best practices visit my blog below, look for the ArcGIS Pro database guidebooks for PostgreSQL and the database template scripts for PostgreSQL, the production mapping database guidebooks can be applied to any industry.

Mapping and Charting Solutions (MCS) Enterprise Databases Best Practices

I hope this helps.