ITeye博客

oracle 别名

jiangyaning8 · 2011-12-12 16:17 · oracle 别名 · 数据库 · Markdown

在Oracle中,假设用户B(userB)想访用户A(userA)下的表tablet,正常的方法是要用全名:userA.tablet,例如:
select * from userA.tablet;

假设userA是原用户,userB是另一用户,想让userB访问userA.a表。

先以userA登录
  grant   all   on   a   to   userB;

如果用户B想用最简单的方法访问该表,即不带用户名的方式,有两个办法:

1、创建view:
以userB登录
  create view a as select * from userA.a;

2.创建别名
以userB登录
  create   synonym   a   for  userA.a;
  需要给userB授权:grant create synonym to userB;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。