Home > database >  How to allow a user to access another user's data?
How to allow a user to access another user's data?

Time:09-19

Please comment, the command
The CREATE USER usr01 IDENTIFIED BY XXXXXXX DEFAULT in TABLESPACE DATA01... ;
Create a user usr01
Now want to create another user, he can only in the form of read-only access usr01 data, how should do?

CodePudding user response:

The object of another user select permission to give it, you can use dynamic SQL

CodePudding user response:

Using U1 login

Grant select on mytable to U2

Login with U2

Select * from U1. Mytable

CodePudding user response:

Currently logged in user must have access rights to the user1 table table1, after can be treated as "a user" under the table to complete across user query,
If there is no authority, need to login to user1 to table1 user2 authorization table query access: grant select on table1 user2), Can complete permissions set,

CodePudding user response:

A command can be: user1 user query access all of the tables, a one-time authorization for user2? Feel a table a table authorization efficiency is very low

CodePudding user response:

Grant select on all_tables to user;

CodePudding user response:

Declare
V_names varchar2 (50);
The begin
For v_names in (select table_name from all_tables)
Loop
The execute imm... (forget) 'grant select on' | | v_names | | 'to the user';
end loop;
end;

Dynamic SQL implementation

CodePudding user response:

Authorized to grant select on the table to the user

CodePudding user response:

Yes, grant permission to go,

CodePudding user response:

Put this user object FuQuan bring another user to a user name to access, if build the synonyms, can not take the user name,
  • Related