当前位置:网站首页>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;
边栏推荐
- [English postgraduate entrance examination vocabulary training camp] day 15 - analyze, general, avoid, surveillance, compared
- Completion report of communication software development and Application
- An entry artifact tensorflowplayground
- 【单细胞高级绘图】07.KEGG富集结果展示
- v-bind指令的详细介绍
- 19c SYSAUX表空间SQLOBJ$PLAN表过大,如何清理
- 51单片机存储篇:EEPROM(I2C)
- TXT text file storage
- OpenShift 4 - 使用 VerticalPodAutoscaler 优化应用资源 Request 和 Limit
- Realize batch data enhancement | use of keras imagedatagenerator
猜你喜欢

2022高压电工考试模拟100题及模拟考试

Realize batch data enhancement | use of keras imagedatagenerator

Completion report of communication software development and Application

Review the past and know the new MySQL isolation level

Go waitgroup and defer

Learn to draw with nature communications -- complex violin drawing

opencv4.60版本安装和配置

CSV file storage

Machine learning (11) -- time series analysis

2022年安全员-B证考试模拟100题及答案
随机推荐
A perfect cross compilation environment records the shell scripts generated by PETA
IDC脚本文件运行
Detailed explanation of DHCP distribution address of routing / layer 3 switch [Huawei ENSP]
剑指offer
2022高压电工考试模拟100题及模拟考试
F - Jealous Two-二维逆序对
CSV文件存储
Kubernetes cluster configuration DNS Service
一年涨薪三次背后的秘密
10. Learn MySQL like clause
VR全景拍摄,助力民宿多元化宣传
Introduction to official account
AMQ streams (1) of openshift 4 - multiple consumers receive data from partition
【leetcode周赛总结】LeetCode第 83场双周赛(7.23)
mysql5.7.38容器里启动keepalived
力扣题(1)—— 两数之和
【592. 分数加减运算】
Sword finger offer
c语言数组指针和指针数组辨析,浅析内存泄漏
Setting of parameter configuration tool for wireless vibrating wire collector