最近单位的ORACLE数据库运行不稳定,通过查询oracle的alert日志,发现如下报错内容:Thread1cannotallocatenewlog,sequence108922CheckpointnotcompleteCurrentl
最近单位的ORACLE数据库运行不稳定,香港服务器,通过查询oracle的alert日志,发现如下报错内容:
Thread 1 cannot allocate new log, sequence 108922
Checkpoint not complete
Current log# 1 seq# 108921 mem# 0: +DATADG/apts/onlinelog/group_1.262.788509509
Current log# 1 seq# 108921 mem# 1: +ARCHDG/apts/onlinelog/group_1.257.788509511
Thread 1 advanced to log sequence 108922 (LGWR switch)
Current log# 2 seq# 108922 mem# 0: +DATADG/apts/onlinelog/group_2.261.788509511
Current log# 2 seq# 108922 mem# 1: +ARCHDG/apts/onlinelog/group_2.258.788509511
Sat Apr 27 10:25:38 2013
Thread 1 cannot allocate new log, sequence 108923
Checkpoint not complete
Current log# 2 seq# 108922 mem# 0: +DATADG/apts/onlinelog/group_2.261.788509511
Current log# 2 seq# 108922 mem# 1: +ARCHDG/apts/onlinelog/group_2.258.788509511
Thread 1 advanced to log sequence 108923 (LGWR switch)
Current log# 1 seq# 108923 mem# 0: +DATADG/apts/onlinelog/group_1.262.788509509
Current log# 1 seq# 108923 mem# 1: +ARCHDG/apts/onlinelog/group_1.257.788509511
初步判定是ORACLE联机重做日志太小,白天生产库太忙,日志切换频繁造成,由于安装ORACLE时,REDO是按默认设置安装(默认设置是每实例2组联机日志,每组两个成员,每个日志文件50M),未对联机重做日志进行修改,后期由于业务量大幅增加,美国服务器,原有的设置以无法满足现有需要,需对联机日志文件进行扩容。
思路如下:
1、联机重做日志的三种状态
(1)、ACTIVE:活动状态
(2)、INACTIVE:未被使用状态
(3)、CURRENT:当前状态(使用状态)
2、计划对每实例2组联机日志扩充为每实例4组联机日志
3、计划对每个日志文件由50M扩充为200M
注意事项:
1、删除联机日志时,必须保证每个实例有两个日志文件
2、增加联机日志时,脚本中要比单实例增加thread参数来标识某个实例
3、主要使用的动态性能视图有v$log和v$logfile
4、联机日志在删除时必须是INACTIVE状态
5、需在夜晚业务量下降时实施
实施步骤如下:
1、用tail -f alert*.ora命令进一步证实了上述判断,发现联机重做日志切换时间为3分钟左右,日志再次切换时,日志文件状态为ACTIVE,并非是INACTIVE(未使用状态)
2、查询日志组状态
select * from v$log order by thread#,group#;
查询日志各成员信息
select * from v$logfile;
3、必要文件备份
(1)、备份初始化参数文件
create pfile='/home/oracle/bak_pfile_20130427_add_redolog.ora' from spfile;
(2)、备份控制文件
alter database backup controlfile to /home/oracle/bak_controlfile_20130427_add_redolog.ora';
4、增加联机日志文件
alter database add logfile thread 1 group 5('+DATADG/apts/onlinelog/group5_1','+ARCHDG/apts/onlinelog/group5_2') size 200M;
alter database add logfile thread 2 group 6('+DATADG/apts/onlinelog/group6_1','+ARCHDG/apts/onlinelog/group6_2') size 200M;
alter database add logfile thread 1 group 7('+DATADG/apts/onlinelog/group7_1','+ARCHDG/apts/onlinelog/group7_2') size 200M;
alter database add logfile thread 2 group 8('+DATADG/apts/onlinelog/group8_1','+ARCHDG/apts/onlinelog/group8_2') size 200M;
5、查看增加的文件信息
select * from v$log order by thread#,group#;
查询日志各成员信息
select * from v$logfile;
6、将联机日志文件切换到新增加的文件上使用,使1、2、3、4组联机日志文件状态变为INACTIVE
alter system switch logfile;
alter system checkpoint;
7、删除1、2、3、4组联机日志文件
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;
这里发现一个问题,如果联机日志文件时自己创建的,有可能在使用删除命令后,在磁盘阵列中的文件并没有被删除,从而导致空间浪费及重建同名组是报错,如图:
这时需要用ORACLE自带的ASM维护命令asmcmd进入到磁盘阵列中去删除响应的文件即可,如图:
8、重建联机日志1,2,3,4组并分配200M的空间
alter database add logfile thread 1 group 1('+DATADG/apts/onlinelog/group1_1','+ARCHDG/apts/onlinelog/group1_2') size 200M;
alter database add logfile thread 2 group 2('+DATADG/apts/onlinelog/group2_1','+ARCHDG/apts/onlinelog/group2_2') size 200M;
alter database add logfile thread 1 group 3('+DATADG/apts/onlinelog/group3_1','+ARCHDG/apts/onlinelog/group3_2') size 200M;
alter database add logfile thread 2 group 4('+DATADG/apts/onlinelog/group4_1','+ARCHDG/apts/onlinelog/group4_2') size 200M;
9、使用命令切换日志文件,免备案空间,看是否正常
alter system switch logfile;
select * from v$log order by thread#,group#;
select * from v$logfile;
alter system checkpoint;
如图:
操作完毕。
本文出自 “没落的星辰” 博客,请务必保留此出处

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.


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

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6
Visual web development tools