From: Tomas Straupis <tomasstraupis@gm...> - 2010-01-19 11:47:23
Currently Invalid object tool displays different invalid objects
including public synonyms.
The problem here is that in order to "fix" public synonyms TOra is
trying to execute this:
alter synonym public.synonym_name compile;
Even if this is changed to correct syntax:
alter public synonym synonym_name compile;
It will usually NOT work as this kind of statement is reserved
exclusively to SYS user (you will get "insufficient privileges" even
if you have DBA role).
Normal solution would be to change it to:
create or replace public synonym synonym_name for synonym_target
In order to get that two changes are required:
1. Add additional flag "Replace" to toExtractor (along with Heading,
Prompt, Parallel, Grants etc.) indicating, that CREATE OR REPLACE
should be generated rather than CREATE. For backward compatibility
default value would be false but toResultExtract.cpp will make it
2. Currently create extractor for synonyms generates semicolon and
two empty lines at the end of create statement. This causes
conn.execute(sql); to NOT run actual create statement, it just "runs"
empty trailing lines making no changes. The only solution I found was
to add one more flag to toExtract class - Footer indicating if those
trailing parts should be generated. Once again for backward
compatibility this flag would have default value false.
With both of these changes public synonyms are "recompiled" successfully.
Now while I'm pretty happy with change 1, I do not know if change
number 2 is OK.
What do you think?