oracle学习记录之授权

oracle学习记录,表上查询、执行存储过程的授权,grant语句的使用,供参考。

--以sys用户连接数据库,密码oracle
connect sys/oracle as sysdba;
--创建test1用户,密码123
create user test1 identified by 123;
--建立测试表a
create table a(a number(10), b varchar2(20));
--把查询a表的权限授給test1
grant select on a to test1;
--建立测试存储过程spAdd
create procedure spAdd (aa in number, bb in varchar2)
as
    begin
    insert into a values(aa, bb);
    commit;
end;
/
--sys执行存储过程
execute spAdd(123, 'aaa');
--把执行存储过程的权限授給test1
grant execute on spAdd to test1;
--把create session权限授给test1
grant create session to test1;
--以test1用户连接数据库
connect test1/123;
--以test1用户执行sys的spAdd存储过程
execute sys.spAdd(124, 'bbb');
--以test1用户查询sys的a表
select * from sys.a;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值