Using export/import to update a development database, I normally do a schema (user) import. Is there an easy way to import public synonyms?
Instead of using export/import for re-creating your PUBLIC synonyms, why not simply reverse-engineer the DDL statements to create the PUBLIC synonyms and then run that DDL on the development database? The following SQL can be run on your production database.
SPOOL create_pub_syn.sql SELECT 'CREATE PUBLIC SYNONYM '||synonym_name|| ' FOR '||table_owner||'.'||table_name||';' FROM dba_synonyms WHERE owner='PUBLIC'; SPOOL OFF
The result will be a text file "create_pub_syn.sql" which contains all the CREATE PUBLIC SYNONYM commands you need to execute in your development environment. An alternative is to use the DBMS_METADATA.GET_DDL package to extract the same DDL commands, but the above works quite nicely too.
Dig Deeper on Oracle database administration
Related Q&A from Brian Peasland
In this expert answer, Brian Peasland explains how to call a stored procedure inside user-defined functions in Oracle Database. Continue Reading
One reader asks how he can make a copy of his Oracle Database but not have any data in it, for test purposes. Continue Reading
Learn how to add disk to ASM diskgroup with two-way mirroring and how to specify a failgroup in this tip from Oracle expert Brian Peasland. Continue Reading