溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle的基本操作-數(shù)據(jù)字典和動態(tài)性能視圖的介紹

發(fā)布時間:2020-06-30 15:17:28 來源:網絡 閱讀:338 作者:forest馮宋林 欄目:關系型數(shù)據(jù)庫


三、數(shù)據(jù)字典和動態(tài)性能視圖的介紹

1. 數(shù)據(jù)庫的數(shù)據(jù)字典

 (1) DBA_   全庫所有的某種對象的數(shù)據(jù)字典
       只有系統(tǒng)用戶才有權限查詢
 (2) ALL_   當前用戶創(chuàng)建的對象 + 其他用戶授予當前用戶使用的對象
       當前用戶
 (3) USER_  當前用戶創(chuàng)建的對象
       當前用戶

操作實例:
解鎖一個用戶hr并改密碼
SQL> alter user hr account unlock;

User altered.

SQL> alter user hr identified by hr;

User altered.

在scott用戶下,查看hr用戶下的表
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        --報錯,表或視圖不存在

SQL> conn hr/hr
Connected.
SQL> grant select on jobs to scott;        --授予select權限

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


在某個用戶下:以下語句是等效的:
select * from user_objects where object_type='TABLE';

=select * from user_tables;

2. 動態(tài)性能視圖

select * from v$session;
select * from v$process;


練習:在SYS用戶下查詢DBA_OBJECTS,但是在scott用戶下查不到的,授權查詢給scott,使scott能夠查詢這個數(shù)據(jù)字典

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.


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI