Home Database Mysql Tutorial ORACLE 11G RAC REDO LOG 生产库扩容

ORACLE 11G RAC REDO LOG 生产库扩容

Jun 07, 2016 pm 05:41 PM
oracle rac Production

最近单位的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;

如图:

 

 

 

 

操作完毕。

 

本文出自 “没落的星辰” 博客,请务必保留此出处

Statement of this Website
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

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 Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1667
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

How to export oracle view How to export oracle view Apr 12, 2025 am 06:15 AM

Oracle views can be exported through the EXP utility: Log in to the Oracle database. Start the EXP utility, specifying the view name and export directory. Enter export parameters, including target mode, file format, and tablespace. Start exporting. Verify the export using the impdp utility.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

What to do if the oracle log is full What to do if the oracle log is full Apr 12, 2025 am 06:09 AM

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

What steps are required to configure CentOS in HDFS What steps are required to configure CentOS in HDFS Apr 14, 2025 pm 06:42 PM

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

How to stop oracle database How to stop oracle database Apr 12, 2025 am 06:12 AM

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

See all articles