2 Replies Latest reply on Aug 15, 2013 12:26 AM by Farid Cher

    Convert MySQL spatial to Oracle




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



        • 1. Re: Convert MySQL spatial to Oracle

          Hello dnt,


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


          Hope it helps.


          • 2. Re: Convert MySQL spatial to Oracle
            Farid Cher


            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 ;