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.