服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > 数据库技术 > Oracle技术 > Oracle开发 > 查看文档

用一个实例讲解如何生成autotrace权限

【赛迪网-it技术报道】生成autotrace权限的示例:

一、配置autotrace

1、cd [oracle_home]/rdbms/admin;

2、以system用户登陆;

3、执行@utlxplan;

4、执行create public synonym plan_table for plan_table;

5、执行 grant all on plan_table to public;

二、创建plustrace角色

1、cd [oracle_home]/sqlplus/admin;

2、以sys或sysdba登陆;

3、运行@plustrce;

4、执行grant plustrace to public;

注:也可以将public指定为某个用户。

[oracle@olivenan oracle]$ cd $oracle_home/rdbms/admin/

[oracle@olivenan admin]$ sqlplus system/oracle

sql*plus: release 9.2.0.4.0 - production on wed jun 27 11:00:20 2007

copyright (c) 1982, 2002, oracle corporation. all rights reserved.

connected to:

oracle9i enterprise edition release 9.2.0.4.0 - production

with the partitioning, olap and oracle data mining options

jserver release 9.2.0.4.0 - production

sql> @utlxplan

table created.

sql> create public synonym plan_table for plan_table;

synonym created.

sql> grant all on plan_table to public;

grant succeeded.

sql> exit

disconnected from oracle9i enterprise edition release 9.2.0.4.0 - production

with the partitioning, olap and oracle data mining options

jserver release 9.2.0.4.0 - production

[oracle@olivenan admin]$ cd $oracle_home/sqlplus/admin

[oracle@olivenan admin]$ sysplus "/as sysdba"

-bash: sysplus: command not found

[oracle@olivenan admin]$ sqlplus "/as sysdba"

sql*plus: release 9.2.0.4.0 - production on wed jun 27 11:04:55 2007

copyright (c) 1982, 2002, oracle corporation. all rights reserved.

connected to:

oracle9i enterprise edition release 9.2.0.4.0 - production

with the partitioning, olap and oracle data mining options

jserver release 9.2.0.4.0 - production

sql> @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 public;

grant succeeded.

sql>

至此,执行成功。

扫描关注微信公众号