This discussion is archived
2 Replies Latest reply: Aug 14, 2013 5:26 PM by Fa RSS

Convert MySQL spatial to Oracle

hellodnt Newbie
Currently Being Moderated

Hi,

 

Has anyone able to convert MySQL spatial data to Oracle using SQL Developer? I'm unable to conver it.

 

Thanks

  • 1. Re: Convert MySQL spatial to Oracle
    user12155310 Newbie
    Currently Being Moderated

    Hello dnt,

     

    I would try it with the OGC ogr or with python (Mysqldb => cx_Oracle).

     

    Hope it helps.

    Friedhold

  • 2. Re: Convert MySQL spatial to Oracle
    Fa Newbie
    Currently Being Moderated

    hellodnt,

    If you you need to convert spatial data on the fly, meaning for example you have an oracle session and need to query a table with spatial column in mysql db ,  you  must use the Oracle Gateway for MySql [here]. Then you must use OGC functions for interoperability.

    However if the conversion is an offline process meaning you need just to export from mysql and then import into the oracle, that's a different story and you have two options:

    1-use the GDAL/OGR  tool [here] to do the conversion using the following command: [Recommended]

    ogr2ogr -f OCI OCI:user/pass@orcl MySQL:db_name,user=root,password=pass -sql "select * from tabname where fid < 6" -nln target_tname -overwrite -update

    lest you forget to download and install the oracle oci driver for gdal.

    2-use OGC function in mysql and export the results as a file and then import the file into oracle spatial using again the ogc functions, For example:

    mysql>   select aswkt(shape_column) from Table_name_With_Geometry ;

     

    Regards,

    F

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points