Oracle 初始化参数&性能视图
《Oracle初始化参数性能视图》1.数据库版本LEO1@LEO1select*fromv$version;BANNER--------------------------------------------------------------------------
《Oracle 初始化参数&性能视图》
1.数据库版本
LEO1@LEO1>select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux:Version 11.2.0.1.0 - Production
NLSRTL Version11.2.0.1.0 - Production
2.设置memory_target参数,并通过v$memory_target_advice分析数据库的最佳内存大小
Memory_target:1.是oracle11g中的一个内存调整参数,11g对自动化管理内存方面又继续加强了,原来10g中可以对SGA进行自动管理与分配,11g即可以自动管理SGA,又可以自动管理PGA,对这两部分进行综合管理,自动调整所有内存区的大小。11g中默认为0
现在把这几个参数语法列举一下,这是静态参数需要重启数据库生效
alter systemset memory_max_target= 1000m scope=spfile;
alter system set memory_target= 1000m scope=spfile;
alter system set sga_max_size=600m scope=spfile;
alter system set pga_aggregate_target=400m scope=spfile;
2.memory_max_target 是设定 Oracle 能占物理内存多大空间,一个是 Oracle SGA 区最大能占多大内存空间+PGA区多大空间,memory_max_target是memory_target上限值,如果只设置了memory_max_target没有设置memory_target,则Oracle认为memory_target=0不使用内存自动管理。
3.如果只设置memory_target,没有设置memory_max_target,则Oracle自动将memory_max_target设置为memory_target。
4.如果同时设置这两个值,则memory_target的上限值为memory_max_target。
这是我的数据库上的参数值
LEO1@LEO1> showparameter memory_max_target
NAME TYPE VALUE
----------------------------------------------- ------------------------------
memory_max_target big integer 652M
LEO1@LEO1> showparameter memory_target
NAME TYPE VALUE
----------------------------------------------- ------------------------------
memory_target big integer 652M
5. 10g 的sga_max_size 是动态分配 Shared Pool Size,database buffer cache,largepool,java pool,redo log buffer 大小的,根据 Oracle 运行状态来重新分配 SGA 各内存区大小。 PGA 在 10g 中需要单独设定(即手工管理)。
实验
下面我们通过以下的几个命令来让大家清楚memory_target 的设置与PGA和SGA的关系
(1)memory_target设置为非0值
Memory_Target=SGA_TARGET+PGA_AGGREGATE_TARGET ,大小等于memory_max_size 一致。
sga_target和pga_aggregate_target都设置了大小,则这两个参数将做为最小起始值
sga_target 设置大小, pga_aggregate_target 没有设置大小
那么 pga_aggregate_target 初始化值 =memory_target-sga_target
sga_target 没有设置大小, pga_aggregate_target 设置大小
那么 sga_target 初始化值 =memory_target-pga_aggregate_target
sga_target 和pga_aggregate_target都没有设置大小 Oracle 11g 将根据数据库运行状态自动分配大小。但在数据库启动时会有一个固定比例来分配:
sga_target =memory_target *60% pga_aggregate_target=memory_target *40%
(2)memory_target没有设置或等于0(11g中默认为0)
11g中默认为0则初始状态下取消了 memory_target 的作用,完全和10g在内存管理上一致,完全向下兼容。
(也有三种情况来对 SGA 和 PGA 的大小进行分配)
SGA_TARGET 设置值,则自动调节 SGA 中的 shared pool,buffer cache,redo logbuffer,java pool,larger pool内存区,PGA 则依赖 pga_aggregate_target 的大小单独设置。 sga和 pga不能自动增长和自动缩小。
SGA_target 和PGA_AGGREGATE_TARGET 都没有设置,SGA 中的各内存区大小都要明确设定,不能自动调整各内存区大小。PGA 不能自动增长和收缩。
memory_max_target设置而memory_target =0 这种情况和10g 一样不使用内存自动管理
LEO1@LEO1> showparameter target
NAME TYPE VALUE
----------------------------------------------- ------------------------------
archive_lag_target integer 0
db_flashback_retention_target integer 1440
fast_start_io_target integer 0
fast_start_mttr_target integer 0
memory_max_target big integer 652M
memory_target big integer 652M
parallel_servers_target integer 8
pga_aggregate_target big integer 0
sga_target big integer 0
现在我们看到sga_target和pga_aggregate_target的值都是0,由oracle自动调整大小,memory_target和memory_max_target的大小是652M
LEO1@LEO1>select * from v$memory_target_advice; 分析数据库最佳内存大小
MEMORY_SIZE MEMORY_SIZE_FACTORESTD_DB_TIME ESTD_DB_TIME_FACTOR VERSION
----------------------------- ------------ ------------------- ----------

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The function in Oracle to calculate the number of days between two dates is DATEDIFF(). The specific usage is as follows: Specify the time interval unit: interval (such as day, month, year) Specify two date values: date1 and date2DATEDIFF(interval, date1, date2) Return the difference in days

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

The Oracle database startup sequence is: 1. Check the preconditions; 2. Start the listener; 3. Start the database instance; 4. Wait for the database to open; 5. Connect to the database; 6. Verify the database status; 7. Enable the service (if necessary ); 8. Test the connection.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

The INTERVAL data type in Oracle is used to represent time intervals. The syntax is INTERVAL <precision> <unit>. You can use addition, subtraction, multiplication and division operations to operate INTERVAL, which is suitable for scenarios such as storing time data and calculating date differences.

To find the number of occurrences of a character in Oracle, perform the following steps: Get the total length of a string; Get the length of the substring in which a character occurs; Count the number of occurrences of a character by subtracting the substring length from the total length.

The method of replacing strings in Oracle is to use the REPLACE function. The syntax of this function is: REPLACE(string, search_string, replace_string). Usage steps: 1. Identify the substring to be replaced; 2. Determine the new string to replace the substring; 3. Use the REPLACE function to replace. Advanced usage includes: multiple replacements, case sensitivity, special character replacement, etc.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.
