CREATING THE USER:
create user <USERNAME> identified by <PASSWORD>
default tablespace <TABLESPACE NAME>
temporary tablespace <TABLESPAC NAME>
quota 30m on <TABLESPACE NAME>;
Eg:
create user <John> identified by <John>
default tablespace <users>
temporary tablespace <temp>
quota 30m on <users>;
Above command creates a user chandra with password chandra. Consider the tablespace you have in which chandra will store his data is "USERS". The tablespace used for storing temporary segments will be "TEMP" and the amount of space which the user chandra can use on "USERS" tablespace is 30M.
DROPING THE USER:
SQL> DROP USER John CASCADE;
ALTERING/UNLOCKING ACCOUNT:
SQL> alter user john identified by john account unlock;
The above command alters or unlocks the "john" user with password "john".
SQL> select username, account_status, default_tablespace,
temporary_tablespace, profile from dba_users
where username = 'john';
SQL> select * from dba_ts_quotas where username = 'john';
GRANTING AND REVOKING PRIVILEGES:
Syntax:
SQL>GRANT <PRIVILAGE> TO <USERNAME>
SQL>REVOKE <PRIVILAGE> FROM <USERNAME>
Eg:
SQL> GRANT create table to john;
SQL> GRANT create session to john;
SQL> GRANT create any table, create tablespace to john;
SQL> REVOKE create any table from john;
SQL> REVOKE create tablespace from john;
SQL> GRANT select, insert, update, delete on <TABLENAME> to john;
SQL> REVOKE update,delete on USERS.PAY_PAYMENT_MASTER from john;
SQL> GRANT create table to john;
SQL> GRANT create session to john;
SQL> GRANT create any table, create tablespace to john;
SQL> REVOKE create any table from john;
SQL> REVOKE create tablespace from john;
SQL> GRANT select, insert, update, delete on <TABLENAME> to john;
SQL> REVOKE update,delete on USERS.PAY_PAYMENT_MASTER from john;
ROLES:
Creating Roles
| |
Create Role
| |
Create Password Protected Role
| |
Assigning Privileges And Roles To Roles
| |
Assign Privilege To A Role
|
GRANT <privilege_name> TO <role_name>;
|
GRANT create session TO read_only
| |
Create A Role Heirarchy
|
GRANT <role_name> TO <role_name>;
|
Add Another Layer To The Heirarchy
|
GRANT <roles and privileges> TO <role_name>;
|
Assigning Roles
| |
Assigning Roles To Users
|
GRANT <roles_name> TO <user_name>;
|
Revoking Privileges From Roles
| |
Revoke Privilege
| |
Revoking Roles
| |
Revoke a role from a user
| |
Revoke A Role And Drop Any Invalidated Constraints
| |
Activating & Decactivating Roles
| |
Activating A Role
| |
Activating A Password Protected Role
| |
Activating All Roles
| |
Activating All Roles Except One
| |
Deactivating A Role
| |
Deactivating All Roles
| |
Drop Role
| |
Dropping A Role
| |
No comments:
Post a Comment