Oracle Learning (16) users, roles, and permissions

Source: Internet
Author: User

First, users

1, the use of SQL to create the user's syntax format is as follows:

    Create user user_name--username/  
    [identified by password | externally | Globally as ' external_name ']--how to authenticate the user

, the authentication party There are 3 types: password, external and global,  
    --the password represents the use of the password provided by the user to authenticate, external representation of the use of Third-party programs to verify, such as

the operation of the system's login password, the global refers to when there is more than one data,  
    -to build a global user, Other databases are validated by this user and require keyword by*/only when using a password  
    [default tablespace tablespace_name]--Specify the user's defaults table space/  
    [temporary Tablespace Tablespace_name]--Specify the user's temporary tablespace/  
    [Quota integer K | integer M | Unlimited on Tablespace_name]--the maximum size that can be allocated in the specified table space

Space * *  
    [Profile Profile_name]--Specify profiles */  
    [default role RoleName,.. n | All[except rolename,... N] | None]--Specifies a user-owned role that defaults to assign

one or more default-roles to the user, All[except role is to assign  
    all roles or roles other than certain roles to the user, none to

specify no roles * *  
    [password expire]--means to invalidate the password, which will force the user to replace the password at the first login to the database/  
    [account Lock | unlock]--The accounts are locked or not.  
Sample code:  
    Create user Hello identified by the world password expire;

2, the use of SQL to modify the user's syntax format is as follows:

Alter user user_name  
identified by password | externally | Globally as ' external_name '
[default Tablespace TABLESP Ace_name]  
[temporary tablespace tablespace_name]  
[Quota integer K | integer M | unlimited on tablespace_name]
  
   [profile profile_name]  
[Default role RoleName | all[except rolename] | none]  
[password expire]  
[account Lock | Unlock]  
example code:  
alter user Hello identified by HelloWorld;
  

3, the use of SQL commands to delete the user's syntax format is as follows:

Drop user user_name [cascade]; --Using Cascade will remove the user-owned objects together with the * *  
example code:  
drop user Hello cascade;

Second, the role

1. The syntax format for creating roles using SQL statements is as follows:

Create role Role_name  
[not identified]  
[identified by password | externally | globally]

Sample code

Create role Hello;

2, the use of SQL statements to modify the role of the syntax format is as follows:

Alter role Role_name  
[not identified]  
[identified by password | externally | globally]

3, the use of SQL statements to remove the role of the syntax format is as follows

Drop role Role_name

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.