Cannot SET AUTOTRACE 处理办法
生活随笔
收集整理的這篇文章主要介紹了
Cannot SET AUTOTRACE 处理办法
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Microsoft Windows [版本 6.1.7601]
版權(quán)所有 (c) 2009 Microsoft Corporation。保留所有權(quán)利。C:\Users\Administrator>sqlplus /nologSQL*Plus: Release 11.2.0.1.0 Production on 星期日 9月 27 13:18:37 2015Copyright (c) 1982, 2010, Oracle. All rights reserved.SQL> connect sys as sysdba
輸入口令:
已連接。
SQL> @?\rdbms\admin\utlxplan表已創(chuàng)建。SQL> create public synonym plan_table for plan_table;
create public synonym plan_table for plan_table*
第 1 行出現(xiàn)錯(cuò)誤:
ORA-00955: 名稱已由現(xiàn)有對(duì)象使用SQL> grant all on plan_table to public;授權(quán)成功。SQL> @?\sqlplus\admin\plustrce
SQL>
SQL> drop role plustrace;
drop role plustrace*
第 1 行出現(xiàn)錯(cuò)誤:
ORA-01919: 角色 'PLUSTRACE' 不存在SQL> create role plustrace;角色已創(chuàng)建。SQL>
SQL> grant select on v_$sesstat to plustrace;授權(quán)成功。SQL> grant select on v_$statname to plustrace;授權(quán)成功。SQL> grant select on v_$mystat to plustrace;授權(quán)成功。SQL> grant plustrace to dba with admin option;授權(quán)成功。SQL>
SQL> set echo off
SQL> grant plustrace to public;授權(quán)成功。SQL> connect aaa/aaa
已連接。
SQL> set autotrace on
SQL> set timing on
SQL> set autotrace traceonly
SQL> select * from info;已選擇6行。已用時(shí)間: 00: 00: 00.03執(zhí)行計(jì)劃
----------------------------------------------------------
Plan hash value: 3267820445-----------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
-----------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 6 | 138 | 3 (0)| 00:00:0
| 1 | TABLE ACCESS FULL| INFO | 6 | 138 | 3 (0)| 00:00:0
-----------------------------------------------------------------------統(tǒng)計(jì)信息
----------------------------------------------------------1 recursive calls0 db block gets8 consistent gets0 physical reads0 redo size863 bytes sent via SQL*Net to client419 bytes received via SQL*Net from client2 SQL*Net roundtrips to/from client0 sorts (memory)0 sorts (disk)6 rows processedSQL>
這個(gè)解析 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
通過(guò)以下方法可以把Autotrace的權(quán)限授予Everyone,如果你需要限制Autotrace權(quán)限,可以把對(duì)public的授權(quán)改為對(duì)特定user的授權(quán)。D:\oracle\ora92>sqlplus /nologSQL*Plus: Release 9.2.0.1.0 - Production on 星期二 6月 3 15:16:03 2003Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> connect sys as sysdba
請(qǐng)輸入口令:
已連接。
SQL> @?\rdbms\admin\utlxplan表已創(chuàng)建。SQL> create public synonym plan_table for plan_table;同義詞已創(chuàng)建。SQL> grant all on plan_table to public ;授權(quán)成功。SQL> @?\sqlplus\admin\plustrce
SQL>
SQL> drop role plustrace;
drop role plustrace
*
ERROR 位于第 1 行:
ORA-01919: 角色'PLUSTRACE'不存在SQL> create role plustrace;角色已創(chuàng)建
SQL>
SQL> grant select on v_$sesstat to plustrace;授權(quán)成功。SQL> grant select on v_$statname to plustrace;授權(quán)成功。SQL> grant select on v_$session to plustrace;授權(quán)成功。SQL> grant plustrace to dba with admin option;授權(quán)成功。SQL>
SQL> set echo off?DBA用戶首先被授予了plustrace角色,然后我們可以把plustrace授予public這樣所有用戶都將擁有plustrace角色的權(quán)限.SQL> grant plustrace to public ;授權(quán)成功。然后我們就可以使用AutoTrace的功能了.SQL> connect eqsp/eqsp
已連接。
SQL> set autotrace on
SQL> set timing on
SQL>?關(guān)于Autotrace幾個(gè)常用選項(xiàng)的說(shuō)明:SET AUTOTRACE OFF ---------------- 不生成AUTOTRACE 報(bào)告,這是缺省模式
SET AUTOTRACE ON EXPLAIN ------ AUTOTRACE只顯示優(yōu)化器執(zhí)行路徑報(bào)告?
SET AUTOTRACE ON STATISTICS -- 只顯示執(zhí)行統(tǒng)計(jì)信息
SET AUTOTRACE ON ----------------- 包含執(zhí)行計(jì)劃和統(tǒng)計(jì)信息?
SET AUTOTRACE TRACEONLY ------ 同set autotrace on,但是不顯示查詢輸出SQL> set autotrace traceonly
SQL> select table_name from user_tables;已選擇98行。已用時(shí)間: 00: 00: 00.04Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 NESTED LOOPS
2 1 NESTED LOOPS (OUTER)
3 2 NESTED LOOPS (OUTER)
4 3 NESTED LOOPS (OUTER)
5 4 NESTED LOOPS (OUTER)
6 5 NESTED LOOPS
7 6 TABLE ACCESS (BY INDEX ROWID) OF 'OBJ$'
8 7 INDEX (RANGE SCAN) OF 'I_OBJ2' (UNIQUE)
9 6 TABLE ACCESS (CLUSTER) OF 'TAB$'
10 9 INDEX (UNIQUE SCAN) OF 'I_OBJ#' (NON-UNIQUE)
11 5 TABLE ACCESS (BY INDEX ROWID) OF 'OBJ$'
12 11 INDEX (UNIQUE SCAN) OF 'I_OBJ1' (UNIQUE)
13 4 INDEX (UNIQUE SCAN) OF 'I_OBJ1' (UNIQUE)
14 3 TABLE ACCESS (CLUSTER) OF 'USER$'
15 14 INDEX (UNIQUE SCAN) OF 'I_USER#' (NON-UNIQUE)
16 2 TABLE ACCESS (CLUSTER) OF 'SEG$'
17 16 INDEX (UNIQUE SCAN) OF 'I_FILE#_BLOCK#' (NON-UNIQUE)
18 1 TABLE ACCESS (CLUSTER) OF 'TS$'
19 18 INDEX (UNIQUE SCAN) OF 'I_TS#' (NON-UNIQUE)Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
1389 consistent gets
0 physical reads
0 redo size
2528 bytes sent via SQL*Net to client
569 bytes received via SQL*Net from client
8 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
98 rows processedSQL>
轉(zhuǎn)載于:https://www.cnblogs.com/kool/p/6695625.html
總結(jié)
以上是生活随笔為你收集整理的Cannot SET AUTOTRACE 处理办法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 动态规划——棋盘
- 下一篇: adult道具项目开发 - 模式