Oracle系列:(21)訪問其他使用者下的對象[授權]

來源:互聯網
上載者:User

標籤:oracle



聲明:scott或hr叫使用者名稱/方案名/空間名

      scott--tiger

      hr-----lion

      

查詢目前使用者是誰

show user;

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/87/1A/wKiom1fUF4jBIjRCAAAPoOM61GI926.jpg" title="004.jpg" alt="wKiom1fUF4jBIjRCAAAPoOM61GI926.jpg" />


查詢scott自己資料表空間下的所有對象時,可加,或不加使用者名稱select * from emp;

select * from emp;

select * from scott.emp;


以sysdba身份解鎖hr普通帳戶

alter user hr account unlock;


以sysdba身份設定hr普通帳戶的密碼

alter user hr identified by lion;

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/87/18/wKioL1fUGGCTNEFAAADFdQvNNWo217.jpg" title="005.jpg" alt="wKioL1fUGGCTNEFAAADFdQvNNWo217.jpg" />


當scott查詢hr資料表空間下的所有表時,必須得加使用者名稱

select * from hr.jobs;

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M01/87/1B/wKiom1fUGd_COFolAACx9cNLAWc266.jpg" title="007.jpg" alt="wKiom1fUGd_COFolAACx9cNLAWc266.jpg" />


在預設情況下,每個使用者只能查詢自已空間下的對象的許可權,不能查詢其它使用者空間下的對象

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/87/1B/wKiom1fUHJ6gIjJbAABeuRdzOYo379.jpg" title="008.jpg" alt="wKiom1fUHJ6gIjJbAABeuRdzOYo379.jpg" />


以sysdba身份角色,授予scott使用者查詢所有使用者空間下的對象許可權

grant select any table to scott;


以sysdba身份,撤銷scott使用者查詢所有使用者空間下的對象許可權

revoke select any table from scott;


scott自已檢視自己所擁有的許可權

select * from user_sys_privs;

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/87/19/wKioL1fUH17Tr-FkAADsZ6OdcSc001.jpg" title="009.jpg" alt="wKioL1fUH17Tr-FkAADsZ6OdcSc001.jpg" />


從scott使用者空間導航到sysdba使用者空間

conn / as sysdba;


從sysdba使用者空間導航到scott使用者空間

conn scott/tiger;


從scott使用者空間導航到hr使用者空間

conn hr/lion;


查詢hr使用者空間中的所有對象

select * from tab;


從hr使用者空間導航到scott使用者空間

conn scott/tiger;


在scott使用者空間下,查詢hr使用者空間下的jobs表,必須加上hr使用者空間名

select * from hr.jobs;









Oracle系列:(21)訪問其他使用者下的對象[授權]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.