Migrate SPATIAL data from Oracle to Postgresql

后端 未结 2 426
醉话见心
醉话见心 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 07:02

    There are two popular options: open source ogr2ogr or a commercial offering from Safe Software.

    Here is how I'd approach the ogr2ogr solution.

    First, you need to have the right tools: GDAL/OGR. If you are on Unix, compile using the right libraries to get Oracle support (not enabled by default). But I'm going to assume you are on Windows. The simplest way to get open source geospatial tools is with OSGeo4W. To enable Oracle support for GDAL/OGR, you need to also select the gdal-oracle10g package in setup.exe with the "Advanced Install" mode. More info about the Oracle package is at this page, and note that you also need to supply the non-free OCI.DLL. When working, you should see the driver name appear with ogr2ogr --formats.

    Your basic command from the OSGeo4W Shell should look something like:

    ogr2ogr -f "PostgreSQL" PG:"host=localhost user=someuser dbname=somedb password=password port=5432" OCI:someuser/password layername
    

    Here is more info on GDAL/OGR:

    • ogr2ogr command usage: http://www.gdal.org/ogr2ogr.html
    • Oracle Driver: http://www.gdal.org/drv_oci.html
    • PostgreSQL/PostGIS driver: http://www.gdal.org/drv_pg.html

提交回复
热议问题