Sie sind auf Seite 1von 8

Spool Generated For Class of Oracle By Satish K Yellanki

SQL> cl scr
SQL> SET VERIFY OFF
SQL> cl scr
SQL> SET SQLPROMPT SCOTT
SCOTTSET SQLPROMPT SCOTT>
SCOTT>cl scr
SCOTT>CREATE USER DBASEC
2
IDENTIFIED BY DBASEC;
IDENTIFIED BY DBASEC
*
ERROR at line 2:
ORA-01031: insufficient privileges

SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>cl scr

Empno FORMAT 9999


MGR FORMAT 9999
Sal FORMAT 9999
Comm FORMAT 9999
Deptno FORMAT 99

SCOTT>SELECT * FROM Emp;


EMPNO
----7839
7698
7782
7566
7654
7499
7844
7900
7521
7902
7369

ENAME
---------KING
BLAKE
CLARK
JONES
MARTIN
ALLEN
TURNER
JAMES
WARD
FORD
SMITH

JOB
MGR HIREDATE
SAL COMM DEPTNO
--------- ----- --------- ----- ----- -----PRESIDENT
17-NOV-81 5000
10
MANAGER
7839 01-MAY-81 2850
30
MANAGER
7839 09-JUN-81 2450
10
MANAGER
7839 02-APR-81 2975
20
SALESMAN
7698 28-SEP-81 1250 1400
30
SALESMAN
7698 20-FEB-81 1600
300
30
SALESMAN
7698 08-SEP-81 1500
0
30
CLERK
7698 03-DEC-81
950
30
SALESMAN
7698 22-FEB-81 1250
500
30
ANALYST
7566 03-DEC-81 3000
20
CLERK
7902 17-DEC-80
800
20

EMPNO
----7788
7876
7934

ENAME
---------SCOTT
ADAMS
MILLER

JOB
MGR HIREDATE
SAL COMM DEPTNO
--------- ----- --------- ----- ----- -----ANALYST
7566 09-DEC-82 3000
20
CLERK
7788 12-JAN-83 1100
20
CLERK
7782 23-JAN-82 1300
10

14 rows selected.
SCOTT>GRANT SELECT
2
ON Emp
3
TO DBASEC;
Grant succeeded.
SCOTT>SPOOL OFF
SQL> SET SQLPROMPT SCOTT>
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

SCOTT>cl scr
SCOTT>DESC USER_TAB_PRIVS_MADE
Name
----------------------------------------GRANTEE
TABLE_NAME
GRANTOR
PRIVILEGE
GRANTABLE
HIERARCHY

Null?
-------NOT NULL
NOT NULL
NOT NULL
NOT NULL

Type
---------------------------VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(40)
VARCHAR2(3)
VARCHAR2(3)

SCOTT>COLUMN GRANTEE FORMAT A15


SCOTT>COLUMN "Table" FORMAT A15
SCOTT>COLUMN GRANTOR FORMAT A15
SCOTT>COLUMN PRIVILEGE FORMAT A15
SCOTT>SELECT
2
GRANTEE,
3
TABLE_NAME "Table",
4
GRANTOR,
5
PRIVILEGE
6 FROM USER_TAB_PRIVS_MADE;
no rows selected
SCOTT>
SCOTT>cl scr
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>COLUMN
SCOTT>cl scr

Empno FORMAT 9999


Sal FORMAT 9999
Comm FORMAT 9999
MGR FORMAT 9999
Deptno FORMAT 99

SCOTT>SELECT * FROM Emp;


EMPNO
----7839
7698
7782
7566
7654
7499
7844
7900
7521
7902
7369

ENAME
---------KING
BLAKE
CLARK
JONES
MARTIN
ALLEN
TURNER
JAMES
WARD
FORD
SMITH

JOB
MGR HIREDATE
SAL COMM DEPTNO
--------- ----- --------- ----- ----- -----PRESIDENT
17-NOV-81 5000
10
MANAGER
7839 01-MAY-81 2850
30
MANAGER
7839 09-JUN-81 2450
10
MANAGER
7839 02-APR-81 2975
20
SALESMAN
7698 28-SEP-81 1250 1400
30
SALESMAN
7698 20-FEB-81 1600
300
30
SALESMAN
7698 08-SEP-81 1500
0
30
CLERK
7698 03-DEC-81
950
30
SALESMAN
7698 22-FEB-81 1250
500
30
ANALYST
7566 03-DEC-81 3000
20
CLERK
7902 17-DEC-80
800
20

EMPNO
----7788
7876
7934

ENAME
JOB
MGR HIREDATE
SAL COMM DEPTNO
---------- --------- ----- --------- ----- ----- -----SCOTT
ANALYST
7566 09-DEC-82 3000
20
ADAMS
CLERK
7788 12-JAN-83 1100
20
MILLER
CLERK
7782 23-JAN-82 1300
10
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

14 rows selected.
SCOTT>GRANT SELECT
2
ON Emp
3
TO DBASEC;
Grant succeeded.
SCOTT>SELECT
2
GRANTEE,
3
TABLE_NAME "Table",
4
GRANTOR,
5
PRIVILEGE
6 FROM USER_TAB_PRIVS_MADE;
GRANTEE
Table
GRANTOR
PRIVILEGE
--------------- --------------- --------------- --------------DBASEC
EMP
SCOTT
SELECT
SCOTT>GRANT SELECT, DELETE
2
ON Dept
3
TO DBASEC;
Grant succeeded.
SCOTT>SELECT
2
GRANTEE,
3
TABLE_NAME "Table",
4
GRANTOR,
5
PRIVILEGE
6 FROM USER_TAB_PRIVS_MADE;
GRANTEE
--------------DBASEC
DBASEC
DBASEC

Table
--------------DEPT
EMP
DEPT

GRANTOR
--------------SCOTT
SCOTT
SCOTT

PRIVILEGE
--------------SELECT
SELECT
DELETE

SCOTT>SELECT * FROM Dept;


DEPTNO
-----10
20
30
40

DNAME
-------------ACCOUNTING
RESEARCH
SALES
OPERATIONS

LOC
------------NEW YORK
DALLAS
CHICAGO
BOSTON

SCOTT>ROLLBACK;
Rollback complete.
SCOTT>cl scr
SCOTT>GRANT INSERT
2
ON Dept
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

TO DBASEC;

Grant succeeded.
SCOTT>SELECT * FROM Dept;
DEPTNO
-----10
20
30
40

DNAME
-------------ACCOUNTING
RESEARCH
SALES
OPERATIONS

LOC
------------NEW YORK
DALLAS
CHICAGO
BOSTON

SCOTT>INSERT INTO SCOTT.Dept


2
VALUES(50, 'SHIPPING', 'CHENNAI');
1 row created.
SCOTT>SELECT * FROM Dept;
DEPTNO
-----50
10
20
30
40

DNAME
-------------SHIPPING
ACCOUNTING
RESEARCH
SALES
OPERATIONS

LOC
------------CHENNAI
NEW YORK
DALLAS
CHICAGO
BOSTON

SCOTT>COMMIT;
Commit complete.
SCOTT>REVOKE SELECT
2
ON Emp
3
FROM DBASEC;
Revoke succeeded.
SCOTT>REVOKE SELECT, INSERT, DELETE
2
ON Dept
3
FROM DBASEC;
Revoke succeeded.
SCOTT>cl scr
SCOTT>SELECT
2
GRANTEE,
3
TABLE_NAME "Table",
4
GRANTOR,
5
PRIVILEGE
6 FROM USER_TAB_PRIVS_MADE;
no rows selected
SCOTT>cl scr
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

SCOTT>CREATE ROLE EmpSec;


CREATE ROLE EmpSec
*
ERROR at line 1:
ORA-01031: insufficient privileges

SCOTT>CREATE ROLE EmpSec;


Role created.
SCOTT>GRANT SELECT, UPDATE
2
ON Emp
3
TO EmpSec;
Grant succeeded.
SCOTT>GRANT EmpSec
2
TO DBASEC;
Grant succeeded.
SCOTT>GRANT SELECT
2
ON Dept
3
TO EmpSec;
Grant succeeded.
SCOTT>REVOKE SELECT
2
ON Emp
3
FROM EmpSec;
Revoke succeeded.
SCOTT>DESC USER_ROLE_PRIVS
Name
Null?
----------------------------------------- -------USERNAME
GRANTED_ROLE
ADMIN_OPTION
DEFAULT_ROLE
OS_GRANTED

Type
---------------------------VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(3)
VARCHAR2(3)
VARCHAR2(3)

SCOTT>SELECT
2
USERNAME,
3
GRANTED_ROLE
4 FROM USER_ROLE_PRIVS;
USERNAME
-----------------------------SCOTT
SCOTT
SCOTT

GRANTED_ROLE
-----------------------------CONNECT
EMPSEC
RESOURCE

SCOTT>DESC ROLE_SYS_PRIVS
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

Name
----------------------------------------ROLE
PRIVILEGE
ADMIN_OPTION

Null?
-------NOT NULL
NOT NULL

Type
---------------------------VARCHAR2(30)
VARCHAR2(40)
VARCHAR2(3)

SCOTT>COLUMN ROLE FORMAT A10


SCOTT>COLUMN PRIVILEGE FORMAT A20
SCOTT>SELECT
2
ROLE,
3
PRIVILEGE
4 FROM ROLE_SYS_PRIVS;
ROLE
---------CONNECT
CONNECT
CONNECT
CONNECT
CONNECT
CONNECT
CONNECT
CONNECT
RESOURCE
RESOURCE
RESOURCE

PRIVILEGE
-------------------CREATE VIEW
CREATE TABLE
ALTER SESSION
CREATE CLUSTER
CREATE SESSION
CREATE SYNONYM
CREATE SEQUENCE
CREATE DATABASE LINK
CREATE TYPE
CREATE TABLE
CREATE CLUSTER

ROLE
---------RESOURCE
RESOURCE
RESOURCE
RESOURCE
RESOURCE

PRIVILEGE
-------------------CREATE TRIGGER
CREATE OPERATOR
CREATE SEQUENCE
CREATE INDEXTYPE
CREATE PROCEDURE

16 rows selected.
SCOTT>DESC ROLE_TAB_PRIVS
Name
----------------------------------------ROLE
OWNER
TABLE_NAME
COLUMN_NAME
PRIVILEGE
GRANTABLE

Null?
-------NOT NULL
NOT NULL
NOT NULL

Type
---------------------------VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(30)
VARCHAR2(30)
NOT NULL VARCHAR2(40)
VARCHAR2(3)

SCOTT>SELECT
2
ROLE,
3
PRIVILEGE
4 FROM ROLE_TAB_PRIVS;
ROLE
---------EMPSEC
EMPSEC

PRIVILEGE
-------------------UPDATE
SELECT
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

SCOTT>DROP ROLE EmpSec;


Role dropped.
SCOTT>cl scr
SCOTT>CREATE SYNONYM Employee
2
FOR SCOTT.Emp;
Synonym created.
SCOTT>DESC Employee
Name
----------------------------------------EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO

Null?
Type
-------- ---------------------------NOT NULL NUMBER(4)
VARCHAR2(10)
VARCHAR2(9)
NUMBER(4)
DATE
NUMBER(7,2)
NUMBER(7,2)
NOT NULL NUMBER(2)

SCOTT>SELECT * FROM Employee;


EMPNO
----7839
7698
7782
7566
7654
7499
7844
7900
7521
7902
7369

ENAME
---------KING
BLAKE
CLARK
JONES
MARTIN
ALLEN
TURNER
JAMES
WARD
FORD
SMITH

JOB
MGR HIREDATE
SAL COMM DEPTNO
--------- ----- --------- ----- ----- -----PRESIDENT
17-NOV-81 5000
10
MANAGER
7839 01-MAY-81 2850
30
MANAGER
7839 09-JUN-81 2450
10
MANAGER
7839 02-APR-81 2975
20
SALESMAN
7698 28-SEP-81 1250 1400
30
SALESMAN
7698 20-FEB-81 1600
300
30
SALESMAN
7698 08-SEP-81 1500
0
30
CLERK
7698 03-DEC-81
950
30
SALESMAN
7698 22-FEB-81 1250
500
30
ANALYST
7566 03-DEC-81 3000
20
CLERK
7902 17-DEC-80
800
20

EMPNO
----7788
7876
7934

ENAME
---------SCOTT
ADAMS
MILLER

JOB
MGR HIREDATE
SAL COMM DEPTNO
--------- ----- --------- ----- ----- -----ANALYST
7566 09-DEC-82 3000
20
CLERK
7788 12-JAN-83 1100
20
CLERK
7782 23-JAN-82 1300
10

14 rows selected.
SCOTT>GRANT SELECT
2
ON Employee
3
TO DBASEC;
Grant succeeded.
SCOTT>CREATE PUBLIC SYNONYM Employee
2
FOR SCOTT.Emp;
Document Generated By SkyEss Techno Solutions Pvt. Ltd.
For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090

Spool Generated For Class of Oracle By Satish K Yellanki

CREATE PUBLIC SYNONYM Employee


*
ERROR at line 1:
ORA-01031: insufficient privileges

SCOTT>CREATE PUBLIC SYNONYM Employee


2
FOR SCOTT.Emp;
Synonym created.
SCOTT>SPOOL OFF

Document Generated By SkyEss Techno Solutions Pvt. Ltd.


For Queries And Live Project Experience in Any Domain
Mail at: info@skyessmail.com (OR) rajesh.b@skyessmail.com
Mobile : 9030750090