欢迎投稿

今日深度:

【11g体系结构,6】参数文件和一些参数,11g体系

【11g体系结构,6】参数文件和一些参数,11g体系结构参数


一.参数文件的作用:
参数文件记录了数据库的配置。在数据库启动时,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.


    来源: <http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams227.htm#REFRN10282>  


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


来源: <http://blog.csdn.net/yushangfu/article/details/6692017>  

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

%tthread number

%Tthread 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.


来源: <http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams103.htm>  


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.

























oracle 11g 手动创建数据库 初始化参数文件拷贝到什地方?

初始化文件在装好oracle已经自动生成了。
除非你要修改oracle核心参数。
否则请勿轻易乱修改,不然oracle及有可能启动不起来。
 

Oracle数据库的体系结构特点是什?

还不如直接问体系结构是怎么构架的,到处都是特点,给你一份我的笔记,自己参考
数据库体系结构
数据库体系结构包括了:
1数据库实例
2数据库文件
3用户进程
4服务器进程
5参数文件
6密码文件
7归档日志文件等。
其中,1数据库实例和2数据库文件是本体系结构中的核心部分,他们组合起来构成了oracle服务器,又称为DBMS——数据库管理系统。

1数据库实例(instance)
数据库实例由系统全局区SGA和若干后台进程组成。
SGA:包含数据库高速缓存database buffer cache,共享池shared pool,重做日志缓存redo log buffer cache,流池 streaming pool,以及一些可选内存区如Java池java pool、大池large pool、闪回缓存区flahsback buffer等。而数据库的内存结构则是分为SGA和PGA(PGA介绍参见4服务器进程)。
共享池由库高速缓存和数据字典高速缓存组成,库高速缓存存储最近使用的SQL和PL/SQL语句,数据字典高速缓存存储数据文件、表、索引、列、用户、权限信息等数据库对象的定义。
数据库高速缓存存储最近使用的数据块信息或用户修改过需要写回数据库的数据信息。
大池主要分配共享服务器模式下的UGA内存。
后台进程:包含系统监控进程SMON,进程监控进程PMON,数据库写进程DBWR,日志写进程LGWR,检查点进程CKPT这5个必须启动的进程以及其他的例如归档日志进程ARCH等。

2数据库文件
数据库文件分成三类:数据文件datafiles,控制文件controlfile,重做日志文件redo file。
数据文件:包含数据库中的实际数据,是数据库操作中数据的最终存储位置。
控制文件:包含维护数据库和验证数据库完整性的信息,是二进制文件。
重做日志文件:包含数据库发生变化的记录,在发生故障时用于数据恢复。
数据库文件又有物理结构和逻辑结构之分。
物理结构:指基于操作系统的数据库文件结构,至上而下为“datafile——OS block”,即从操作系统层面来将,数据库文件是作为datafile来存储的,而datafile是以操作系统的最小块来进行排列存储的。注意,数据库文件的最小块是操作系统最小块的正整数倍。
逻辑结构:指oracle基于自身逻辑的抽象结构自上而下一对多关系为“数据库database——表空间tablespace——段segment——区段extent——数据库块oracle block”。
逻辑结构和物理结构的对应关系:tablespace对应了一个或多个datafile,而segment对应同一个tablespcace的一个或者多个datafile的全部或者一部分,extent是datafile的全部或者一部分,也就是说最小的datafile大小为一个区段,oracle block是OS block的正整数倍大小。

3用户进程
用户进程是运行于客户端需要与数据库进行交互的程序,但是它必须经过服务器进程的对接转换,才能实现交互的功能。

4服务器进程
服务器进程是运行在服务器端、服务于用户进程并直接与数据库进行交互的程序。用户进程与服务器进程之间产生一条数据库连接connection,服务器进程与数据库之间产生若干会话代表用户进程的若干个会话。服务器进程有一块专用的内存叫做进程全局区PGA,PGA独立于SGA,直接在操作系统的内存区中分配。
用户全局区UGA表示用户的会话状态,为会话分配内存。在共享服务器模式下,UGA在......余下全文>>
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/3140.html NewsArticle 【11g体系结构,6】参数文件和一些参数,11g体系结构参数 一.参数文件的作用: 参数文件记录了数据库的配置。在数据库启动时,Oracle 要根据参数文件中的参数设置,配置数据库。如...
评论暂时关闭