如何重新创建 public 同义词 "DUAL"?
How to recreate public synonym "DUAL"?
使用 SQLDeveloper 4.0.1.14 创建导出脚本(单独的文件并检查 "drops"),它在 DROP.sql
:
中生成了那 4 行等
DROP SYNONYM "PUBLIC"."DUAL";
DROP SYNONYM "PUBLIC"."DBMS_SQL";
DROP SYNONYM "PUBLIC"."DBMS_LOCK";
DROP SYNONYM "PUBLIC"."DBMS_OUTPUT";
现在我不小心使用 SYSTEM
用户传递了整个脚本,我不能再对数据库进行修改(创建或删除 tables),我弹出错误:
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
table 仍然存在,因为 SELECT 1 FROM SYS.DUAL
有效,但 SELECT 1 FROM DUAL
失败 ORA-00942: table or view does not exist
。
我尝试将同义词重新创建为 SYSTEM
和 SYSDBA
,但同样失败。
我可以用其他方式重新创建这些同义词吗?
尝试使用 SYS,但不要使用双引号,即:
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 触发器,如果发现禁用它,然后重新发出创建同义词语句,然后重新启用触发器。
使用 SQLDeveloper 4.0.1.14 创建导出脚本(单独的文件并检查 "drops"),它在 DROP.sql
:
DROP SYNONYM "PUBLIC"."DUAL";
DROP SYNONYM "PUBLIC"."DBMS_SQL";
DROP SYNONYM "PUBLIC"."DBMS_LOCK";
DROP SYNONYM "PUBLIC"."DBMS_OUTPUT";
现在我不小心使用 SYSTEM
用户传递了整个脚本,我不能再对数据库进行修改(创建或删除 tables),我弹出错误:
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
table 仍然存在,因为 SELECT 1 FROM SYS.DUAL
有效,但 SELECT 1 FROM DUAL
失败 ORA-00942: table or view does not exist
。
我尝试将同义词重新创建为 SYSTEM
和 SYSDBA
,但同样失败。
我可以用其他方式重新创建这些同义词吗?
尝试使用 SYS,但不要使用双引号,即:
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 触发器,如果发现禁用它,然后重新发出创建同义词语句,然后重新启用触发器。