当前位置:网站首页>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;
边栏推荐
- Kubernetes data persistence scheme
- App加速读取显示IPFS图片的解决方案和实现
- 01-TensorFlow计算模型(一)——计算图
- The new mode of 3D panoramic display has become the key to breaking the game
- mysql主从架构 ,主库挂掉重启后,从库怎么自动连接主库
- Bluetooth technology | it is reported that apple, meta and other manufacturers will promote new wearable devices, and Bluetooth will help the development of intelligent wearable devices
- Hou Jie STL standard library and generic programming
- Review the past and know the new MySQL isolation level
- 力扣题(1)—— 两数之和
- 推荐一个摆脱变量名纠结的神器和批量修改文件名方法
猜你喜欢

What are the main uses of digital factory management system

Introduction to official account

Modify virtual machine IP address

Huid learning 7: Hudi and Flink integration

一年涨薪三次背后的秘密

Sentinel

【SwinTransformer源码阅读二】Window Attention和Shifted Window Attention部分
![[592. Fraction addition and subtraction]](/img/3a/1a76a8acd60a6d45eebed612fd3971.png)
[592. Fraction addition and subtraction]

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

Bluetooth technology | it is reported that apple, meta and other manufacturers will promote new wearable devices, and Bluetooth will help the development of intelligent wearable devices
随机推荐
Review the past and know the new MySQL isolation level
mysql5.7.38容器里启动keepalived
如何在多线程环境下使用 GBase C API ?
CSV文件存储
10. Learn MySQL like clause
【leetcode周赛总结】LeetCode第 83场双周赛(7.23)
3D全景展示新模式,成为破局的关键
CSV file storage
(IROS 2022) 基于事件相机的单目视觉惯性里程计 / Event-based Monocular Visual Inertial Odometry
ES查询索引字段的分词结果
App加速读取显示IPFS图片的解决方案和实现
In addition to exporting the incremental data captured by Oracle golden gate to Oracle, where can it be exported? Can be similar
2022高压电工考试模拟100题及模拟考试
Machine learning: self paced and fine tuning
Huid learning 7: Hudi and Flink integration
Feign调用异常[Running, pool size = 10, active threads = 10, queued tasks = 0, completed tasks = n]
VS2015使用dumpbin 查看库的导出函数符号
1.5 merge\rebase\revert\stash\branch
1.5 merge\rebase\revert\stash\branch
OpenShift 4 - 使用 VerticalPodAutoscaler 优化应用资源 Request 和 Limit