Schema permission giving on all tables in Oracle [duplicate] - oracle

This question already has answers here:
Grant Select on all Tables Owned By Specific User
(5 answers)
Closed 5 years ago.
I am trying to give schema permissions on all tables in a single instance.
For example, I am in Schema A, and I need to access the tables in Schema A from Schema B.
I tried to grant select on A. * to B and I am getting an invalid table name.
Any idea why I'm getting this error?

Afaik, there's not a direct way to do this. The easiest shortcut I know is to run something like
select 'grant select on A.' || table_name || ' to B;'
from user_tables;
And then copy/paste the results and run that.

Related

Oracle: How to give all privileges of one user to another? [duplicate]

This question already has answers here:
How to replicate schema with the same privileges of an existing account in oracle?
(2 answers)
Closed 10 months ago.
I have 2 user A and B. They all have some privileges of their own.
Now, i want to give all A's privileges to B.
Is there any way (instantly,...) to do that but write a script to give that grant for each user (by select from USER_SYS_PRIVS - i mean when i have a lot of privileges, it seems impossible to be done!?)?
Thanks in advance!
You can try something like this:
Get all privileges from AAA
SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT','AAA') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT','AAA') FROM DUAL;
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT','AAA') FROM DUAL;
Change the DDL commands with the user 'BBB' and execute.
Or
expdp userid=system directory=DATA_PUMP_DIR dumpfile=AAA.dmp schemas=AAA
impdp userid=system directory=DATA_PUMP_DIR dumpfile=AAA.dmp

Why trigger name is showing some object name [duplicate]

This question already has answers here:
How to delete trigger in oracle that contain special character?
(1 answer)
What are the BIN$... tables in Oracle's ALL_TAB_COLUMNS table?
(1 answer)
How to remove a strange table named "BIN$c+eOnMB3RbKSEfg/rsxtAQ==$0" from oracle database?
(1 answer)
Closed 3 years ago.
I have some trigger in a table but the trigger name is showing some object name instead of original trigger name:
select * from user_triggers where table_name='NVT_VEHICLE';
Trigger name:
BIN$j1ygh/CFFDXgVWVB5LsGMg==$1
BIN$j1ygh/CEFDXgVWVB5LsGMg==$1
NVT_LOG_TRIG
These weird names are the name of the objects which are dropped by the user. You can get the original names of the objects from a table: USER_RECYCLEBIN
USER_RECYCLEBIN displays information about the recycle bin owned by the current user.
It contains ORIGINAL_NAME and OBJECT_NAME of the recycled objects.
In your case, you can try this query
SELECT
*
FROM
USER_RECYCLEBIN
WHERE
NAME IN (
'BIN$j1ygh/CFFDXgVWVB5LsGMg==$1',
'BIN$j1ygh/CEFDXgVWVB5LsGMg==$1'
);
Cheers!!

Privileges given to an Oracle procedure [duplicate]

This question already has an answer here:
How can i see if an owner has permissions to execute a Store Procedure in Oracle
(1 answer)
Closed 3 years ago.
For a business need, I've tried to get the list of (users, roles, ..) whom have a privileges (execute, debug, ...) on an Oracle procedure on an Oracle database.
Firstly, I've tried to check its script creation but they didn't exist.
Now I want to get the query which can retreive me this information.
Simply, this query can be executed to get the needed result:
SELECT * FROM DBA_TAB_PRIVS
WHERE OWNER = 'OFFER'
and table_name ='PROC_NAME';
A procedure itself doesn't have any "privileges"; they are granted to user or to role.
The only privilege granted on a procedure is EXECUTE.

Oracle Metadata - How can I get table create date? [duplicate]

This question already has answers here:
How to find out when a particular table was created in Oracle?
(5 answers)
Closed 6 years ago.
Is there any Oracle metadata table that show me the created date from a specific table?
Try this:
select object_name, created
from user_objects
where object_type = 'TABLE'
and object_name = '...'
You can user all_objects or dba_objects instead of user_objects, depending on your privileges and on the users you are interested in

how to grant user privilege on specific schema? [duplicate]

This question already has answers here:
Grant Select on all Tables Owned By Specific User
(5 answers)
Closed 5 years ago.
The situation is I have two schemas: A and B. I have a restricted user that I need to give a privilege do SELECT queries in B schema and just it. How can I grant this user?
You can't.
The best you can do is grant user a 'select' privilege each table in schema b.
this query will generate the commands you'll need:
select 'grant select on A.'||table_name||' to B;'
from dba_Tables
where owner = 'A';
The problem with this, is in the case you will want to add new table to A. then you'll have to grant the privilege on it separately. it will not do it automatically..
You may find you do not have access to dba_tables,
The following block of code run in the owning schema (a) will grant permissions to all tables, to the user b
BEGIN
FOR t IN (SELECT * FROM user_tables)
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || t.table_name || ' TO b';
END LOOP;
END;

Resources