模式与用户一一对应,名字相同。
参数文件
[root@host10 oracle]# cat /u01/app/oracle/product/11.2.0/xe/dbs/init.ora
#
# $Header: rdbms/admin/init.ora /main/23 2009/05/15 13:35:38 ysarig Exp $
#
# Copyright (c) 1991, 1997, 1998 by Oracle Corporation
# NAME
# init.ora
# FUNCTION
# NOTES
# MODIFIED
# ysarig 05/14/09 - Updating compatible to 11.2
# ysarig 08/13/07 - Fixing the sample for 11g
# atsukerm 08/06/98 - fix for 8.1.
# hpiao 06/05/97 - fix for 803
# glavash 05/12/97 - add oracle_trace_enable comment
# hpiao 04/22/97 - remove ifile=, events=, etc.
# alingelb 09/19/94 - remove vms-specific stuff
# dpawson 07/07/93 - add more comments regarded archive start
# maporter 10/29/92 - Add vms_sga_use_gblpagfile=TRUE
# jloaiza 03/07/92 - change ALPHA to BETA
# danderso 02/26/92 - change db_block_cache_protect to _db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you start by providing
# a starting point to customize your RDBMS installation for your site.
#
# NOTE: The values that are used in this file are only intended to be used
# as a starting point. You may want to adjust/tune those values to your
# specific hardware and needs. You may also consider using Database
# Configuration Assistant tool (DBCA) to create INIT file and to size your
# initial set of tablespaces based on the user input.
###############################################################################
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='<ORACLE_BASE>/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='<ORACLE_BASE>'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'
动态参数文件
[root@host10 dbs]# cat spfileXE.ora
C"��6��;CC"C$XE.__db_cache_size=88080384
XE.__java_pool_size=4194304
XE.__large_pool_size=4194304
XE.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
XE.__pga_aggregate_target=146800640
XE.__sga_target=268435456
XE.__shared_io_pool_size=0
XE.__shared_pool_size=163577856
XE.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/XE/adump'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/XE/control.dbf'
*.db_name='XE'
*.DB_RECOVERY_FILE_DEST='/u01/app/oracleCC"I/fast_recovery_area'
*.DB_RECOVERY_FILE_DEST_SIZE=10G
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=XEXDB)'
*.job_queue_processes=4
*.memory_target=415236096
*.open_cursors=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=20
*.shared_servers=4
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
CC"GeCC"FeC
熟悉oracle启动和关闭流程,对于oracle启关原理有了深入理解,在此基础上,我们再逐步分析其中的各个部分。在oracle数据库中,有一系列的初始化参数用来进行数据库约束和资源限制,这些参数通常存储在一个参数文件中,在数据库实例启动时读取并加载。
一、参数文件类型
参数文件有两种类型,pfile及spfile。PFILE是文本文件的,而SPFILE是二进制格式的。PFILE文件可以用文本编辑器打开手工配置、而SPFILE不行,只能通过SQL命令在线修改。从操作系统上可以看到这两者的区别,初始化参数文件为ASCII文本文件,SPFILE为数据文件。
1.1,查看pfile文件
[oracle@oracle11g dbs]$ cat init.ora
#
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='<ORACLE_BASE>/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='<ORACLE_BASE>'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'
1.2,查看spfile文件
[oracle@oracle11g dbs]$ cat spfileORCL.ora
C"趖???CC"lORCL.__db_cache_size=243269632
ORCL.__java_pool_size=4194304
ORCL.__large_pool_size=4194304
ORCL.__oracle_base='/oracle/app/oracle'#ORACLE_BASE set from environment
ORCL.__pga_aggregate_target=343932928
ORCL.__sga_target=641728512
ORCL.__shared_io_pool_size=0
ORCL.__shared_pool_size=381681664
ORCL.__streams_pool_size=0
*.audit_file_dest='/oracle/app/oracle/admin/ORCL/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/app/data/ORCL/control01.ctl','/oracle/appCC"bb/oracle/flash_recovery_area/ORCL/control02.ctl'#Restore Controlfile
*.db_block_size=8192
*.db_domain=''
*.db_files=300
*.db_name='ORCL'
*.db_recovery_file_dest='/oracle/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=3565158400
*.diagnostic_dest='/oracle/app/oracle'
*.memory_target=983564288
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_management='AUTO'
*.undo_tablespace='UNCC"#SDOTBS1'
1.3,辨别数据库使用spfile还是pfile
pfile进行参数修改:直接进行编辑修改
spfile进行参数修改:alter system/alter session
判断数据库是通过spfile启动还是通过pfile启动:
select distinct isspecified from v$spparameter;
第一个值为true代表为spfile启动,为false表示pfile启动;
第二种方法:直接修改系统参数,如果提示无法修改spfile代表为pfile启动
alter system set processes=150 scope=spfile;
二、参数文件转换
a,通过spfile创建pfile
create pfile='路径+文件名' from spfile;
SQL> create pfile='/oracle/app/pfile_01.ora' from spfile;
File created.
b,通过pfile创建spfile
create spfile='路径+文件名' from pfile;
11g可以在数据库未关闭的情况下,实现spfile的重建
create spfile from memory;
三、参数解析
3.1,参数类型
a,推导参数
推导参数通常来自于其他参数的运算,依赖其他参数得出。例如SESSIONS参数,11g中SESSIONS=(1.5*processes)+22。
b,操作系统依赖参数
某些参数取值依赖或者受限于操作系统。例如db_cache_size参数,该值最大值受限于物理内存大小。
c,可变参数
可变参数包含绝大多数
潜在影响系统性能的可调整参数,某些可变参数设置的是限制条件,如OPEN_
CURSORS;有的参数是设置容量,如 DB_CACHE_SIZE 等。这类参数通常可以为 DBA 或最终用户调整,从而产生限制或性能变化,对 Oracle 至关重要。
d,废弃参数
随着oracle版本更替,部分老的参数在新版本废弃。如在11gR2中,被废弃的参数有lock_sga_areas,instance_nodeset,spin_count等等参数。
3.2,参数获取
a,直观参数获取
在SQL*PLUS中,我们可以通过命令show parameter命令来查看某些参数的设置值:
SQL> show parameter sga;
NAME TYPE VALUE
------------------------------------ --------------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 940M
sga_target big integer 0
也可以通过查看视图v$parameter进行查看参数值设置:
select * from v$parameter;
b,隐藏参数获取
oracle中,以“_”开头的初始化参数通常被称为隐藏参数,这些参数具有某些特殊的功能,获取他们需要通过查询特殊的视图进行查看。
SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.KSPPDESC PDESC
FROM SYS.x$ksppi x, SYS.x$ksppcv y
WHERE x.indx = y.indx
AND x.ksppinm LIKE '%&par%';
3.3,参数修改
可以通过 ALTER SYSTEM 或者导入导出来更改 SPFILE 的内容。从 Oracle9i 开始,ALTER SYSTEM 命令增加了一个新的选项:SCOPE。
a,SCOPE 参数有三个可选值:MEMORY ,SPFILE , BOTH
b,MEMORY-只改变当前实例运行,重新启动数据库后失效
c,SPFILE-只改变 SPFILE 的设置,不改变当前实例运行,重新启动数据库后生效
d,BOTH-同时改变实例及 SPFILE,当前更改立即生效,重新启动数据库后仍然有效。
alter sysetm/session set parametername=values scope=memory|spfile|both;
通过select name,isses_modifiable,issys_modifiable from v$parameter来判断参数修改方式:
select distinct issys_modifiable from v$parameter;
false:静态参数,不能直接修改到内存 alter system set parametername=values scope=spfile
immediate scope=memory 动态参数 alter system set parametername=values 既修改到内存,也修改到spfile参数文件
deffered 会话参数alter session
四、概述
oracle参数文件看似简单,实则内容多多。简简单单一个参数文件,其中的任何一个参数 ,在数据库中都起着独当一面的作用。学习参数文件,我们除了了解以上基本内容,还可以深入学习参数文件的备份,参数文件问题等等,在此就不一一介绍了。
---------------------
https://blog.csdn.net/tpc4289/article/details/79065928