Home  >  Article  >  Database  >  Oracle之参数文件探究

Oracle之参数文件探究

WBOY
WBOYOriginal
2016-06-07 17:29:43865browse

说到oracle参数文件,那么这是要给非常重要的文件,在数据库启动实例的过程中进行内存、数据库名称等等环境的初始化,只有参数文

之前有很多刚刚开始学习数据库的朋友经常问我参数文件备份恢复以及误操作导致无法启动实例等等问题,我也是一个求道之人,今天写了这篇日志,希望对大家有所帮助,彼此互相学习互相进步。在此记录一下。

说到Oracle参数文件,那么这是要给非常重要的文件,在数据库启动实例的过程中进行内存、数据库名称等等环境的初始化,只有参数文件配置正确那么数据库才能启动实例,进而可以mount and open。

 1)参数视图介绍
 与参数文件有关的视图有v$parameter,v$spparameter,v$system_parameter,v$parameter2,v$system_parameter2。
 v$parameter
 
v$parameter 视图显示的是当前会话中生效的初始化参数信息,每一个新的会话开始都会从v$system_parameter视图中继承一些参数。可见v$parameter是基于当前会话的,而v$system_parameter是基于实例的。类似于linux的profile环境参数。
 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.
 
v$spparameter
 该参数记录的是在参数文件(spfile)中的参数设置内容,如果参数文件没有使用,那么该参数中的每一个值在ISSPECIFIED列都是false。
 
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.
 eg:
 SYS@orcl#select sid,name,type,value,isspecified,ordinal from v$spparameter where rownum 
SI NAME                TYPE                          VALUE                          ISSPECIFIED    ORDINAL
 -- -------------------- ------------------------------ ------------------------------ ------------ ----------
 *  lock_name_space      string                                                        FALSE                0
 *  processes            integer                        160                            TRUE                  1
 SYS@orcl#create pfile='/opt/oracle/pfile.ora' from spfile;
 
文件已创建。
 
SYS@orcl#shutdown immediate
 数据库已经关闭。
 已经卸载数据库。
 ORACLE 例程已经关闭。
 SYS@orcl#startup pfile='/opt/oracle/pfile.ora';
 ORACLE 例程已经启动。
 
Total System Global Area  805875712 bytes
 Fixed Size                  2148720 bytes
 Variable Size            511706768 bytes
 Database Buffers          285212672 bytes
 Redo Buffers                6807552 bytes
 数据库装载完毕。
 数据库已经打开。
 SYS@orcl#select sid,name,type,value,isspecified,ordinal from v$spparameter where rownum 
SI NAME                TYPE                          VALUE                          ISSPECIFIED    ORDINAL
 -- -------------------- ------------------------------ ------------------------------ ------------ ----------
 *  lock_name_space      string                                                        FALSE                0
 *  processes            integer                                                      FALSE                0
 
SYS@orcl#
 

v$system_parameter
 
该试图对instance而言的,其他的会话信息都是基于该试图进行“copy”的。
 
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.
 v$parameter2
 
该参数文件就是对v$parameter参数中的多项值进行format。
 
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.
 
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.
 
eg:
 
SYS@orcl#select name,value from v$parameter where;
 
NAME                VALUE
 -------------------- ------------------------------
 control_files        /opt/oracle/oradata/ORCL/contr
                      olfile/o1_mf_7q9c8orh_.ctl, /o
                      pt/oracle/flash_recovery_area/
                      ORCL/controlfile/o1_mf_7q9c8pc
                      f_.ctl
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn