我们要利用这张表来限制SCOTT用户不能执行DROP命令,即使SCOTT用户拥有DROP TABLE的权限。
SQL> insert into product_user_profile (
2 product, userid, attribute, char_value)
3 values (
4 'SQL*Plus','SCOT%','DROP','DISABLED');
1 row inserted
Executed in 0.01 seconds
SQL> commit;
Commit complete
Executed in 0 seconds
然后退出SYSTEM用户,用SCOTT用户登录,作个测试:
SQL> create table t_test_profile(
2 id number);
Table created.
Elapsed: 00:00:00.10
SQL> drop table t_test_profle;
SP2-0544: invalid command: drop
这就是product_user_profile的作用,回顾一下:
1。如果我们把DROP改成CREATE或者UPDATE那么就对用户禁止了这些命令。
2。从上面的insert语句,我们可以看到对于用户的限制支持通配符,所有以SCOT开头的用户都不能执行指定的命令。
3。修改了product_user_profile内容,用户必须重新登录SQL*Plus,修改才会生效,也就是只有在登录的时候,SQL*Plus才会检查一遍product_user_profile表中的内容。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8541256/viewspace-663768/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8541256/viewspace-663768/