如何让普通用户可以对DBA_SOURCE视图进行闪回查询?

如何让普通用户可以对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  


上一篇:ZooKeeper学习之路(三)—— Zookeeper常用Shell命令


下一篇:路由表 FIB表 快速转发表