Home Database Mysql Tutorial Oracle 参数调优

Oracle 参数调优

Jun 07, 2016 pm 04:07 PM

Oracle数据库升级助手(DBUA)配置工具包括一个自动扩展系统文件的命令选项,能够从oracle express(XE或免费版)升级到其 他版本。

一.升级到11gR2之后
Oracle数据库升级助手(DBUA)配置工具包括一个自动扩展系统文件的命令选项,能够从oracle express(XE或免费版)升级到其 他版本。
 升级前脚本检查以下各项:
 1.无效用户或角色
 2.无效数据类型或对象
 3.不支持的字符集
 4.统计信息的收集
 5.足够的资源(undo/rollback段,表空间和空闲磁盘空间)
 6.缺失的升级需要的脚本
 7.运行的监听器
 8.oracle数据库软件已连接到database vault选件
 如果在安装过程中指定ORACLE_BASE环境变量,oracle将使用此值设置DIAGNOSTIC_DEST参数,其中包括所有的ADR目录。
 
1.11g新特性
 默认安装完,密码是区分大小写的
 SEC_CASE_SENSITIVE_LOGON  默认是true 大小写敏感
 SEC_MAX_FAILED_LOGIN_ATTEMPTS 默认值是10 设定尝试次数。
 
 alter user username account unlock;
 
2.oracle的重要参数
 MEMORY_TARGET
 MEMORY_MAX_TARGET
 SGA_TARGET
 SGA_MAX_SIZE
 PAG_AGGREGATE_TARGET
 DB_CACHE_SIZE
 SHARED_POOL_SIZE


 默认读取参数文件的顺序
 1.spfile.ora
 2.spfile.ora
 3.init.ora
 
 如果使用alter system命令只修改spfile,而且在启动的时候发现设置错误,数据库将不会启动。这时,不能使用alter system命令去解决这个问题,需要根据spfile创建一个pfile,修改这个pfile,然后使用这个pfile来启动数据库。之后需要再创建spfile然后使用spfile重启数据库。
 
 在V$PARAMETER视图里有两个关键的字段(V$PARAMETER显示会话级别有效的参数,V$SYSTEM_PARAMETER显示在整个实例级别有效的参数):
 ISSES_MODIFIABLE:表明拥有alter session权限的用户是否可以在他们的会话级别修改这个初始化参数
 ISSYS_MODIFIABLE:表明拥有ALTER SYSTEM权限的用户是否可以修改这个参数。
 
 select name,value,isdefault,isses_modifiable,issys_modifiable from V$PARAMETER where issys_modifiable 'FALSE' or  isses_modifiable 'FALSE' order by name;
 alter session set sort_area_size=10000000;
 动态地修改初始化参数对开发人员和DBA来说是非常强大的特性。因此,,如果不做限制的话,拥有alter session 特权的用户就可以随意地为某个会话的sort_area_size 分配大于100M的内存。
 
 
3.优化DB_CACHE_SIZE来提高性能
 oracle 10g DB_BLOCK_BUFFERS变为隐含参数,在11g又被启用,默认为0,意思是除非设置它,否则它不会被使用(用DB_CACHE_SIZE取而代之)。
 DB_CACHE_SIZE是为主数据库缓存或存放数据而初始分配的内存量。如果设置了MEMORY_TARGET或SGA_TARGET,那么该参数就无须设置。我们的目标应该是实现一个驻留在内存的数据库,至少要把所有将被查询的数据都放进内存里。
 如果DB_CACHE_SIZE设置太低,不论怎样优化这个系统,oracle也没有足够的内存来有效的执行操作,系统运行状态也会很糟糕。如果设置过高,您的系统可能会使用交换空间,甚至停机。DB_CACHE_SIZE是SGA的一部分,用于存储和处理数据以及查询访问。设置过低,那么最近使用的数据会从内存中清除出去,如果有另外一个查询重新调用这些被清除的数据,就必须重新从磁盘中读取(将会使用到I/O和CPU资源).
 MEMORY_TARGET,SGA_TARGET(如果使用的话)和DB_CACHE_SIZE(如果设置了最小值) 是用来优化数据缓存命中率的关键参数:命中率就是指那些不用从磁盘上执行物理读操作就可以访问到的数据块的比例。
 如果系统负载情况不变,而缓存命中率剧烈变化,就应该立刻调查发生的原因。糟糕的连接和索引也会由于读取许多索引块而产生非常高的命中率,因此一定要保证命中率不是因为这些因素而提高的,而是因为系统经过良好调优而得到的。异常高的命中率通常也暗示有代码用到了糟糕的索引或连接。
 通过比较随时间变化的命中率,可以帮助您注意系统某天发生的重大改变。
 
4.使用V$DB_CACHE_ADVICE优化DB_CACHE_SIZE
 可以利用如下清单查看修改DB_CACHE_SIZE后对数据缓存命中率的影响
 select name,size_for_estimate,size_factor,estd_pyhsical_read_factor from v$db_cache_advice;
 NAME            size_for_estimate          size_factor          estd_pyhsical_read_factor
 DEFAULT  4    .1667   1.8322
 DEFAULT  8    .3333   1.0169
 DEFAULT  12    .5   1.0085
 DEFAULT  16    .6667   1
 DEFAULT  20    .8333   1
 DEFAULT  24    1   1
 当前的缓存大小为24M size_factor=1
 我们可以吧缓存大小减小为16M 并维持当前的缓存命中率,因为SGA减小到16M时,PHYSICAL_READ_FACTOR仍为1


保持数据缓存命中率超过95%
 有些例子中,将命中率从95%增大到98%,就可以显著得提高性能--特别是最后命中在磁盘的那5%是系统的主要延迟,或者说磁盘的缓存已经不够用了。


 
5.监控V$SQLAREA视图以查找较慢的查询
 尽管低于95%的命中率通常都表明DB_CACHE_SIZE被设置得过低。命中率失真和那些非DB_CACHE_SIZE问题包括:
 1.递归调用
 2.缺少索引或抑制索引
 3.内存中驻留的数据
 4.UNDO/回滚段
 5.数倍的逻辑读
 6.导致系统使用CPU的物理读
 通过监控V$SQLAREA视图或企业管理器可以找到较慢的查询。

Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

The relationship between mysql user and database The relationship between mysql user and database Apr 08, 2025 pm 07:15 PM

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

Can mysql and mariadb coexist Can mysql and mariadb coexist Apr 08, 2025 pm 02:27 PM

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Explain different types of MySQL indexes (B-Tree, Hash, Full-text, Spatial). Apr 02, 2025 pm 07:05 PM

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.

See all articles