Migrate SPATIAL data from Oracle to Postgresql

后端 未结 2 402
醉话见心
醉话见心 2021-01-03 06:13

I am trying my best to migrate a spatial database from Oracle to Postgresql and failing miserably.

I have tried many different avenues as you can see from my previo

2条回答
  •  攒了一身酷
    2021-01-03 06:42

    The accepted solution didn't work for me.

    Install GDAL/OGR using OSGeo4W, and in Advanced Install mode select gdal-oracle10g.

    Then execute this command:

    ogr2ogr 
    -a_srs {{SRS}} 
    -overwrite -f 
    "PostgreSQL" 
    -nln {{POSTGIS SCHEMA}}.{{POSTGIS TABLE}} 
    PG:"
    host='{{POSTGIS HOST}}' 
    port='{{POSTGIS PORT}}' 
    user='{{POSTGIS USER}}' 
    password='{{POSTGIS PASSWORD}}' 
    dbname='{{POSTGIS DATABASE}}'" 
    OCI:"{{ORACLE USER}}/{{ORACLE PASSWORD}}
    @(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
    (HOST = {{ORACLE HOST}})
    (PORT = {{ORACLE PORT}})))
    (CONNECT_DATA = (SID = {{ORACLE SID}})))
    :{{ORACLE SCHEMA}}.{{ORACLE TABLE}}"
    

    replace {{ }} items with your values!

    You need to do this for each table. There is an spreadsheet that can generate these commands for you:

    http://gis-expert.com/wp/2018/09/12/how-to-migrate-spatial-data-from-oracle-to-postgis/

提交回复
热议问题