search
HomeDatabaseMysql TutorialOracle pfile/spfile参数文件详解

基本规则

  a.在SPFile文件中,所有参数都是可选的,也就是说只需要在初始化参数文件中列出那些需要修改的参数,其它保持默认值即可。

  b.SPFile文件中只能包含参数赋值语句和注释语句。注释语句以“#”符合开头,是单行注释。

  c.SPFile文件中列出的参数是不分次序的。

  d.SPFile参数的名称和值是不区分大小写的,只有在Unix系统中,由于操作系统本身区分文件名称和路径的大小写,才需要在设置参数时注意大小写问题。

  e.若要在SPFile文件的同一行设置多个参数,需要使用空格分隔。比如:PROCESSES=100 CPU_COUNT=1 OPEN_CURSORS=10

  f.对于可以具有多个值的初始化参数,需要将所有的值放在一个括号内,并使用逗号进行分隔,比如ROLLBACK_SEGMENTS=(SEG1,SEG2,SEG3,SEG4,SEG5)

  g.在SPFile文件中,可以使用IFILE参数引用其它的SPFile文件。

  h.对于具有字符串类型值的参数,如果字符串中包含空格或制表符,必须使用单引号或双引号将字符串括起来,比如:NLS_TERRITORY="CZECH REPUBLIC"

  常用参数:

  DB_NAME和DB_DOMAIN

  全局名通常由本地数据库标识(DB_NAME)和网络域名(DB_DOMAIN)组成,在网络中唯一标识一个Oracle,在只有一个实例的情况下,DB_NAME与实例标识SID相同。

  全局数据库名在数据库创建后可以更改,使用【Alter DataBase RENAME GLOBAL_NAME】语句,语句执行成功后,必须重启Oracle并重建控制文件(重建控制文件是一件比较危险的工作,因此,建议避免修改全局数据库名)。

  DB_NAME同时存储在数据文件、控制文件和重做日志文件中,如果DB_NAME参数指定的数据库名与控制文件的保持不一致,Oracle将无法启动。

  CONTROL_FILE

  控制文件保存有关于数据库物理结构的基本信息,每个Oracle都必须至少拥有一个控制文件。Oracle建议创建两个控制文件,并且应当将他们分别放置在不同点硬盘上。

  DB_Block_Buffer

  这部分内存的作用主要是在内存中缓存从数据库中读取的数据块,数据库缓冲区越大,为用户已经在内存里的共享数据提供的内存就越大,这样可以减少所需要的磁盘物理读写次数。

  在Oracle 9i以前版本数据库中,缓冲是由db_block_buffers*db_block_size来决定,db_block_size参数是在创建数据库时设置的,它决定数据库里每个块的大小,9i以前不能改变已经存在的数据库的块大小,因此应该在最初创建数据库时就确保设置适当的数据库块大小。在创建数据库时设置为8k,db_block_buffers*db_block_size的乘积占物理内存的20%~30%,物理内存在1G以内,可以占20%,1G~2G之间可占25%,物理内存在2G以上,可以占30%,甚至更高。

  DB_Block_Lru_Latches

  在多CPU机器上通过初始化参数DB_BLOCK_LRU_LATCHES允许多个LRU锁存器。当DBWR和服务器进程扫描数据块缓冲Cache时,它们需要获取LRU锁存器。这种锁存器对于避免缓冲区变脏以及避免被其他进程改变都是必要的,这也避免了扫描时返回不一致的结果。如果没有使用锁存器,某个扫描自由缓冲区的进程可能会发现一个自由缓冲区,但是立刻就可能被其他进程使用。每一个LRU 锁存器至少保护50个数据块缓冲区。所有缓冲区都被Oracle基于Hash算法分配到特定的LRU锁存器之上。如果该值太小,在数据库活动量很大时就会潜在地导致竞争。在多CPU机器之上这种竞争会高一些,这是因为多个服务器进程可能排队以获取一个LRU Cache。该参数默认值为CPU个数的一半,在多CPU系统中,推荐设为等于CPU数目或CPU数目的2倍~3倍(在Oracle 9i中,该参数已经变为一个隐含参数)。

  DB_BLOCK_SIZE

 

  数据库块(BLOCK)是Oracle用来管理存储空间的最小单元,也被称为Oracle块,一个Oracle块可以由一个或多个操作系统快组成。

  Oracle块的大小在创建Oracle时由DB_BLOCK_SIZE指定,并且在Oracle建立后不能更改。DB_BLOCK_SIZE指定的值为标准Oracle块的大小,SYSTEM表空间及其其它表空间的默认地使用标准Oracle块。标准Oracle块必须是操作系统的整数倍,通常是4KB或8KB,随着数据库块大小的增加,数据库对内存(SGA区)的需求也会随着增加。

  注:在Oracle9i中,最多支持使用四种不同大小的非标准Oracle块,可以是2KB、4KB、8KB、16KB或32KB中的任意四个。

  DB_Cache_Size

  SGA区是Oracle实例的重要组成部分,它是由操作系统专门分配给Oracle使用的一块共享内存区。

  该参数直接指定SGA区中数据库告诉缓存区的大小(以KB或MB为单位),动态参数,可以在实例运行过程中动态改变。

  DB_File_MultibLock_Read_Count

  该参数主要同全表扫描有关。当Oracle在请求大量连续数据块的时候,该参数控制块的读入速率。DB_FILE_MULTIBLOCK_READ_COUNT参数能对系统性能产生较大的影响,它和DB_BLOCK_SIZE参数之间有重要关系。因为在Unix物理层上,Oracle总是以最小64K的数据库块进行读入,因此应该使这2个参数的乘积为64K。即如果DB_BLOCK_SIZE为8192,则DB_FILE_MULTIBLOCK_READ_COUNT应设为8。

  DB_nK_CACHE_SIZE

  如果要在数据库中使用非标准块,除了使用DB_CACHE_SIZE参数外,至少还要指定一个DB_nK_CACHE_SIZE参数。

  DB_nK_CACHE_SIZE一共有5个:DB_2K_CACHE_SIZE、DB_4K_CACHE_SIZE、DB_8K_CACHE_SIZE、DB_16K_CACHE_SIZE、DB_32K_CACHE_SIZE

  DB_Queue_Process

  该参数指定每个例程的SNP作业队列进程的数量。当使用job或复制时,一定要设置该参数,推荐设为3或4。并行查询中需要设置的参数

  并行查询仅当在多CPU处于空闲状态且数据分布在不同磁盘时才会对某些查询(有全表扫描操作)的性能产生有益的影响,而且即使在这种情况下,并行查询服务器的最大数量最好也不要超过CPU的数量。这里面应该修改的参数如下。

  

   DML_Locks

  该参数表示所有用户获取的表锁的最大数量。对每个表执行 DML 操作均需要一个 DML锁。例如,如果3个用户修改 2 个表,就要求该值为 6。该值过小可能会引起死锁问题。这个参数同transaction参数有关系,缺省为4倍的transaction大小。建议该参数不应该低于600,可以检查系统的当前值,若比600小,则将transaction参数改为150以上,dml_locks参数会自动变为transaction的4倍。

  Java_Pool_Size

  Oracle 8i以后版本中,Oracle数据库内置了对Java的支持,短消息系统并未使用这些功能,因此java_pool_size的值可以减少到1M。但如果数据库安装时选择了JServer组件,则这个值可以设置为20M~30M之间。(可以查询v$option动态视图,如果java那一项值为true,则表示安装了JServer,为false,表示未安装)。

  Large_Pool_Size

  Oracle的large_pool用于MTS、并行查询和RMAN。如果使用了MTS或RMAN,large_pool特别有用,它可以降低用户对shared_pool的争用,这个参数不推荐设置。(或设为1M)。

  Log_Buffer

  Log_buffer是重做日志缓冲区,对数据库的任何修改都按顺序被记录在该缓冲,然后由LGWR进程将它写入磁盘。LGWR的写入条件是:用户提交、有1/3重做日志缓冲区未被写入磁盘、有大于1M重做日志缓冲区未被写入磁盘、超时、DBWR需要写入的数据的SCN 号大于LGWR记录的SCN 号,DBWR 触发LGWR写入。从中可以看出,大于1M的log buffer值意义并不大,建议不论物理内存多

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
MySQL's Place: Databases and ProgrammingMySQL's Place: Databases and ProgrammingApr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL: From Small Businesses to Large EnterprisesMySQL: From Small Businesses to Large EnterprisesApr 13, 2025 am 12:17 AM

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

What are phantom reads and how does InnoDB prevent them (Next-Key Locking)?What are phantom reads and how does InnoDB prevent them (Next-Key Locking)?Apr 13, 2025 am 12:16 AM

InnoDB effectively prevents phantom reading through Next-KeyLocking mechanism. 1) Next-KeyLocking combines row lock and gap lock to lock records and their gaps to prevent new records from being inserted. 2) In practical applications, by optimizing query and adjusting isolation levels, lock competition can be reduced and concurrency performance can be improved.

MySQL: Not a Programming Language, But...MySQL: Not a Programming Language, But...Apr 13, 2025 am 12:03 AM

MySQL is not a programming language, but its query language SQL has the characteristics of a programming language: 1. SQL supports conditional judgment, loops and variable operations; 2. Through stored procedures, triggers and functions, users can perform complex logical operations in the database.

MySQL: An Introduction to the World's Most Popular DatabaseMySQL: An Introduction to the World's Most Popular DatabaseApr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

The Importance of MySQL: Data Storage and ManagementThe Importance of MySQL: Data Storage and ManagementApr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system suitable for data storage, management, query and security. 1. It supports a variety of operating systems and is widely used in Web applications and other fields. 2. Through the client-server architecture and different storage engines, MySQL processes data efficiently. 3. Basic usage includes creating databases and tables, inserting, querying and updating data. 4. Advanced usage involves complex queries and stored procedures. 5. Common errors can be debugged through the EXPLAIN statement. 6. Performance optimization includes the rational use of indexes and optimized query statements.

Why Use MySQL? Benefits and AdvantagesWhy Use MySQL? Benefits and AdvantagesApr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Describe InnoDB locking mechanisms (shared locks, exclusive locks, intention locks, record locks, gap locks, next-key locks).Describe InnoDB locking mechanisms (shared locks, exclusive locks, intention locks, record locks, gap locks, next-key locks).Apr 12, 2025 am 12:16 AM

InnoDB's lock mechanisms include shared locks, exclusive locks, intention locks, record locks, gap locks and next key locks. 1. Shared lock allows transactions to read data without preventing other transactions from reading. 2. Exclusive lock prevents other transactions from reading and modifying data. 3. Intention lock optimizes lock efficiency. 4. Record lock lock index record. 5. Gap lock locks index recording gap. 6. The next key lock is a combination of record lock and gap lock to ensure data consistency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft