如何讓普通使用者可以對DBA_SOURCE檢視進行閃回查詢?

lhrbest發表於2017-09-08
如何讓普通使用者可以對DBA_SOURCE檢視進行閃回查詢?



賦權:GRANT SELECT , FLASHBACK ON DBA_SOURCE TO LHR10;

或:GRANT DBA,SELECT_CATALOG_ROLE TO LHR10;



LHR@orclasm > DROP USER LHR10;
CREATE USER LHR10 IDENTIFIED BY LHR;
GRANT RESOURCE TO LHR10;








User dropped.


LHR@orclasm > 
User created.


LHR@orclasm > 
Grant succeeded.


LHR@orclasm > LHR@orclasm > LHR@orclasm > LHR@orclasm > 
LHR@orclasm > 
LHR@orclasm > 
LHR@orclasm > CONN LHR10/LHR;
ERROR:
ORA-01045: user LHR10 lacks CREATE SESSION privilege; logon denied




Warning: You are no longer connected to ORACLE.
@ > CONN / AS SYSDBA
Connected.
SYS@orclasm > GRANT CONNECT,RESOURCE TO LHR10;


Grant succeeded.


SYS@orclasm > conn lhr10/LHR
Connected.
LHR10@orclasm > 
LHR10@orclasm > select * from dba_source as of timestamp sysdate -1/24 where rownum<=1;
select * from dba_source as of timestamp sysdate -1/24 where rownum<=1
              *
ERROR at line 1:
ORA-00942: table or view does not exist




LHR10@orclasm > GRANT SELECT ON DBA_SOURCE TO LHR10;
GRANT SELECT ON DBA_SOURCE TO LHR10
                *
ERROR at line 1:
ORA-00942: table or view does not exist




LHR10@orclasm > CONN / AS SYSDBA
Connected.
SYS@orclasm > GRANT SELECT ON DBA_SOURCE TO LHR10;


Grant succeeded.


SYS@orclasm > conn lhr10/LHR
Connected.
LHR10@orclasm > select * from dba_source as of timestamp sysdate -1/24 where rownum<=1;
select * from dba_source as of timestamp sysdate -1/24 where rownum<=1
              *
ERROR at line 1:
ORA-01031: insufficient privileges




LHR10@orclasm > CONN / AS SYSDBA
Connected.
SYS@orclasm > GRANT FLASHBACK ON DBA_SOURCE TO LHR10;


Grant succeeded.


SYS@orclasm > conn lhr10/LHR
Connected.
LHR10@orclasm > select * from dba_source as of timestamp sysdate -1/24 where rownum<=1;


OWNER                          NAME                           TYPE
------------------------------ ------------------------------ ------------
      LINE
----------
TEXT
--------------------------------------------------------------------------------
SYS                            AGGXMLIMP                      TYPE
         1
type AggXMLImp




LHR10@orclasm > CONN / AS SYSDBA
Connected.
SYS@orclasm > REVOKE FLASHBACK ON DBA_SOURCE FROM LHR10;


Revoke succeeded.


SYS@orclasm > conn lhr10/LHR
Connected.
LHR10@orclasm > 
LHR10@orclasm >  select * from dba_source as of timestamp sysdate -1/24 where rownum<=1;
 select * from dba_source as of timestamp sysdate -1/24 where rownum<=1
               *
ERROR at line 1:
ORA-01031: insufficient privileges




LHR10@orclasm > CONN / AS SYSDBA
Connected.
SYS@orclasm > 
SYS@orclasm > GRANT SELECT_CATALOG_ROLE TO LHR10;


Grant succeeded.


SYS@orclasm > conn lhr10/LHR
Connected.
LHR10@orclasm >  select * from dba_source as of timestamp sysdate -1/24 where rownum<=1;
 select * from dba_source as of timestamp sysdate -1/24 where rownum<=1
               *
ERROR at line 1:
ORA-01031: insufficient privileges




LHR10@orclasm > CONN / as sysdba
Connected.
SYS@orclasm > grant dba to lhr10;


Grant succeeded.


SYS@orclasm > conn lhr10/LHR
Connected.
LHR10@orclasm >  select * from dba_source as of timestamp sysdate -1/24 where rownum<=1;


OWNER                          NAME                           TYPE
------------------------------ ------------------------------ ------------
      LINE
----------
TEXT
--------------------------------------------------------------------------------
SYS                            AGGXMLIMP                      TYPE
         1
type AggXMLImp











About Me

.............................................................................................................................................

● 本文作者:小麥苗,部分內容整理自網路,若有侵權請聯絡小麥苗刪除

● 本文在itpub(http://blog.itpub.net/26736162/abstract/1/)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/

● 本文部落格園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版、個人簡介及小麥苗雲盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 資料庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● DBA寶典今日頭條號地址:

.............................................................................................................................................

● QQ群號:230161599(滿)、618766405

● 微信群:可加我微信,我拉大家進群,非誠勿擾

● 聯絡我請加QQ好友646634621,註明新增緣由

● 於 2017-09-01 09:00 ~ 2017-09-30 22:00 在魔都完成

● 文章內容來源於小麥苗的學習筆記,部分整理自網路,若有侵權或不當之處還請諒解

● 版權所有,歡迎分享本文,轉載請保留出處

.............................................................................................................................................

小麥苗的微店

小麥苗出版的資料庫類叢書http://blog.itpub.net/26736162/viewspace-2142121/

.............................................................................................................................................

使用微信客戶端掃描下面的二維碼來關注小麥苗的微信公眾號(xiaomaimiaolhr)及QQ群(DBA寶典),學習最實用的資料庫技術。

   小麥苗的微信公眾號      小麥苗的DBA寶典QQ群1     小麥苗的DBA寶典QQ群2        小麥苗的微店

.............................................................................................................................................

如何讓普通使用者可以對DBA_SOURCE檢視進行閃回查詢?
DBA筆試面試講解群1
DBA筆試面試講解群2
歡迎與我聯絡



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2144687/,如需轉載,請註明出處,否則將追究法律責任。

相關文章