标签:oracle11g
一.参数文件的作用:
参数文件记录了数据库的配置。在数据库启动时,Oracle 要根据参数文件中的参数设置,
配置数据库。如要为各个内存池分配多少内存,允许打开的进程数和会话等等。要想让数
据库启动,必需先读取参数文件。参数文件中的参数,我们通常称其为初始化参数,简称就
是参数。
二.参数文件共有两种参数文件
参数文件包含pfile 和spfile。区别如下:
1.PFILE 为文本文件,可以使用vi编辑器进行修改,可以放在客户端和服务端。
文件名为:init<sid>.ora。
从oracle 10g开始就不使用pfile。
oracle 10g默认的pfile的文件放置在:$oracle_home/dbs/init$ORACLE_SID.ora
参数文件的查找原则: spfilesid.ora ,spfile.ora, initsid.ora
修改范围:通过命令只能修改内存(scope=memory),手动修改参数文件。
2.SPFILE
是二进制文件,从oracle9i开始才有,只能放在oracle服务器端,可以被rman备份。
文件名称为:spfile<sid>.ora 。
通过命令修改: alter system set parameter_name=values <>;
spfile存放的位置:$oracle_HOME/dbs/spfile$ORACLE_SID.ora
修改范围:通过命令修改内存和参数文件。
3.oracle 启动要用参数文件的查找顺序:
先找spfile<sid>.ora文件,如果没找到就找spfile.ora,如果没找到就找init<sid>.ora,如果都没找到就报错了。
从oracle 10g开始就不使用pfile。
4.考试时使用pfile启动哦。
5.参数文件在文档中的位置:
oracle 10g: 在 Administration -> Monitoring (里面有个initialization parameters)
oracle 11g:Database Administration->Supporting Documentation->Reference-> 1 Initialization Parameters
三.参数文件的转换:
从oracle 10个默认都使用spfile文件。
1. spfile转成pfile:
SQL> create pfile from spfile。
会在$ORACLE_HOME/dbs/init$ORACLE_SID.ora文件
或指定路径
SQL> create pfile=“---” from spfile;
2.pfile 转成spfile
SQL> create spfile from pfile #当数据库使用spfile启动时,该转化会失败,因为spfile正在使用。
SQL> create spfile from pfile="---";
3.oracle 11g 可以使用内存生成spfile文件。
SQL> create spfile=“---” from memory;
四.查看当前数据库使用的参数文件是哪一个:
1.查询V$spparameter视图。
SQL> select distinct ISSPECIFIED from v$spparameter;
ISSPEC
------
TRUE
FALSE
看查询结果的第一个值,为false 则使用pfile。为true 则使用spfile。 当有多个值的时候,说明pfile是存在的。
2.修改参数判断:
执行alter system set sga_target=200m scope=spfile,如果可以修改,表示是使用spfile,不能修改是使用pfile。
3.查看参数spfile(较实用)
当VALUE有值时,表示用spfile启动的,value没有值时用pfile启动的
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/11.2.0/db_home
_1/dbs/spfileorcl.ora
五.修改参数文件:
1.如果启动使用pfile 直接编辑,下次启动生效。
使用pfile 启动数据库:
SQL> startup pfile="pfile路径";
2.如果启动使用spfile:
①.修改指令:alter system set parametername=values scope=memory|spfile|bothsid=‘sid‘|‘*‘
scope取值:memory:只对当前instance内存有效,下次启动无效。
spfile:只对spfile修改,必须下次启动才生效,当前实例内存没有修改。
both:是scope的默认值,内存和spfile都被修改。
②.alter session set parametername= value; 只对当前session生效。
③.system|session的区别:
查询v$parameter视图, isses_modifiable =true 可以被alter session修改。
issys_modifiable =immediate/DEFERRED 可以被alter
system修改(详见七).
--查看视图
SQL> desc v$parameter;
Name Null? Type
----------------------------------------- -------- ----------------------------
NUM NUMBER
NAME VARCHAR2(80)
TYPE NUMBER
VALUE VARCHAR2(512)
DISPLAY_VALUE VARCHAR2(512)
ISDEFAULT VARCHAR2(9)
ISSES_MODIFIABLE VARCHAR2(5)
ISSYS_MODIFIABLE VARCHAR2(9)
ISINSTANCE_MODIFIABLE VARCHAR2(5)
ISMODIFIED VARCHAR2(10)
ISADJUSTED VARCHAR2(5)
ISDEPRECATED VARCHAR2(5)
DESCRIPTION VARCHAR2(255)
UPDATE_COMMENT VARCHAR2(255)
HASH NUMBER
sid 取值:适用于RAC集群环境 sid:表示修改当前实例。
*: 表示修改所有实例。
六.修改参数:
1.修改sga_target
--查看参数
SQL> show parameter sga_
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_max_size big integer 160M
sga_target big integer 160M
--修改参数值,下次启动生效:
SQL> alter system set sga_max_size=200m scope=spfile;
System altered.
--在集群条件下要指定sid
SQL> alter system set sga_max_size=200m scope=spfile sid=‘orcl‘;
2.修改pga
--查看pga大小
SQL> show parameter pga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target big integer 16M
--修改当前内存中的pga大小,不修改spfile中的
SQL> alter system set pga_aggregate_target=20m scope=memory;
七.v$parameter 视图中 issys_modifiable 取值的意思:(静态参数与动态参数)
SQL> select distinct issys_modifiable from v$parameter;
ISSYS_MOD
---------
IMMEDIATE
FALSE
DEFERRED
IMMEDIATE: 表示动态参数,直接修改到参数文件和内存的参数,立即成效,alter system set <> =<>;
false: 表示静态参数, 不能直接修改到内存,只能通过,alter system set <> = <> scope=spfile 下次启动数据库生效。
deferred: 延迟生效,后续新的session中有效(不考虑是否用pfile或spfile启动)。 alter system set <> =
<> ;
八.oracle 10g系统常用的参数:查看pfile文件 initorcl.ora
警告日志
*.audit_file_dest=‘/opt/oracle/102/admin/orcl/adump‘
后台进程日志
*.background_dump_dest=‘/opt/oracle/102/admin/orcl/bdump‘
版本兼容号,往后兼容不往前兼容。
*.compatible=‘10.2.0.1.0‘
定义控制文件
*.control_files=‘/opt/oracle/oradata/orcl/control01.ctl‘,‘/opt/oracle/oradata/orcl/control02.ctl‘,‘/opt/oracle/oradata/orcl/control03.ctl‘
服务器进程的日志
*.core_dump_dest=‘/opt/oracle/102/admin/orcl/cdump‘
内存块的大小 (8k)
*.db_block_size=8192
域名后缀
*.db_domain=‘‘
指定一次性读取多少个块
*.db_file_multiblock_read_count=16
*.db_name=‘orcl‘
系统当中的一些日志存放的路径,叫闪回区。
*.db_recovery_file_dest=‘/opt/oracle/102/flash_recovery_area‘
#闪回区大小
*.db_recovery_file_dest_size=2147483648
共享服务器配置参数
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=orclXDB)‘
作业进程数
*.job_queue_processes=10
打开游标的个数
*.open_cursors=300
pga大小
*.pga_aggregate_target=16777216
定义当前系统可以运行150个进程
*.processes=150
远程登录的用户要不要用密码文件验证
*.remote_login_passwordfile=‘EXCLUSIVE‘
sga大小
*.sga_target=167772160
undo表空间的管理方式为自动管理,还可以取值manual,
*.undo_management=‘AUTO‘
指定使用undo表空间
*.undo_tablespace=‘UNDOTBS1‘
指定调试跟踪文件的目录
*.user_dump_dest=‘/opt/oracle/102/admin/orcl/udump‘
九.静态参数和动态参数:
动态参数:修改动态参数不用重启数据库即可生效。
文档中Modifiable对应的值为ALTER SYSTEM表示该参数为动态参数
静态参数: 修改静态参数需要重启数据库才能生效。
文档中Modifiable对应的值为NO表示该参数为静态参数
#spfile启动数据库时,修改静态参数,不能修改内存中的值,只能修改spfile,重启数据库才生效。
SQL> alter system set sga_max_size=500m scope=both;
alter system set sga_max_size=500m
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> alter system set sga_max_size=500m scope=spfile;
System altered.
九.隐藏参数:
SQL> desc x$ksppi
Name Null? Type
----------------------------------------- -------- ----------------------------
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSPPINM VARCHAR2(80)
KSPPITY NUMBER
KSPPDESC VARCHAR2(255)
KSPPIFLG NUMBER
KSPPILRMFLG NUMBER
KSPPIHASH NUMBER
SQL> desc x$ksppcv
Name Null? Type
----------------------------------------- -------- ----------------------------
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
KSPPSTVL VARCHAR2(512)
KSPPSTDVL VARCHAR2(512)
KSPPSTDF VARCHAR2(9)
KSPPSTVF NUMBER
KSPPSTCMNT VARCHAR2(255)
--查找隐藏参数:
SQL> select ksppinm,ksppstvl from x$ksppi a,x$ksppcv b where a.indx=b.indx
十.删除参数,使参数变为默认值:
1.pfile参数的删除:直接修改文本。
2.删除spfile的参数:要带上scope=spfile sid=‘*‘,才能删除掉。
SQL> alter system reset pga_aggregate_target scope=spfile sid=‘*‘;
十一.事件参数: (优化的时候讨论)
alter session set events ‘<>‘;
十二.总结遇到的初始化参数:
1.filesystemio_options :
2.SEC_PROTOCOL_ERROR_FURTHER_ACTION
SEC_PROTOCOL_ERROR_FURTHER_ACTION
specifies the further execution of a server process when receiving bad packets from a possibly malicious client.
Values:
-
CONTINUE
The server process continues execution. The database server may be subject to a Denial of Service (DoS) if bad packets continue to be sent by a malicious client.
-
(DELAY,
integer
)
The client experiences a delay of integer seconds before the server process accepts the next request from the same client connection. Malicious clients are prevented from excessive
consumption of server resources while legitimate clients experience a degradation in performance but can continue to function.
-
(DROP,
integer
)
The server forcefully terminates the client connection after integer cumulative bad packets. The server protects itself at the expense of the client (for example, a client transaction
may be lost). The client may reconnect and attempt the same operation.
3.DB_ULTRA_SAFE (11g新参数)
Purpose
The purpose of this article is to cover the new parameter DB_ULTRA_SAFE which is a new parameter introduced in 11g.
Through the creation of a new initialization parameter, DB_ULTRA_SAFE={off, data_only, data_and_index}, this capability provides an integrated mechanism to offer protection from various possible data corruptions that may impact Oracle Database. This feature
improves the data protection capabilities of Oracle Database by offering an integrated mechanism to control various levels of protection from data corruptions. By making it possible to detect data corruptions in a timely manner, this feature also provides
critical high availability benefits for Oracle Database.
New Parameter DB_ULTRA_SAFE introduce In 11g
Set DB_ULTRA_SAFE initialization parameter to automatically configure the appropriate data protection block checking level in the database.
Controls the setting of other related initialization parameters, including DB_BLOCK_CHECKING, DB_BLOCK_CHECKSUM, and DB_LOST_WRITE_PROTECT.
Different values that can be set for this parameter are
DB_ULTRA_SAFE = { OFF | DATA_ONLY | DATA_AND_INDEX }
By default its OFF.
Description of these values are given below
Values:
+ OFF
When any of DB_BLOCK_CHECKING, DB_BLOCK_CHECKSUM, or
DB_LOST_WRITE_PROTECT are explicitly set, no changes are made.
+ DATA_ONLY
DB_BLOCK_CHECKING will be set to MEDIUM.
DB_LOST_WRITE_PROTECT will be set to TYPICAL.
DB_BLOCK_CHECKSUM will be set to FULL.
+ DATA_AND_INDEX
DB_BLOCK_CHECKING will be set to FULL.
DB_LOST_WRITE_PROTECT will be set to TYPICAL.
DB_BLOCK_CHECKSUM will be set to FULL.
This parameter cannot be changed dynamically .
For example :
alter system set db_ultra_safe=data_only scope=spfile;
Restart the database for the new change to come into effect
4.log_archive_format:
LOG_ARCHIVE_FORMAT
is applicable only if you are using the redo log in ARCHIVELOG
mode. Use a text string and variables to specify the default filename format when archiving redo log files.
The string generated from this format is appended to the string specified in the LOG_ARCHIVE_DEST
parameter.
The following variables can be used in the format:
%s
log sequence number
%S
log sequence number, zero filled
%t
thread number
%T
thread number, zero filled
%a
activation ID
%d
database ID
%r
resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database
Using uppercase letters for the variables (for example, %S
) causes the value to be fixed length and padded to the left with zeros. An example of specifying the archive redo log filename format follows:
LOG_ARCHIVE_FORMAT = ‘log%t_%s_%r.arc‘
Neither LOG_ARCHIVE_DEST
nor LOG_ARCHIVE_FORMAT
have to be complete file or directory specifiers themselves; they only need to form a valid file path after the variables are substituted
into LOG_ARCHIVE_FORMAT
and the two parameters are concatenated together.
5.SEC_MAX_FAILED_LOGIN_ATTEMPTS
You can limit the number of failed login attempts for application connections by setting the SEC_MAX_FAILED_LOGIN_ATTEMPTS initialization parameter to restrict the number of authentication attempts on a connection. After the specified number of authentication
attempts fail, the database process drops the connection. By default, SEC_MAX_FAILED_LOGIN_ATTEMPTS is set to 10.
Remember that the SEC_MAX_FAILED_LOGIN_ATTEMPTS initialization parameter is designed to prevent potential intruders from attacking your applications; it does not apply to valid users. The sqlnet.ora INBOUND_CONNECT_TIMEOUT parameter and the FAILED_LOGIN_ATTEMPTS
initialization parameter also restrict failed logins, but the difference is that these two parameters only apply to valid user accounts.
【11g体系结构,6】参数文件和一些参数
标签:oracle11g
原文地址:http://blog.csdn.net/wendelee/article/details/39176673