SELECT * FROM USERS WHERE CLUE > 0
July 27, 2005 8:58 AM
Subscribe
I'm playing (oracle) DBA for a day over the next two weeks and need to create public synonyms for all tables in a schema. How would I go about doing so?
I'm a developer and don't usually do more than basic DML and stored proc stuff. I am familiar with the following syntax:
CREATE PUBLIC SYNONYM employees
FOR hr.employees@sales
But I need to do it for all tables in the schema and don't feel like doing it by hand for the 4000 tables we've got. Google just gives me a lot of reference material :-( There must be a way to use a select with the data dictionary and then generate all the sql required, or something built in. Any suggestions? P.S. I have access to the Enterprise Manager.
posted by furtive to computers & internet (7 comments total)
set lines 300 pages off
spool syns
SELECT 'CREATE PUBLIC SYNONYM '||table_name||' FOR '||owner||'.'||table_name||';' cmd
FROM ALL_TABLES
WHERE OWNER='HR';
@syns.lst
posted by neilkod at 9:56 AM on July 27, 2005