|Granting : CONNECT OR CREATE SESSION|
|Create a User and Grant the Create Session System Privilege
A newly created user cannot connect to the database until granted the CREATE SESSION system privilege.
CREATE USER jward
IDENTIFIED BY AZ7BC2
DEFAULT TABLESPACE data_ts
QUOTA 100M ON test_ts
QUOTA 500K ON data_ts
TEMPORARY TABLESPACE temp_ts
GRANT create session TO jward;
|row : 2|
|Granting System Privileges and Roles
You can grant system privileges and roles to other users and roles using the GRANT statement. The following privileges are required:
To grant a system privilege, you must have been granted the system privilege with the ADMIN OPTION or have been granted the GRANT ANY PRIVILEGE system privilege.
To grant a role, you must have been granted the role with the ADMIN OPTION or have been granted the GRANT ANY ROLE system privilege.
The following statement grants the system privilege CREATE SESSION and the accts_pay role to the user jward:
GRANT CREATE SESSION, accts_pay TO jward;
|Creating a New User with the GRANT Statement
Oracle enables you to create a new user with the GRANT statement. If you specify a password using the IDENTIFIED BY clause, and the user name/password does not exist in the database, then a new user with that user name and password is created. The following example creates ssmith as a new user while granting ssmith the CONNECT system privilege:
GRANT CONNECT TO smith IDENTIFIED BY p1q2r3;
|GRANT CONNECT VS. CREATE SESSION IN ORACLE
CONNECT is a role.
The CONNECT role was introduced with Oracle 7, which had following privileges :
Roles --------- Actions ----------------------------------- Create session alter session Create synonyms Create cluster Create Table Create Database Link Create View Create Sequence-----