二.解决办法
2.1 登录到sys用户,找到$ORACLE_HOME/SQLPLUS/ADMIN/plustrce.sql,执行之
> sqlplus / as sysdba> @$ORACLE_HOME/SQLPLUS/ADMIN/PLUSTRCE.SQL2.2 我们打开plustrce.sql看看里面是个什么鬼
-- -- Copyright (c) Oracle Corporation 1995, 2002. All Rights Reserved. -- -- NAME -- plustrce.sql -- -- DESCRIPTION -- Creates a role with access to Dynamic Performance Tables -- for the SQL*Plus SET AUTOTRACE ... STATISTICS command. -- After this script has been run, each user requiring access to -- the AUTOTRACE feature should be granted the PLUSTRACE role by -- the DBA. -- -- USAGE -- sqlplus "sys/knl_test7 as sysdba" @plustrce -- -- Catalog.sql must have been run before this file is run. -- This file must be run while connected to a DBA schema. 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_$mystat to plustrace; grant plustrace to dba with admin option; set echo off我们创建plustrace这个角色目的很明确了:
我们在SQL*PLUS上用SET AUTOTRACE ... STATISTICS的时候是通过plustrace这个角色来获取动态性能表信息的。当每一个用户要求使用该命令的时候会自动被DBA用户授予plustrace角色的权限。
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。