search
HomeDatabaseMysql TutorialORA-04031报错导致的数据库重启

Linux公社(www.linuxidc.com)是专业的Linux系统门户网站,实时发布最新Linux资讯,包括Linux、Ubuntu、Fedora、RedHat、红旗Linux、Linux教程、Linux认证、SUSE

环境:

OSAIX Version 6.1

Oracle : 10.2.0.5 rac(节点rac2

一、问题描述

晚上22:40 收到一条短信,数据库挂了,立马连上数据库,在日志里面发现:

从日志里面看问题很明显:是由于ora04031导致数据库重启。

二、分析与解决问题思路:

ora04031错误导致后台进程LCK0挂了,进而导致数据库重启:

查看当前数据库相关参数:

查看awr:

这里可以看出shared pool size 8G buffer cache 160G,有7个子池

查看dump文件/oracle/product/admin/oss139/bdump/oss1392_lck0_6685174.trc

Memory Utilization of Subpool 1

================================

Allocation Name Size

_________________________ __________

"free memory " 19127320 19M

Memory Utilization of Subpool 2

================================

Allocation Name Size

_________________________ __________

"free memory " 131103400 130M

Memory Utilization of Subpool 3

================================

Allocation Name Size

_________________________ __________

"free memory " 19409776 19M

 

 

 

 

Memory Utilization of Subpool 4

================================

Allocation Name Size

_________________________ __________

"free memory " 19172224 19M

emory Utilization of Subpool 5

================================

Allocation Name Size

_________________________ __________

"free memory " 18623928 18M

Memory Utilization of Subpool 6

================================

Allocation Name Size

_________________________ __________

"free memory " 18026416 18M

Memory Utilization of Subpool 7

================================

Allocation Name Size

_________________________ __________

"free memory " 12162296 12M

 

相比前一天总free memory下降到只有200多M,,对应的gcs resources,gcs shadows却占用了5G多空间,gcs resourcesgcs shadow资源均是Oracle RAC中特有的全局缓存服务资源,这些资源负责处理RAC中的全局buffer cache

然后查询shared_pool当前的剩余内存:

只有16M了,也就是昨天发生ora 04031并不是偶然。

metalink搜索gcs resource:

Gcs 这两位兄弟会导致ora 04031错误:

那么如何评估gcs的大小?

从上图红线可以看出他的大小依赖于db buffer的大小。

当实例高速缓存buffer cache增加的时候,gcs资源所占用的空间也相应增长,具体算法如下:Example with Linux x86-64 / 10.2.0.4

o v$resource_limit


Resource Name Current Max Initial Limit
-------------- ------- ------- ------- -------
gcs_resources 585758 1110251 1113203 1113203
gcs_shadows 909888 1111054 1113203 1113203

o Initial shared memory in theory,
gcs resources = 1113203 * 120(+alpha) bytes = 133,584,360 (+alpha) bytes
gcs shadows = 1113203 * 72(+alpha) bytes = 80,150,616 (+alpha) bytes

o Actual size in shared pool
gcs resources = 185,766,864 bytes
gcs shadows = 107,993,760 bytes
Practically, a little bigger memory is used because gcs resources/shadows
structure sizes are different depending on Oracle versions and platforms.

也就是加大shared_pool

linux

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
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

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 Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools