0% found this document useful (0 votes)
53 views3 pages

Tasklab (Sysnonym)

Uploaded by

iamayesha2526
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views3 pages

Tasklab (Sysnonym)

Uploaded by

iamayesha2526
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Microsoft Windows [Version 10.0.19045.

5131]
(c) Microsoft Corporation. All rights reserved.

C:\Users\admin>sqlplus / as sysdba;

SQL*Plus: Release [Link].0 Production on Sat Nov 30 [Link] 2024

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release [Link].0 - 64bit Production

SQL> create user arfa identified by pass;

User created.

SQL> grant connect, resource to arfa;

Grant succeeded.

SQL> grant create synonym to arfa;

Grant succeeded.

SQL> create synonym syno for employee1;

Synonym created.

SQL> grant create view to arfa;

Grant succeeded.

SQL> create view sv as select employee_id,first_name,last_name,salary FROM


employee1 WHERE salary < 10000;

View created.

SQL> grant dba to arfa;

Grant succeeded.

SQL> grant select on sv to arfa;

Grant succeeded.

SQL> grant select on sv to public;

Grant succeeded.

SQL> grant select on sys.employee1 to public;

Grant succeeded.

SQL> select * from sv;

no rows selected

SQL> select * from employee1;


EMPLOYEE_ID FIRST_NAME
----------- --------------------------------------------------
LAST_NAME DEPARTMENT_ID SALARY
-------------------------------------------------- ------------- ----------
1 AYESHA
FAYAZ 10 60000

2 ISHA
TANVEER 20 70000

3 ALINA
MAZLOOM 10 80000

SQL> select * from [Link];

no rows selected

SQL> SELECT * FROM all_tab_privs WHERE grantee = 'ARFA' AND table_name = 'SV';

GRANTOR GRANTEE
------------------------------ ------------------------------
TABLE_SCHEMA TABLE_NAME
------------------------------ ------------------------------
PRIVILEGE GRA HIE
---------------------------------------- --- ---
SYS ARFA
SYS SV
SELECT NO NO

SQL>
SQL> SELECT * FROM all_tab_privs WHERE grantee = 'ARFA' AND table_name =
'EMPLOYEE1';

no rows selected

SQL> SELECT * FROM all_tab_privs WHERE grantee = 'PUBLIC' AND table_name =


'EMPLOYEE1';

GRANTOR GRANTEE
------------------------------ ------------------------------
TABLE_SCHEMA TABLE_NAME
------------------------------ ------------------------------
PRIVILEGE GRA HIE
---------------------------------------- --- ---
SYS PUBLIC
SYS EMPLOYEE1
SELECT NO NO

SQL> SELECT * FROM syno;

EMPLOYEE_ID FIRST_NAME
----------- --------------------------------------------------
LAST_NAME DEPARTMENT_ID SALARY
-------------------------------------------------- ------------- ----------
1 AYESHA
FAYAZ 10 60000

2 ISHA
TANVEER 20 70000

3 ALINA
MAZLOOM 10 80000

SQL> SELECT * FROM all_synonyms WHERE synonym_name = 'SYNO';

OWNER SYNONYM_NAME
------------------------------ ------------------------------
TABLE_OWNER TABLE_NAME
------------------------------ ------------------------------
DB_LINK
--------------------------------------------------------------------------------
SYS SYNO
SYS EMPLOYEE1

SQL> ^C
C:\Users\admin>

C:\Users\admin>

You might also like