简体   繁体   English

重新创建 Oracle DUAL 表

[英]Recreate the Oracle DUAL table

Is there any way to create / recreate dual table in Oracle?有没有办法在 Oracle 中创建/重新创建双表? It was accidentally dropped.它不小心掉了下来。

You should probably contact Oracle Support.您可能应该联系 Oracle 支持。

Do you have a backup?你有备份吗? If so, restore the table from your backup.如果是这样,请从备份中恢复该表。 Otherwise (and if contacting Oracle is not an option for you)...否则(如果您不适合联系 Oracle)...

Oracle has special optimizations for DUAL, but I don't know if there's anything special about the table itself. Oracle对DUAL有特殊的优化,但不知道表本身有没有什么特别之处。 I would just treat it like a normal table and see what happens.我会把它当作一张普通的桌子,看看会发生什么。 Try this:尝试这个:

Connect as SYSDBA and then execute these commands:以 SYSDBA 身份连接,然后执行以下命令:

CREATE TABLE SYS.DUAL
(
  DUMMY  VARCHAR2(1 BYTE)
);

INSERT INTO SYS.DUAL VALUES ( 'X' );

COMMIT;

GRANT SELECT ON SYS.DUAL TO public WITH GRANT OPTION;

CREATE PUBLIC SYNONYM DUAL FOR SYS.DUAL;

And never EVER change ANYTHING in the SYS schema again!永远不要再更改 SYS 模式中的任何内容!

EDIT: Just noticed a duplicate from TODAY: https://stackoverflow.com/questions/2816478/recovering-dual-table-in-oracle - added suggestions here.编辑:刚刚注意到今天的重复: https : //stackoverflow.com/questions/2816478/recovering-dual-table-in-oracle - 在此处添加了建议。

Oracle becomes weird if DUAL is dropped accidentally.如果DUAL被意外丢弃,Oracle 会变得很奇怪。

SQLPlus says SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level. SQLPlus 说SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level. if there's no sys.DUAL or the current user has no privilege to select from it.如果没有sys.DUAL或当前用户无权从中选择。

It feels like oracle determine version-related features according to DUAL .感觉就像 oracle 根据DUAL确定与版本相关的功能。

Dual Table is a dummy table in system tablespace.双表是系统表空间中的虚拟表。 As a user, u dont have right to drop it.作为用户,您无权放弃它。 if you have your own dual table in your schema, u can play around it.如果您的架构中有自己的双表,您可以玩转它。 U can perform dml, drop it, truncate it etc. Even if u drop, u can recreate it again from the same scripts as previous.你可以执行 dml,删除它,截断它等等。即使你删除了,你也可以从与以前相同的脚本中重新创建它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM