Grant:
- The GRAnt command is used to allow another schema access to a privilege.
- GRANT command can be issued not only on TABLE OBJECT, but also on VIEWS, SYNONYMS, SEQUENCES Etc..
- The users are GRANTED at time all four(i.e., INSERT,UPDATE,SELECT) by using ALL.
Syntax:
grant
<privilege1,[privilege2....] on <object name> to <user1>[user2...|
role,PUBLIC...];
Creating Users:
Login as
User : System
Password : manager
Syntax:
Create user <user
name> Identified by <Password>;
Grant connect,resource
to <User Name>;
Ex:
SQL>create user netlojava identified by netlojava;
SQL>grant connect,resource to netlojava;
Login as System:
SQL>grant all on emp to netlojava;
SQL>grant select,insert,delete on dept to netlojava;
Grant Columns:
SQL>grant insert(empno,ename,sal,deptno) on emp to
netlojava;
Note:
Only select,insert on
update permissions are allowed.
SQL>grant select on student to NLO1,NLO2;
SQL>grant delete on employee to public;
Public:
Public keyword
represents all users in database. All users can delete on employee table.
Note:
We cannot give
permission at time on more than one data base objet.
Steps to be Performed:
· connect to the required user using the USER Name
and Password.
· Execute the required SQL statement using the
object hierarchy.
Login as netlojava:
SQL>select * from system.emp;
SQL>insert into System.emp(empno,sal,deptno)
values(1002,2000,10);
SQL>select * from system.student;
Note:
At time DML,DRL
OPERATION we have to mention owners name.
No comments:
Post a Comment