Oracle user permission-new user permission inherits permissions of another user

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.