search
HomeDatabaseMysql TutorialOracle数据库归档日志满后造成系统宕机解决一例

第一次宕机时,初始以为是系统内存溢出,于是重启应用服务器,发现应用服务器在启动时报错,错误为无法连接到Oracle数据库。于是

第一次宕机时,初始以为是系统内存溢出,于是重启应用服务器,发现应用服务器在启动时报错,错误为无法连接到Oracle数据库。于是连接数据库服务器,打开EM后发现系统报错如图:

提示归档日志写入失败,检查服务器发现磁盘空间满了,于是清理磁盘空间后,重启数据库问题解决。随后把服务器磁盘空间扩容,直接给了oracle数据所在盘1TB的磁盘空间。

第二次又出现此问题,经过仔细检查,并与同事确认后,发现是由于ORACLE数据库的归档日志被启用了,而我们系统默认是没有启用ORACLE数据库归档日志这个功能的。

使用sql命令查看:

Sql>sqlplus / as nolog;---------------------启动sql*Plus

Sql> connect sys/password@orcl as sysdba;

Sql> archive log list;

数据库日志模式 存档模式

自动存档 启用

存档终点 USE_DB_RECOVERY_FILE_DEST

最早的联机日志序列 4888

下一个存档日志序列 4890

当前日志序列 4890

Sql> show parameter db_recovery_file_dest;

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest string D:\oracle\product\10.2.0/flash_recovery_area

db_recovery_file_dest_size big integer 20G

处理方法:

一、首先要处理日志空间满的情况:

1.指定数据库实例

C:/Documents and Settings/Administrator>SET ORACLE_SID =orcl

2.连接数据库

C:/Documents and Settings/Administrator>RMAN TARGET SYS/password@orcl

3.查看归档日志的状态

RMAN> list archivelog all;

4.手工删除归档日志文件

RMAN> exit

SQL> alter system set db_recovery_file_dest_size=214748364800;---设置使用空间大小(20*1024*1024*1024)

System altered

SQL> show parameter db_recovery_file_dest;---查看归档日志路径限额

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest string D:\oracle\product\10.2.0/flash_recovery_area

db_recovery_file_dest_size big integer 200G

然后重启数据库后,系统可以正常使用了。

但是,由于启用了归档日志,即便设置成了200G的使用空间,按照每天2G的数据增长量,也就3个月数据就能达到了,需要定制任务定时清理归档日志,而删除归档日志只有在RMAN里才能进行,于是在数据库服务器上新建一个bat文件(文件名随意)

编辑此文件为:

rman target 'sys/password' cmdfile 'd:\cmd.txt'―――此处路径、文件名随意

在命令中对应的路径下新建cmd.txt文件,打开编辑此文件,

DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

然后在Windows计划任务里添加任务,指定每天定时执行此bat文件。

经过一周的运行,归档日志每天定时被清理。系统正常。

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

本文永久更新链接地址:

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]

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 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.

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 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)

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.

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

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

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.