使用SQLDeveloper 4.0.1.14创建导出脚本(单独的文件&" drop"已选中),它在DROP.sql
中生成了我的4行:
DROP SYNONYM "PUBLIC"."DUAL";
DROP SYNONYM "PUBLIC"."DBMS_SQL";
DROP SYNONYM "PUBLIC"."DBMS_LOCK";
DROP SYNONYM "PUBLIC"."DBMS_OUTPUT";
现在我不小心使用SYSTEM
用户传递了整个脚本,我不能再对数据库进行修改(创建或删除表)了,我有错误弹出:
An error was encountered performing the requested operation:
ORA-00604: error occurred at recursive SQL level 1
ORA-00942: table or view does not exist
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
Vendor code 604
问题在于,当我尝试这个时,我收到了错误事件:
CREATE OR REPLACE PUBLIC SYNONYM "DUAL" FOR "SYS"."DUAL";
我确切地说SYS.DUAL
表仍然存在,因为SELECT 1 FROM SYS.DUAL
有效但SELECT 1 FROM DUAL
失败并带有ORA-00942: table or view does not exist
。
我尝试将同义词重新设置为SYSTEM
和SYSDBA
并失败。
我可以用其他方式重新创建这些同义词吗?
答案 0 :(得分:2)
尝试使用SYS,但没有doauble引号,即:
CREATE OR REPLACE PUBLIC SYNONYM DUAL FOR SYS.DUAL;
不是
CREATE OR REPLACE PUBLIC SYNONYM "DUAL" FOR "SYS"."DUAL";
据我所知,双引号使对象名称区分大小写。
更新 - 如果您有权访问metalink,那么您将在注释973260.1中找到答案,其中包含触发器触发的内容:
ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=FALSE SCOPE=MEMORY;
CREATE OR REPLACE PUBLIC SYNONYM DUAL FOR SYS.DUAL;
ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=true SCOPE=MEMORY;
该注释表明,如果这不起作用,请查询DBA_TRIGGERS以查找启用BEFORE CREATE触发器,如果发现禁用它,然后重新发出创建同义词语句,则重新启用触发器。