Question: today, I want to create a user for the monitoring server I2000 in the current network database, requiring the user's permissions to be consistent with the permissions of an existing user in the database! I have provided my practice here. The method should not be very good. I don't know which hero has a better method. I hope you can give me some advice. Thank you!
Lab:
Requirement: The i2ksnmp permission of the new user must be the same as that of the DBSNMP user that already exists in the database.
1. Create a new user, i2ksnmp
Create user i2ksnmp identified by i2ksnmp;
2. View All system permissions of DBSNMP users
Select privilege from dba_sys_privs where grantee = 'dbsnmp'
Union
Select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee = 'dbsnmp ');
Obtain all system permissions of DBSNMP users as follows:
PRIVILEGE
----------------------------------------
ADVISOR
ANALYZE ANY
ANALYZE ANY DICTIONARY
CREATE JOB
CREATE PROCEDURE
CREATE SESSION
CREATE TABLE
MANAGE ANY QUEUE
SELECT ANY DICTIONARY
UNLIMITED TABLESPACE
3. Grant the preceding permissions to the new user.
For example:
Grant analyze any dictionary to i2ksnmp;
Additional:
Here we simply integrate the above method:
Set feedback off heading off verify off trimspool off
Set pagesize 0 linesize 200
Define user = test ---> here is the new user name
Select 'Grant '| privilege |' to & user; 'from dba_sys_privs where grantee = 'dbsnmp'
Union
Select 'Grant '| privilege |' to & user; 'from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee = 'dbsnmp ');
Then print the copy on the screen and execute it.