ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 给普通用户赋autotrace权限

给普通用户赋autotrace权限

原创 Linux操作系统 作者:hock57 时间:2011-05-28 18:13:07 0 删除 编辑
问题:
    SQL> set autotrace on
    Cannot SET AUTOTRACE

解决方法:
[oracle@localhost admin]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Sat May 28 18:06:12 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> @?/rdbms/admin/utlxplan

Table created.

SQL> grant all on plan_table to public;

Grant succeeded.

SQL> @?/sqlplus/admin/plustrce 
SQL> 
SQL> drop role plustrace;
drop role plustrace
          *
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist


SQL> create role plustrace;

Role created.

SQL> 
SQL> grant select on v_$sesstat to plustrace;

Grant succeeded.

SQL> grant select on v_$statname to plustrace;

Grant succeeded.

SQL> grant select on v_$mystat to plustrace;

Grant succeeded.

SQL> grant plustrace to dba with admin option;

Grant succeeded.

SQL> 
SQL> set echo off
SQL> grant plustrace to scott;

Grant succeeded.

SQL> conn scott/tiger;
Connected.
SQL> set autotrace traceonly
SQL> select * from emp;

14 rows selected.


Execution Plan
----------------------------------------------------------
Plan hash value: 3956160932

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |    14 |  1218 |     3   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| EMP  |    14 |  1218 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
       1001  recursive calls
          0  db block gets
        165  consistent gets
          8  physical reads
          0  redo size
       1415  bytes sent via SQL*Net to client
        385  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          9  sorts (memory)
          0  sorts (disk)
         14  rows processed

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16817148/viewspace-696520/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2010-07-06

  • 博文量
    4
  • 访问量
    7672