OCP-1Z0-052-V8.02-129题

129. A database user SMITH tries to query the V$SESSION view and fails to access it as follows:

SQL> connect smith/smith

Connected.

SQL> SELECT * FROM v$session;

SELECT * FROM v$session

*

ERROR at line 1:

ORA-00942: table or view does not exist

Which are the two possible solutions to enable SMITH to query the data in V$SESSION? (Choose two.)

A.granting SELECT privilege to SMITH on V$SESSION

B.granting SELECT privilege to SMITH on V_$SESSION

C.asking the user SMITH to run the catalog.sql script

D.granting SELECT privilege to SMITH on V$FIXED_TABLES

E.setting the O7_DICTIONARY_ACCESSIBILITY parameter to TRUE

F.creating a view based on V$SESSION and granting SELECT privilege to SMITH on the view that was

created

Answer: BF  

答案解析:

The V$SESSION data dictionary view also contains session information from the SYS.V_$SESSION system table for the current session

 

从题中错误看出,SMITH 用户没有访问数据字典v$session的权限,两种解决方法,一是给他访问v$session的权限,二是在v$session建立视图,并授权让SMITH 可以查看

 


实验第一种方法如下:

sys@TEST1107> create user abc identified by abc;


User created.


sys@TEST1107> grant connect to abc;


Grant succeeded.


sys@TEST1107> conn abc/abc

Connected.

abc@TEST1107> select * from v$session;

select * from v$session

              *

ERROR at line 1:

ORA-00942: table or view does not exist



abc@TEST1107> conn /as sysdba

Connected.

sys@TEST1107> grant select on v$session to abc;

grant select on v$session to abc

                *

ERROR at line 1:

ORA-02030: can only select from fixed tables/views



sys@TEST1107> grant select on v_$session to abc;


Grant succeeded.


sys@TEST1107> conn abc/abc

Connected.

abc@TEST1107> select count(*) from v$session;


  COUNT(*)

----------

        43


此处需注意,给的是select on v_$session而不是select on v$session权限。

 

你可能感兴趣的:(OCP-1Z0-052-V8.02-129题)