search
HomeDatabaseMysql TutorialOracle 参数调优

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
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
Detailed explanation of the installation steps of MySQL on macOS systemDetailed explanation of the installation steps of MySQL on macOS systemApr 29, 2025 pm 03:36 PM

Installing MySQL on macOS can be achieved through the following steps: 1. Install Homebrew, using the command /bin/bash-c"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". 2. Update Homebrew and use brewupdate. 3. Install MySQL and use brewinstallmysql. 4. Start MySQL service and use brewservicesstartmysql. After installation, you can use mysql-u

How to use conditional filtering and grouping in MySQL queryHow to use conditional filtering and grouping in MySQL queryApr 29, 2025 pm 03:33 PM

In MySQL, conditional filtering is implemented through the WHERE clause and grouping is completed through the GROUPBY clause. 1. Use the WHERE clause to filter data, such as finding employees with salary above 5,000. 2. Use the GROUPBY clause to group and aggregate data, such as counting the number of employees by department. 3. Choose the appropriate index to optimize query performance and avoid using functions or expressions as WHERE conditions. 4. Combining subqueries and EXPLAIN commands improve the efficiency of complex queries.

How to clear MySQL table data but preserve table structureHow to clear MySQL table data but preserve table structureApr 29, 2025 pm 03:30 PM

In MySQL, clearing table data but preserving table structure can be implemented through the TRUNCATETABLE and DELETE commands. 1. The TRUNCATETABLE command quickly deletes all records and resets the self-increment column. 2. The DELETE command deletes data line by line, does not reset the self-increment column, and can delete specific records in combination with the WHERE clause.

Methods to deduplicate MySQL query resultsMethods to deduplicate MySQL query resultsApr 29, 2025 pm 03:27 PM

Deduplication in MySQL mainly uses DISTINCT and GROUPBY. 1.DISTINCT is used to return unique values, such as SELECTDISTINCTname, ageFROMusers. 2. GROUPBY realizes deduplication through grouping and can perform aggregation operations, such as SELECTid, name, MAX(created_at)aslatest_dateFROMusersGROUPBYname.

How to view information about all databases in MySQLHow to view information about all databases in MySQLApr 29, 2025 pm 03:24 PM

Viewing the information of all databases in MySQL can be achieved in two ways: 1. Use the SHOWDATABASES; command to quickly list all database names. 2. Query the INFORMATION_SCHEMA.SCHEMATA table to obtain more detailed information, such as the database creation time and character set settings.

How to add and delete unique constraints to MySQL tablesHow to add and delete unique constraints to MySQL tablesApr 29, 2025 pm 03:21 PM

In MySQL, you can add and delete unique constraints through the following steps: 1. Add unique constraints when creating a table, using the CREATETABLE statement; 2. Add unique constraints on existing tables, using the ALTERTABLE and ADDCONSTRAINT statements; 3. Delete unique constraints, using the ALTERTABLE and DROPINDEX statements. Unique constraints ensure that the values ​​of a column or columns in the table are unique, prevent data duplication, and maintain data integrity.

How to copy table structure and data in MySQLHow to copy table structure and data in MySQLApr 29, 2025 pm 03:18 PM

The methods of copying table structure and data in MySQL include: 1. Use CREATETABLE...LIKE to copy the table structure; 2. Use INSERTINTO...SELECT to copy the data. Through these steps, data backup and migration can be efficiently performed in different scenarios.

How to get data randomly from MySQL tableHow to get data randomly from MySQL tableApr 29, 2025 pm 03:15 PM

Randomly fetching data from MySQL tables can be done using the RAND() function. 1. Basic usage: SELECTFROMusers ORDERBYRAND()LIMIT5; 2. Advanced usage: SELECTFROMusersWHEREid>=(SELECTFLOOR(RAND()*(SELECTMAX(id)FROMusers)))LIMIT5; Optimization strategy includes using index and pagination query.

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

Video Face Swap

Video Face Swap

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

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment