Selective System Grants

问题:

我只想授予XX用户alter system set user_dump_dest 权限!

I want to give users the ability to execute "alter system set user_dump_dest" only. I want to give them the ability to turn on extended tracing but write out the trace files to a different directory, such as /tmp, rather than to the default directory. Is there a way to do this easily?

Tom回答:

存储过程是绝佳方案!

Stored procedures are great for this!

存储过程,默认以定义者权限运行。你需要做的就是:

A stored procedure, by default, runs with the base privileges of the definer of the routine. As a user with the ability to use ALTER SYSTEM , all you need to do is

create or replace procedure set_udump (p_udump in varchar2)
as
begin
if ( p_udump NOT LIKE '%=%' )
then
execute immediate 'alter system set
user_dump_dest = '''||p_udump||''' scope=memory';
else
raise_application_error(-20000,'Sorry, but for safety
reasons this procedure does not allow "=" in the parameter value');
end if;
end;
/

防止SQL注入攻击!

Note: Revised content—to prevent SQL injection—for this procedure submitted by Roy Jorgensen.

The owner of the procedure needs to have ALTER SYSTEM granted directly, not via a role. Seeasktom.oracle.com/~tkyte/Misc/RolesAndProcedures.htmlfor details on that nuance. So we run

SQL> grant alter system to a;
Grant succeeded. SQL> grant execute on set_udump to scott;
Grant succeeded.

Now, connected as SCOTT , run

SQL> exec set_udump( '/tmp' );
PL/SQL procedure successfully
completed.

这种途径提供优秀的安全机制。

This approach works for any privilege you want to grant selectively like this. Stored procedures—with their ability to run as definer—provide an excellent security mechanism!

Oracle选择性系统授权的更多相关文章

  1. Oracle用户、授权、角色管理

    创建和删除用户是Oracle用户管理中的常见操作,但这其中隐含了Oracle数据库系统的系统权限与对象权限方面的知识.掌握还Oracle用户的授权操作和原理,可以有效提升我们的工作效率. Oracle ...

  2. [Form Builder]Oracle Form系统变量中文版总结大全

    转:http://yedward.net/?id=57 Form中的系统变量,它存在于一个Form的整个运行时期的会话之中,变量包含了有关Form相关属性的字节信息.有些变量标明了当前状态,还有些变量 ...

  3. Oracle财务系统常用标准报表

    http://erpoperator.blog.163.com/blog/static/17899637220111181121616/ Oracle财务系统常用标准报表 总账系统 系统报表名 中文译 ...

  4. oracle 对系统日期sysdate进行格式化:to_date(sysdate,'yyyy-MM-dd')

      oracle 对系统日期sysdate进行格式化:to_date(sysdate,'yyyy-MM-dd') CreateTime--2018年5月17日10:11:34 Author:Maryd ...

  5. Oracle ERP系统借贷关系表

    Oracle ERP系统借贷关系表 成本核算会计信息归纳 按照事务处理的来源类型归纳. 一. 采购接收入库和退货: 1.接收:   借:材料采购 (订单价格) 贷:应计负债 (订单价格) 2.入库: ...

  6. MySql查询系统时间,SQLServer查询系统时间,Oracle查询系统时间

    转自:https://blog.csdn.net/haleyliu123/article/details/70927668/ MySQL查询系统时间 第一种方法:select current_date ...

  7. Oracle 用户、授权、角色管理

    Oracle 用户管理 一.创建用户的Profile文件SQL> create profile student limit // student为资源文件名FAILED_LOGIN_ATTEMP ...

  8. oracle给用户授权

    1.在PLSQL里,用sys(oracle系统用户)登陆,登陆的时候一定要选择SYSDBA.普通用户登陆选择normal就可以了 2.创建用户 *也可以给普通用户授权为dba即数据库管理员.在导入导出 ...

  9. oracle用户管理, 授权与回收权限

    一. 用户管理参数, 0.删除用户: drop user 用户名 [cascade] 当我们删除用户时, 如改用户已创建过数据对象, 那么删除用户时必须加cascade参数, 用来同步删除 改用户的所 ...

随机推荐

  1. git仓库使用

    1.git命令参数 usage: git [--version] [--help] [-c name=value] [--exec-path[=<path>]] [--html-path] ...

  2. java中远程http文件上传及file2multipartfile

    工作中有时会遇到各种需求,你得变着法儿去解决,当然重要的是在什么场景中去完成. 比如Strut2中file类型如何转换成multipartfile类型,找了几天,发现一个变通的方法记录如下(虽然最后没 ...

  3. html (第四本书第五章参考)

    上机1 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8 ...

  4. 垂直居中Demo

    换行文字垂直居中1 换行文字垂直居中,兼容所有浏览器 换行文字垂直居中2 换行文字垂直居中,兼容所有浏览器 固定宽高图片垂直居中1 固定宽高图片垂直居中2 图片自适应容器宽高垂直居中 CSS3垂直居中 ...

  5. bzoj 2809 可并堆维护子树信息

    对于每个节点,要在其子树中选尽量多的节点,并且节点的权值和小于一个定值. 建立大根堆,每个节点从儿子节点合并,并弹出最大值直到和满足要求. /***************************** ...

  6. Codeforces Round #371 (Div. 1) C. Sonya and Problem Wihtout a Legend 贪心

    C. Sonya and Problem Wihtout a Legend 题目连接: http://codeforces.com/contest/713/problem/C Description ...

  7. consul vs etcd3

    https://sysadmin.libhunt.com/project/etcd/vs/consul

  8. ASP.NET Web Pages 的冲突版本问题

    随着VS版本和.NET MVC版本.EF的版本的不断更新,虽然很多功能随着版本的提升而更完善,但对于旧版本开发的软件就有点悲催了,或许很多开发者都遇到类似的问题! 最近有一个项目是用.NET MVC3 ...

  9. Golang 处理 Json(一):编码

    JSON 是一种数据格式描述语言.以 key 和 value 构成的哈系结构,类似 Javascript 中的对象,python 中的字典.通常 json 格式的 key 是字符串,其值可以是任意类型 ...

  10. 在CentOS 6 的cron/crontab中使用wine运行exe程序

    几个月前服务器的OS从Ubuntu 10.04转为CentOS 6.3,装好wine后手动运行shell脚本可以正常运行指定的exe程序(脚本和Ubuntu中的一样),于是就直接修改crontab定时 ...