您好,欢迎访问一九零五行业门户网

Oracle PUP(PRODUCT_USER_PROFILE)配置和使用

最近在翻oracle sqlplus官方文档,在讲sqlplus security章节介绍了pup这个机制。借此,我来使用以下:pup(product_user_profile)
最近在翻oracle sqlplus官方文档,在讲sqlplus security章节介绍了pup这个机制。借此,,我来使用以下:
pup(product_user_profile)介绍
  product_user_profile是system账户下一个表,可提供用户级别的安全限制。
  pup设置对dba权限用户无效。
  pup只针对本地数据库生效(local database)。
1、system 用户创建pup:
 sqlplus system
@ d:\app\administrator\product\11.2.0\dbhome_1\sqlplus\admin\pupbld.sql
脚本内容:
drop synonym product_user_profile;
create table sqlplus_product_profile as
  select product, userid, attribute, scope, numeric_value, char_value,
  date_value from product_user_profile;
drop table product_user_profile;
alter table sqlplus_product_profile add (long_value long);
-- create sqlplus_product_profile from scratch
create table sqlplus_product_profile
(
  product        varchar2 (30) not null,
  userid        varchar2 (30),
  attribute      varchar2 (240),
  scope          varchar2 (240),
  numeric_value  decimal (15,2),
  char_value    varchar2 (240),
  date_value    date,
  long_value    long
);
-- remove sql*plus v3 name for sqlplus_product_profile
drop table product_profile;
-- create the view product_privs and grant access to that
drop view product_privs;
create view product_privs as
  select product, userid, attribute, scope,
        numeric_value, char_value, date_value, long_value
  from sqlplus_product_profile
  where userid = 'public' or user like userid;
grant select on product_privs to public;
drop public synonym product_profile;
create public synonym product_profile for system.product_privs;
drop synonym product_user_profile;
create synonym product_user_profile for system.sqlplus_product_profile;
drop public synonym product_user_profile;
create public synonym product_user_profile for system.product_privs;
--禁用hr用户的drop命令
 system@orcl> insert into product_user_profile values('sql*plus', 'hr', 'drop', null, null, 'disabled', null, null);
已创建 1 行。
system@orcl> commit;
提交完成。
2、pup表结构概览
 system@orcl> desc product_user_profile
  名称                                    是否为空? 类型
  ---------------------------------------- -------- ---------------------------
  product                                  not null varchar2(30)
  userid                                            varchar2(30)
  attribute                                        varchar2(240)
  scope                                            varchar2(240)
  numeric_value                                    number(15,2)
  char_value                                        varchar2(240)
  date_value                                        date
  long_value                                        long
--product : 说明要限制的程序
  --userid : 要限制的用户(大写)
  --attribute : 要限制的命令或角色
  --scope : 不适用;放null
  --numeric_value : 不适用;放null
  --char_value :disabled
  --date_value :不适用;放null
  --long_value :不适用;放null
3、hr登录进行drop操作证明设置生效:
 system@orcl> conn hr/hr
 已连接。
hr@orcl> create table t(x int);
表已创建。
hr@orcl> drop table t;
 sp2-0544: 在产品用户概要文件中禁用命令 drop
 hr@orcl> conn system/oracle@orcl
 已连接。
system@orcl> delete from product_user_profile;
已删除 1 行。
system@orcl> commit;
提交完成。
system@orcl> conn hr/hr@orcl
 已连接。
hr@orcl> drop table t;
表已删除。
其它类似信息

推荐信息