1) My situation islike you.I onlysynonyms inmy schema. Synonymsreferences objects that arein other schemas.
In the following example :
I have 1 synonym named "SYN" in my schema C##TEST
I have 1 table named "Z" in my schema C##TEST1
My synonym "SYN" reference table "Z" under schema C##TEST1
Here's whatyou need to do to reverse the result correctly in PowerDesigner.
2) Create a file named MYSCHEMA.SQL with these instructions :
set pagesize 0
set long 1000
set feedback off
set trimspool on
set heading off
set echo off
grant select_catalog_role to c##test ;
spool d:\DDL.SQL
select DBMS_METADATA.GET_DDL(o.object_type, s.table_name, s.table_owner) || ' ;'
from user_synonyms s, all_objects o
where s.table_name = o.object_name
and s.table_owner = o.owner ;
select 'CREATE SYNONYM "' || SYNONYM_NAME || '" FOR "' || TABLE_OWNER || '"."' || TABLE_NAME || '"' || DECODE(DB_LINK, NULL, '','@' || DB_LINK) || ' ;'
FROM USER_SYNONYMS ;
spool off
Note : To browse the dictionaries your current schema (replace c##test by your schema name) is not privileged user like DBA. When DBMS_METADATA package is called, it attempts to browse the dictionaries. Usually the calling user does not have privilege to browse the dictionary and this fires an error by saying invisibility to the target object that is ORA-31603 error. This role "select_catalog_role" can be granted to users to allow SELECT
privileges on data dictionary views. Ask to your DBA.
2) Start SQL*PLUS, connect on your schema and run the previous SQL - In my case under D:\ directory.
@d:\MYSCHEMA.SQL
3) You can find the result under D:\DDL.SQL. I have copied and pasted the result under here:
CREATE TABLE "C##TEST1"."Z"
( "Z" CHAR(1)
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
TABLESPACE "USERS" ;
CREATE SYNONYM "SYN" FOR "C##TEST1"."Z" ;
4) Reverse the script DDL.SQL into PowerDesigner.
5) Now PowerDesigner display your diagram with your tables, views and in your local work space you can see objects - tables, users, views, synonyms, etc.