Oracle创建用户并给用户授权查询指定表或视图的权限

  • Post author:
  • Post category:其他




DNINMSV31

账户登录数据库进行如下操作:

CREATE USER

NORTHBOUND

IDENTIFIED BY

NORTHBOUND


DEFAULT TABLESPACE “TBS_DNINMSV31”

TEMPORARY TABLESPACE “TEMP2”

QUOTA UNLIMITED ON “TBS_DNINMSV31”;

GRANT ”

CONNECT

” TO

NORTHBOUN

D;

ALTER USER

NORTHBOUND

DEFAULT ROLE NONE;

GRANT CREATE

SESSION

TO

NORTHBOUND

;

GRANT SELECT ON ”

DNINMSV31

“.”V_DNDEVICE” TO

NORTHBOUND

;

GRANT SELECT ON ”

DNINMSV31

“.”V_DNSUBNE” TO

NORTHBOUND

;

GRANT SELECT ON ”

DNINMSV31

“.”V_DNPACKAGE” TO

NORTHBOUND

;

GRANT SELECT ON ”

DNINMSV31

“.”V_DNPORT” TO

NORTHBOUND

;

【注】:在用NORTHBOUND登录后查询的时候要在视图前加上

DNINMSV31

,否则会报表或视图不存在。

例如:

select * from

DNINMSV31

.V_DNDEVICE;

–可以正常执行

select * from

DNINMSV31

.TB_DEVICE where rownum<5;

–执行的时候会报表或视图不存在







创建同义词供对方公司系统访问:



CREATE

SYNONYM










V_DNDEVICE


FOR




DNINMSV31


.


V_DNDEVICE



;


CREATE

SYNONYM





V_DNSUBNE




FOR




DNINMSV31


.


V_DNSUBNE



;


CREATE

SYNONYM





V_DNPACKAGE