一般用户不能这么做吗?要怎样的权限才行?还说要做什么设置?

解决方案 »

  1.   

    ?
    我用的是pl/sql。在EXPLAIN中是可以的。
    不知道在COMMAND 中还要做些怎么样的操作?比如:建立怎么样的表?做怎么设置?
      

  2.   

    tracetab.sql(oracle自带)!
      

  3.   

    create table plsql_trace_runs
    (
      runid           number primary key,  -- unique run identifier,
                                           -- from plsql_trace_runnumber
      run_date        date,                -- start time of run
      run_owner       varchar2(31),        -- account under which run was made
      run_comment     varchar2(2047),      -- user provided comment for this run
      run_comment1    varchar2(2047),      -- additional user-supplied comment
      run_end         date,                -- termination time for this run
      run_flags       varchar2(2047),      -- flags for this run
      related_run     number,              -- for correlating client/server
      run_system_info varchar2(2047),      -- currently unused
      spare1          varchar2(256)        -- unused
    )ORA-01031: 权限不足
      

  4.   

    Table createdComment addedTable createdComment addedSequence createdSQL> set autotrace traceonly;
    Cannot SET AUTOTRACE?????
    还是这样?
      

  5.   

    Rem    NOTES
    Rem      This script must be run under SYS
    Rem
    Rem      The following tables are required to collect data
    Rem        plsql_trace_runs - information on trace runs
    Rem        plsql_trace_event - detailed trace data
    Rem
    Rem      For security reasons, these tables are created under SYS, and are
    Rem      unique system-wide. The DBA should explicitly grant access to these
    Rem      tables to those users who require it.
    Rem
    Rem      The plsql_trace_runnumber sequence is used for generating unique
    Rem      run numbers.
    没别的办法?
      

  6.   

    ORA-01031: 权限不足
    没有sys权限.
    oracle是这么说的:
    Rem    NOTES
    Rem      This script must be run under SYS
    不用SYS,一般用户,有没有办法?
      

  7.   

    @ ORACLE_HOME\sqlplus\admin\plustrce.sql
    @ ORACLE_HOME\rdbms\admin\utlxplan.sql
    在sqlplus中执行!
    那两个sql可能不在目录下,可以搜一下!
      

  8.   

    @ ORACLE_HOME\sqlplus\admin\plustrce.sql
    运行同样要SYS权限.
    drop role plustrace;drop role plustraceORA-01919: 角色'PLUSTRACE'不存在
    create role plustrace;create role plustraceORA-01031: 权限不足
    grant select on v_$sesstat to plustrace;grant select on v_$sesstat to plustraceORA-00942: 表或视图不存在
    grant select on v_$statname to plustrace;grant select on v_$statname to plustraceORA-00942: 表或视图不存在
    grant select on v_$session to plustrace;grant select on v_$session to plustraceORA-00942: 表或视图不存在
    grant plustrace to dba with admin option;grant plustrace to dba with admin optionORA-01919: 角色'PLUSTRACE'不存在
    set echo off
      

  9.   

    看看这个,我在itpub.net上找的,http://www.itpub.net/131657.html
    先在sys用户下运行@/ORACLE_HOME/sqlplus/admin/plustrce.sql内容:
    set echo on
    drop role plustrace;
    create role plustrace;
    grant select on v_$sesstat to plustrace;
    grant select on v_$statname to plustrace;
    grant select on v_$session to plustrace;
    grant plustrace to dba with admin option;
    set echo off产生plustrace角色,然后在sys用户下把此角色赋予一般用户SQL> grant plustrace to &username;然后找到/ORACLE_HOME/rdbms/admin/utlxplan.sql,然后在当前用户SQL>下运行,它创建一个plan_table,用来存储分析SQL语句的结果。create table PLAN_TABLE (
    statement_id varchar2(30),
    timestamp date,
    res varchar2(80),
    operation varchar2(30),
    options varchar2(30),
    object_node varchar2(128),
    object_owner varchar2(30),
    object_name varchar2(30),
    object_instance numeric,
    object_type varchar2(30),
    optimizer varchar2(255),
    search_columns number,
    id numeric,
    parent_id numeric,
    position numeric,
    cost numeric,
    cardinality numeric,
    bytes numeric,
    other_tag varchar2(255),
    partition_start varchar2(255),
    partition_stop varchar2(255),
    partition_id numeric,
    other long,
    distribution varchar2(30));在SQL/PLUS的窗口运行以下命令
    set time on; (说明:打开时间显示)
    set autotrace on; (说明:打开自动分析统计,并显示SQL语句的运行结果)
    set autotrace traceonly; (说明:打开自动分析统计,不显示SQL语句的运行结果)接下来你就运行测试SQL语句,看到其分析统计结果了。一般来讲,我们的SQL语句应该避免对大表的全表扫描。关闭以上功能,在SQL/PLUS的窗口运行以下命令set time off; (说明:关闭时间显示)
    set autotrace off; (说明:关闭自动分析统计)
      

  10.   

    看来没有SYS权限好像不行,感谢各位的热心帮助。
    留个QQ来着,有时间交流交流。