Oracle普通使用者使用show parameter方法
在Oracle中一般只有sys使用者可以使用show parameter來查看參數的設定,如果想要普通使用者也可以使用show parameter,需要給普通使用者授予在V_$PARAMETER視圖上SELECT許可權。
Oracle官方解釋:
Your output may vary depending on the version and configuration of the Oracle Database server to which you are connected. You need SELECT ON V_$PARAMETER object privileges to use the PARAMETERS clause, otherwise you will receive a message
ORA-00942: table or view does not exist
SQL> conn / as sysdba
Connected.
SQL> show parameter count
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
active_instance_count integer
cpu_count integer 2
db_file_multiblock_read_count integer 46
SQL> create user lyn identified by oracle default tablespace users;
User created.
SQL> grant connect,resource to lyn;
Grant succeeded.
SQL> conn lyn/oracle
Connected.
SQL> show parameter count
ORA-00942: table or view does not exist
SQL> conn / as sysdba
Connected.
SQL> grant select on v_$parameter to lyn;
Grant succeeded.
SQL> conn lyn/oracle
Connected.
SQL> show parameter count
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
active_instance_count integer
cpu_count integer 2
db_file_multiblock_read_count integer 46
類似的,如果要是使用show sga,就需要將V_$SGA的select許可權授予普通使用者
SQL> conn lyn/oracle
Connected.
SQL> show sga
ORA-00942: table or view does not exist
SQL> conn /as sysdba
Connected.
SQL> grant select on v_$sga to lyn;
Grant succeeded.
SQL> conn lyn/oracle
Connected.
SQL> show sga
Total System Global Area 313860096 bytes
Fixed Size 1336232 bytes
Variable Size 205524056 bytes
Database Buffers 100663296 bytes
Redo Buffers 6336512 bytes