创建一个test用户并在test用户下创建test1表并插入数据,然后将test1表的查询权限授予test2用户
1.创建test用户并赋予权限
[https://mp.csdn.net/mp_blog/creation/success/134442503]
2.在test用户下创建test1表并插入数据
SQL> create table test1(
2 id number(10),
3 subject varchar2(10),
4 score number(3));
Table created.
SQL>insert into test1(id,subject,score) values (1002,'math',97);
SQL>insert into test1(id,subject,score) values (1003,'math',99);
SQL> select * from test1;
ID SUBJECT SCORE
---------- ---------- ----------
1002 math 97
1003 math 99
2.创建test2用户并赋予连接数据库权限
SQL> create user test2 identified by 123456;
SQL> grant connect to test2;
3.将test用户查询表权限赋予test2用户
SQL> select 'grant select on' || table_name || 'to test2;' from user_tables;
SQL> grant select on test.test1 to test2;
SQL> conn test2/123456
SQL> select * from test.test1;