2014年(13)
分类: Oracle
2014-04-25 17:54:16
用过Oracle的朋友都知道,现在绝大部分Oracle数据库使用的是基于服务器的参数文件。对于查询当前数据库实例级别,system级别,session级别参数的具体设置有些时候很容易混淆。本文主要介绍了Oracle数据库参数使用的相关视图(V$PARAMETER,V$PARAMETER2,V$SYSTEM_PARAMETER,V$SYSTEM_PARAMETER2,V$SPPARAMETER),以及通过查询Oracle视图来获得不同情形下的参数值并进行对比。
1、对比有关参数视图
a、V$PARAMETER
displays information about the initialization parameters that are currently in effect for the session.
A new session inherits parameter values from the instance-wide values displayed by the V$SYSTEM_PARAMETER view.
显示的是基于当前session级别生效的初始化参数,新的session会从实例范围派生一些参数值(在视图V$SYSTEM_PARAMETER2呈现)
视图下的几个重要列(下面的几个视图中也存在这个几个列,类同)
ISSES_MODIFIABLE: 表明当前参数是否够基于session级别进行修改(ALTER SESSION (TRUE) or not (FALSE))
ISSYS_MODIFIABLE: 表明当前参数是否够基于system级别进行修改(ALTER SYSTEM)以及改变生效的情形
IMMEDIATE,立即生效(不考虑是否用pfile或spfile启动);
DEFERRED,延迟生效,后续新的session中有效(不考虑是否用pfile或spfile启动);
FALSE,参数不能被修改,除非使用了spfile参数文件启动,后续新的session中有效
ISINSTANCE_MODIFIABLE:是否为实例级别可修改参数(ALTER SYSTEm),主要是考虑RAC环境
为TRUE,表明该参数可以不同于其他实例
为FALSE,表名该参数在所有实例中必须使用相同的值
b、V$PARAMETER2
displays information about the initialization parameters that are currently in effect for the session,
with each list parameter value appearing as a row in the view.
A new session inherits parameter values from the instance-wide values displayed in the V$SYSTEM_PARAMETER2 view.
显示的是基于当前session级别生效的初始化参数,新的session会从实例范围派生一些参数(在视图V$SYSTEM_PARAMETER2呈现)
注意,这个视图对于存在多个参数值的参数,在这个视图中分为多行进行列出
如control_files在视图V$PARAMETER呈现为一行,且有2个值,则在V$PARAMETER2中显示为2行
Presenting the list parameter values in this format enables you to quickly determine the values for a list parameter.
For example, if a parameter value is a, b, then the V$PARAMETER view does not tell you if the parameter has two values (both a and b)
or one value (a, b). V$PARAMETER2 makes the distinction between the list parameter values clear.
c、V$SYSTEM_PARAMETER
V$SYSTEM_PARAMETER displays information about the initialization parameters that are currently in effect for the instance.
A new session inherits parameter values from the instance-wide values.
显示的是基于实例级别参数的相关信息,新的session同样会从实例级别进行派生
d、V$SYSTEM_PARAMETER2
V$SYSTEM_PARAMETER2 displays information about the initialization parameters that are currently in effect for the instance,
with each list parameter value appearing as a row in the view. A new session inherits parameter values from the instance-wide values.
与V$PARAMETER,V$PARAMETER2相类似,V$SYSTEM_PARAMETER2用于展示实例级别且一个参数有多个值分多行列出的情形
e、V$SPPARAMETER
displays information about the contents of the server parameter file. If a server parameter file was not used to start
the instance, then each row of the view will contain FALSE in the ISSPECIFIED column.
这个视图列出的是基于服务器参数文件中的参数信息,如果没有使用服务器参数文件启动实例,则视图中每一行ISSPECIFIED列的值为FALSE
2、示例演示参数视图
3、小结
a、对于Oracle数据库参数文件存在多个视图可以查询其值(v$paraemter,v$parameter2,v$system_parameter,v$system_parameter2,v$spparameter);
b、v$paraemter,v$parameter2视图主要是查询基于session级别的参数的相关信息,v$parameter2对于同一个参数多个值分多行的形式展开;
c、v$system_parameter,v$system_parameter2是查询基于system,实例级别的参数的相关信息,v$system_parameter2同样用于一个参数多值分行展开;
d、注意理解参数的几个不同级别session,system,instance级别,instance级别主要对多实例情形(RAC),有时候sytem与instance会混用;
e、v$spparameter主要是针对服务器参数文件有效即spfile,同时也可以用于检查当前使用了pfile还是spfile方式启动。