3

In our project we have one database running on oracle 8i (i know this version is ancient but ...)

I want to check the DDL statement for one PUBLIC database link i tried :

select dbms_metadata.get_ddl('DB_LINK', 'LINKNAME', 'PUBLIC') from dual;

select dbms_metadata.get_ddl('DB_LINK', 'LINKNAME', 'PUBLIC') from dual;
                     *
ERROR at line 1:
ORA-00904: invalid column name

As per my knowledge it seems like oracle 8i does not support dbms_metadata. Please correct me if i am wrong.

Table dba_db_links gave me bit information but missing SID of target database.

Is there any way to get DDL statement on Oracle 8i apart from exporting the database/schema ?

Nagendra Nigade
  • 866
  • 2
  • 12
  • 28

2 Answers2

2

You can query the data dictionary:

SELECT 'CREATE PUBLIC DATABASE LINK "'||DB_LINK||'" CONNECT TO '||USERNAME||' IDENTIFIED BY "<PWD>" USING '''||HOST||''';' AS cmd
FROM DBA_DB_LINKS
WHERE owner = 'PUBLIC'
    AND DB_LINK = 'LINKNAME';

If you miss information try to select table sys.link$ instead.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
2

You can use exp/imp tools. Export that database (or schema) using exp rows=now and then import it back into the database using imp show=yes.

This will not make any changes in the database, but all DDLs will be put into the logfile.

ibre5041
  • 4,903
  • 1
  • 20
  • 35