当前位置:网站首页>oracle 创建用户且只有查询权限
oracle 创建用户且只有查询权限
2022-07-28 08:34:00 【申公】
一、创建用户
-- 创建用户
create user USERB identified by "密码" default tablespace 表空间;
--授予登录权限
grant connect to estate_user;
--授予查询任何表权限
grant select any table to userName;
二、授予查看某用户下的所有表或者某个表或视图权限
--在USERA下查询所有表,组成sql
select 'grant select on USERA.' || table_name || ' to USERB;' from user_tables;
--在USERA中执行 grant的sql
grant select on USERA.tableA to USERB;
登录USERB查询表,需要带原创建用户的用户名:例如:
select * from USERA.TABLEA
三、如果不想带原用户名称需要建立同义词
--首先需要sys用户授权USER_B创建同义词权限:
GRANT CREATE SYNONYM TO USERB;
--创建同义词语法:
create synonym USERB.TABLENAME1 for USERA.TABLENAME1 ;
--批量创建同义词,在USERA中执行:
select 'grant select on USERA.' || table_name || ' to USERB;' from user_tables;
--在USERB中执行grant语句。
建完同义词后,pl/sql developer查看表,依然看不到所有表,但是好在能USERB.能点出来所有表:

查看用户下的同义词
SELECT * FROM DBA_SYNONYMS where OWNER = 'USERB';
删除同义词
drop synonym sysn_name;
四、删除用户:
drop user htqryall cascade;
边栏推荐
- 如何在多线程环境下使用 GBase C API ?
- 【JVM】JVM表示浮点数
- Hyperlink label
- Force deduction question (1) -- sum of two numbers
- Do you know the five minute rule and the ten byte rule?
- Deconstruction assignment of ES6 variables
- Code management platform SVN deployment practice
- Promise学习笔记
- A perfect cross compilation environment records the shell scripts generated by PETA
- 【杂谈】程序员的发展最需要两点能力
猜你喜欢

TXT text file storage

478-82(56、128、718、129)

From development to testing: I started from scratch and worked for six years of automated testing

【单细胞高级绘图】07.KEGG富集结果展示

Do you know the five minute rule and the ten byte rule?

【592. 分数加减运算】

Mongodb (compare relational database, cloud database, common command line, tutorial)

Introduction to official account
![Map of China province > City > level > District > Town > village 5-level linkage download [2019 and 2021]](/img/ea/fd799bbef5110fddf4066e76892f81.png)
Map of China province > City > level > District > Town > village 5-level linkage download [2019 and 2021]

How to obtain the subordinate / annotation information of KEGG channel
随机推荐
阿里云服务器搭建和宝塔面板连接
Sword finger offer
Map of China province > City > level > District > Town > village 5-level linkage download [2019 and 2021]
A perfect cross compilation environment records the shell scripts generated by PETA
Kubernetes cluster configuration dashboard service
象棋机器人夹伤7岁男孩手指,软件测试工程师的锅?我笑了。。。
ES6 变量的解构赋值
Different HR labels
js数组去重,id相同对某值相加合并
推荐一个摆脱变量名纠结的神器和批量修改文件名方法
Leetcode 452. minimum number of arrows to burst balloons (medium)
Learn to draw with nature communications -- complex violin drawing
Huid learning 7: Hudi and Flink integration
Overview of head pose estimation
【SwinTransformer源码阅读二】Window Attention和Shifted Window Attention部分
【多线程】long和double的非原子性协定
Feign调用异常[Running, pool size = 10, active threads = 10, queued tasks = 0, completed tasks = n]
How to obtain the subordinate / annotation information of KEGG channel
如何在多线程环境下使用 GBase C API ?
Code management platform SVN deployment practice