Search code examples
postgresqloracledblinkora2pg

How to extract public DBlink with ora2pg


My understanding is that ora2pg is capable of extracting private Oracle DBLinks inside a schema. How about public DBlinks (in DBeaver, I see them under Global metadata/Public Database Links)?

If I specify a schema in the config file and run this command, no DBLink is found (as excpected, because no private DBLink is set inside this schema):

ora2pg -t DBLINK -o dblink.sql -b ./schema/dblinks/ -c ./config/ora2pg.conf

If I comment the schema in the config file (to target all schemas) and run the same command, I get this error:

FATAL: ORA-20000:
ORA-06512: at "SYS.DBMS_UTILITY", line 347
ORA-24237: object id argument passed to DBMS_UTILITY.INVALIDATE is not legal
ORA-06512: at line 2 (DBD ERROR: OCIStmtExecute)

Is there a way to extract a public DBLink?


Solution

  • Inside /config/ora2pg.conf, you just need to put PUBLIC for the schema name:

    # Oracle schema/user to use
    SCHEMA PUBLIC