# Migrating relational database from Oracle to PostgreSQL

**URL:** <https://forum.keycloak.org/t/migrating-relational-database-from-oracle-to-postgresql/2974>\
**Category:** Getting advice\
**Created:** [May 27, 2020, 12:49am UTC](https://forum.keycloak.org/t/migrating-relational-database-from-oracle-to-postgresql/2974 "2020-05-27T00:49:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ntarunmenon](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@ntarunmenon](https://forum.keycloak.org/u/ntarunmenon)\
**Post date:** [May 27, 2020, 12:49am UTC](https://forum.keycloak.org/t/migrating-relational-database-from-oracle-to-postgresql/2974/1 "2020-05-27T00:49:05Z")

</div>

We have keycloak(version - 3.1.0.Final) running in standalone-clustered mode(2 instances) with a shared oracle database on prem. We have one realm configured with 1,50,000 users. We would like to migrate this setup into PostgresSQL on cloud.

From what I understand from the [documentation](https://www.keycloak.org/docs/latest/server_admin/index.html#_export_import) the way forward seems to be

- Run an export of the current database into a single directory
- Run the import against the new PostgreSQL database .
- Manually resolve any issue with the import SQL or look for other migration solutions to get data into the PostgreSQL.

Is my understanding correct ? Is there anyway I can better leverage something within keycloak to make this migration easier?

---

<div class="post-metadata">

**Author:** ![zonaut](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/zonaut/32/666_2.png) [@zonaut](https://forum.keycloak.org/u/zonaut)\
**Post date:** [May 27, 2020, 4:54am UTC](https://forum.keycloak.org/t/migrating-relational-database-from-oracle-to-postgresql/2974/2 "2020-05-27T04:54:21Z")

</div>

Hi,

have you already tried an export/import to try it out? I could be that no further action is required.  
You could test it locally with docker and see what the results are.  
Look at an example of a docker-compose file on [https://github.com/zonaut/keycloak-extensions](https://github.com/zonaut/keycloak-extensions) and import/export examples against a PostgreSQL DB.

---

<div class="post-metadata">

**Author:** ![ntarunmenon](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@ntarunmenon](https://forum.keycloak.org/u/ntarunmenon)\
**Post date:** [June 5, 2020, 3:13am UTC](https://forum.keycloak.org/t/migrating-relational-database-from-oracle-to-postgresql/2974/3 "2020-06-05T03:13:33Z")

</div>

Hi,

I tried this out and it all just worked. I should have tried first and then asked the question.

Thanks for your help.

Regards,  
Arun Menon

---

<div class="post-metadata">

**Author:** ![huangqinyin](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/huangqinyin/32/9707_2.png) [@huangqinyin](https://forum.keycloak.org/u/huangqinyin)\
**Post date:** [February 6, 2024, 1:16pm UTC](https://forum.keycloak.org/t/migrating-relational-database-from-oracle-to-postgresql/2974/4 "2024-02-06T13:16:19Z")

</div>

Try ESF Database Migration Toolkit to to quickly complete this task :  
[https://www.dbsofts.com/articles/oracle\_to\_postgresql/](https://www.dbsofts.com/articles/oracle_to_postgresql/)
