Iii. Introduction to data dictionaries and dynamic performance views
1. Data Dictionary of the database
(1) Dba_ data dictionary for all objects of a whole library
Only system users have permission queries
(2) All_ object created by current user + other user granted to current user
Current user
(3) User_ objects created by the current user
Current user
Operation Example:
Unlock a user hr and change the password
sql> alter user HR account unlock;
User altered.
sql> alter user HR identified by HR;
User altered.
Under the Scott user, view the table under the HR user
Sql> Conn Scott/scott;
Connected.
Sql> select * from Hr.jobs;
SELECT * FROM Hr.jobs
*
ERROR at line 1:
Ora-00942:table or view does not exist--error, table or views do not exist
Sql> Conn Hr/hr
Connected.
Sql> Grant Select on jobs to Scott; --Grant SELECT permission
Grant succeeded.
sql> INSERT into hr.jobs values (' Hr_rep ', ' asdfasd ', 1232,5545);
INSERT into hr.jobs values (' Hr_rep ', ' asdfasd ', 1232,5545)
*
ERROR at line 1:
Ora-01031:insufficient Privileges
Under a user: The following statement is equivalent:
SELECT * from user_objects where object_type= ' TABLE ';
=select * from User_tables;
2. Dynamic Performance View
SELECT * from V$session;
SELECT * from V$process;
Exercise: Querying dba_objects under the SYS user, but not under the Scott user, authorizing the query to Scott so that Scott can query the data dictionary
Sql> Conn Scott/scott;
Connected.
Sql> select * from Dba_objects;
SELECT * FROM Dba_objects
*
ERROR at line 1:
Ora-00942:table or view does not exist
Sql> Conn/as SYSDBA
Connected.
Sql> Grant SELECT on Dba_objects to Scott;
Grant succeeded.
This article is from the "Feng Songlin blog" blog, make sure to keep this source http://fengsonglin.blog.51cto.com/9860507/1615230
Introduction to Oracle's basic operations-data dictionary and dynamic performance view