Example of oracle user creation/deletion (oracle user deletion commands and authorization)

Source: Internet
Author: User

1. Oracle users added
Copy codeThe Code is as follows:
Create user lisi identified by lisi;

Note: create user is the database user created, followed by the user name, and identified by is the user password set

2. Grant the "connection" database permission to the newly added user lisi.
Copy codeThe Code is as follows:
Grant connect to lisi;

Note: grant: keyword for Oracle Database authorization
Connect: a default role of the Oracle database. It only has the permission to connect to the database.

3. Authorize the table of scott user to the lisi user
Copy codeThe Code is as follows:
Grant select on emp to lisi;

Problems in pl/SQL: dynamic execution tables are not accessible, and automatic statistics on this session are disabled. You can disable statistics in the execution menu, or obtain the selection permission in the v $ session, v $ sesstat, and v $ statname tables.
Solution:
Copy codeThe Code is as follows:
Grant select on v _ $ session to user name;
Grant select on v _ $ sesstat to user name;
Grant select on v _ $ statname to user name;

4. Revoke User Permissions
Copy codeThe Code is as follows:
Revoke select on emp from lisi;

5. User Password Modification
Log On with the lisi account
Copy codeThe Code is as follows:
Alter user lisi identified by password;

6. delete a user
Drop user Username;
Or drop user Username cascade; (this will delete the table associated with the user)

7. Database permissions and Roles
① Check the permissions of database users
Copy codeThe Code is as follows:
Select * from session_privs;

Note: session_privs is a dictionary table of the Oracle database. The dictionary table is actually an internal table of Oracle (it already exists without being created ). This table shows many permissions, such as creating a table.

② View roles owned by database users
Copy codeThe Code is as follows:
Select * from user_role_privs;

③ Check the permissions of the connect role (which can be executed by DBA)
Copy codeThe Code is as follows:
Select * from dba_sys_privs where grantee = 'connection ';

Note: The database has many permissions and roles. Due to limited energy, you only need to remember three roles, that is, the CONNECT, RESOURCE, and DBA roles.
When creating a database for a developer, you should grant both the connect and resource roles to the developer at the same time.

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.