- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-3-23 14:30:10
ODM TEST:
SQL> select * from v$VERSION;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> select object_name,object_type,owner from dba_objects where object_name='PLAN_TABLE';
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE OWNER
------------------- ------------------------------
PLAN_TABLE
SYNONYM PUBLIC
SQL> col object_name for a30
SQL> set linesize 200 pagesize 1400
SQL> select object_name,object_type,owner from dba_objects where object_name='PLAN_TABLE';
OBJECT_NAME OBJECT_TYPE OWNER
------------------------------ ------------------- ------------------------------
PLAN_TABLE SYNONYM PUBLIC
SQL>
SQL> select * from dba_synonyms where synonym_name='PLAN_TABLE';
OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME
------------------------------ ------------------------------ ------------------------------ ------------------------------
DB_LINK
--------------------------------------------------------------------------------------------------------------------------------
PUBLIC PLAN_TABLE SYS PLAN_TABLE$
SQL> drop public synonym plan_table;
Synonym dropped.
SQL> set autotrace traceonly exp;
SQL> select * from dual;
ERROR:
ORA-00942: table or view does not exist
SP2-0612: Error generating AUTOTRACE EXPLAIN report
SQL> create public synonym PLAN_TABLE FOR PLAN_TABLE$;
Synonym created.
SQL> set autotrace traceonly exp;
SQL> select * from dual;
Execution Plan
----------------------------------------------------------
Plan hash value: 272002086
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------
在11.2中
PLAN_TABLE是 PLAN_TABLE$的同义词, PLAN_TABLE$是全局的临时表, 不清楚你是怎么drop plan_table的
-- Create table
create global temporary table PLAN_TABLE$
(
STATEMENT_ID VARCHAR2(30),
PLAN_ID NUMBER,
TIMESTAMP DATE,
REMARKS VARCHAR2(4000),
OPERATION VARCHAR2(30),
OPTIONS VARCHAR2(255),
OBJECT_NODE VARCHAR2(128),
OBJECT_OWNER VARCHAR2(30),
OBJECT_NAME VARCHAR2(30),
OBJECT_ALIAS VARCHAR2(65),
OBJECT_INSTANCE INTEGER,
OBJECT_TYPE VARCHAR2(30),
OPTIMIZER VARCHAR2(255),
SEARCH_COLUMNS NUMBER,
ID INTEGER,
PARENT_ID INTEGER,
DEPTH INTEGER,
POSITION INTEGER,
COST INTEGER,
CARDINALITY INTEGER,
BYTES INTEGER,
OTHER_TAG VARCHAR2(255),
PARTITION_START VARCHAR2(255),
PARTITION_STOP VARCHAR2(255),
PARTITION_ID INTEGER,
OTHER LONG,
OTHER_XML CLOB,
DISTRIBUTION VARCHAR2(30),
CPU_COST INTEGER,
IO_COST INTEGER,
TEMP_SPACE INTEGER,
ACCESS_PREDICATES VARCHAR2(4000),
FILTER_PREDICATES VARCHAR2(4000),
PROJECTION VARCHAR2(4000),
TIME INTEGER,
QBLOCK_NAME VARCHAR2(30)
)
on commit preserve rows;
-- Grant/Revoke object privileges
grant select, insert, update, delete on PLAN_TABLE$ to PUBLIC; |
|