2)参数文件中静态参数和动态参数以及隐含参数
所谓动态参数,就是在数据库运行中修改的参数能够立刻在该实例中生效。静态参数需要重新启动实例之后才能工生效。
修改参数使用如下命令:
alter system set parameter_name=value scope={both|spfile|memory}
both:代表修改的参数能够在本实例立刻生效同时写入参数文件在数据库下次启动实例的时候仍然有效。
spfile:代表修改参数对本次实例不生效,但是写入参数文件在数据库下次启动实例时生效。
member:代表修改的参数对本实例有效,不写入spfile在数据库下次启动市里的过程不生效。
如何查看我要修改的参数是下次实例启动生效还是立刻生效呢?
可以根据v$parameter中的ISSES_MODIFIABLE和ISSYS_MODIFIABLE进行判断。对于他们可以看一下介绍:
ISSES_MODIFIABLE Indicates whether the parameter can be changed with ALTER SESSION (TRUE) or not (FALSE)
ISSYS_MODIFIABLE
•
IMMEDIATE - Parameter can be changed with ALTER SYSTEM regardless of the type of parameter file used to start the instance. The change takes effect immediately.
•
DEFERRED - Parameter can be changed with ALTER SYSTEM regardless of the type of parameter file used to start the instance. The change takes effect in subsequent sessions.
•
FALSE - Parameter cannot be changed with ALTER SYSTEM unless a server parameter file was used to start the instance. The change takes effect in subsequent instances.
eg: SYS@orcl#col name for a20
SYS@orcl#col description for a70
SYS@orcl#r
1* select name,type,description,isses_modifiable,issys_modifiable from v$parameter where name in('processes','cpu_count','sort_area_size')
NAME TYPE DESCRIPTION ISSES_MODI ISSYS_MODIFIABLE
-------------------- ---------- ---------------------------------------------------------------------- ---------- ------------------
processes 3 user processes FALSE FALSE
cpu_count 3 number of CPUs for this instance FALSE IMMEDIATE
sort_area_size 3 size of in-memory sort work area TRUE DEFERRED SYS@orcl#
SYS@orcl#alter system set sort_area_size=32768 deferred;
•系统已更改。
•SYS@orcl#show parameter sort_area_size
•NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
sort_area_size integer
65536
SYS@orcl#exit
从 Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
oracle@oracle:~> sqlplus "/as sysdba"
•SQL*Plus: Release 11.1.0.6.0 - Production on 星期六 6月 15 16:48:04 2013
•Copyright (c) 1982, 2007, Oracle. All rights reserved.
•
连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
•SYS@orcl#show parameter sort_area_size
•NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
sort_area_size integer
32768
SYS@orcl#
在告警日志中可以看到如许:Sat Jun 15 16:51:09 2013
ALTER SYSTEM SET sort_area_size=32768 DEFERRED SCOPE=BOTH;
总结:
当我们要修改一个参数的时候,可能会出现无法修改情况,这是我们一定要查看一下这个参数到底具有哪些限制,应该采用哪种命令。切不可随便修改,如果在RAC下修改参数的时候需要指定sid如果为*说明修改所有实例的该参数 ,另外当使一个参数文件恢复到默认状态可以使用reset ,alter system reset parameter_name scope=xxxx sid=xxx;。
刚刚在前面查看了一下show parameter processes 参数的跟踪文件,在其中我们看到了两个内部试图X$KSPPI和X$KSPPCV,在数据库中存在隐含参数。获取隐含参数命令如下:
select a.ksppinm,a.ksppdesc,b.ksppstvl from x$ksppi a,x$ksppcv b where a.indx=b.indx and a.ksppinm like '%&name%';
eg:
SYS@orcl#r
1 select a.ksppinm,b.ksppstvl from x$ksppi a,x$ksppcv b where a.indx=b.indx and a.ksppinm like '%&name%'
2*
输入 name 的值: allow_resetlogs
KSPPINM KSPPSTVL
------------------------------------------------------------ --------------------
_allow_resetlogs_corruption FALSE
SYS@orcl#
