首页 > 代码库 > ORA-00980:synonym translation is no longer valid

ORA-00980:synonym translation is no longer valid

今天要把测试环境DB的数据更新成最新Production环境的数据,期间发生了一些问题:

1.首先从正式环境exp出想要用户的dmp档

2.drop掉测试环境底下相应用户

3.create测试环境底下相应用户

4.imp 正式环境导出的dmp档

5.在测试环境底下explain plan sql时报:ORA-00980: synonym translation is no longer valid

 

用以下语句查下失效的synonym

select ‘drop ‘        || decode (s.owner,                   ‘PUBLIC‘, ‘public synonym ‘,                   ‘synonym ‘ || s.owner || ‘.‘)        || s.synonym_name        || ‘;‘ as "Dropping invalid synonyms:"   from dba_synonyms s  where table_owner not in (‘SYSTEM‘, ‘SYS‘) and db_link is null    and not exists           (select null              from dba_objects o             where s.table_owner = o.owner               and s.table_name = o.object_name)

 

发现有个TOAD_PLAN_TABLE的synonym失效,应该是我在砍User的时候,没有把这个同义词相应的砍掉

 

解决:drop public synonym TOAD_PLAN_TABLE;