Skip to main content

Database Performance degraded due to heavy redo generation

I recently faced an issue when one of my production database which was running very slow.

A simple select statement on dictionary tables were taking too much time.
Size of one of my tablespace was reaching 100% and the "Alter Tablespace add datafile" command juts to add 1 GB of datafile with autoextend on also went into hang mode.


My initial investigation started with checking CPU and memory of the server. CPU was 80% free and also there was enough memory available on the server.

Next step was to check the active wait events on the database using below query:

select event,count(*) from  gv$session where event not like 'Streams%' and wait_class <> 'Idle' group by event order by 2/

Results of the above query displayed that almost all of my database sessions were waiting on wait event "log file switch (checkpoint incomplete)". Even my session from where I executed the command to add the datafile was waiting on this event. Along with this there was another wait event "db file async I/O submit". These wait events directed me that there is something that is related to redo generation or redo log files. Size of the redo log files was 2.5 GB each which was good enough. Also the size would not have been problem as the database was working fine since a long time and suddenly faced this slowness problem.

Looking into the messages in database alert log file shows that there are frequent log switches, i.e. every 40 seconds which was very high. Oracle recommends to have one log switch in every 20-30 minutes for optimal performance.

Executed the below query to identify which session is generating the high redo.

set linesize 200
col event for a21
col action for a10
col module for a30
col username for a10
col name for a15
select /*+ ordered use_nl(s n) */
substr(n.name, 1, 31) event
,s.value
,n.statistic#,s.sid,a.action,a.module,a.username
from v$statname n,v$sesstat s,v$session a
where n.statistic# = s.statistic#(+)
and a.username is not null and a.sid=s.sid
and n.name in ('redo entries','redo size')
order by 2;


After looking into the results it was clearly visible that the value for redo size and entries for one of the session was very high.

The next step was to identify the session sid provided by the above query.

Executing a query against v$session for the sid provided in the above query results displayed that it is a database job and the next query to v$dba_jobs_running displayed that the job is currently running. We contacted the development team and found that the job was recently created during the last change that went into production.

In order to bring the performance back to normal the job session was killed and the job was broken in order to avoid its future runs.

Immediately after the above action performance came back to normal. The command to add the datafile was also completed.



 

Comments

Popular posts from this blog

Gitlab installation steps on Redhat Linux

In this blog we will see the steps to install Gitlab on Redhat Enterprise Linux 6. I will be using the virtual machine "gitserver" that I have created on Google Cloud. You can use any server or VM running RHEL 6 and follow these steps. Follow the below steps to install gitlab. Run these steps as root user. # yum install -y curl policycoreutils-python openssh-server cronie # lokkit -s http -s ssh  # yum install postfix  # service postfix start  # chkconfig postfix on  # curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash  # EXTERNAL_URL="http://34.69.44.142" yum -y install gitlab-ee  You will see a screen similar to below, once your gitlab installation is successful. You can now access the gitlab console using the http or https url that you provided during the installation, i.e., http://<ip/server_name> http://gitserver.localdomain.com or  http://34.69.44.142 When you open the c...

Configure Oracle ASM Disks on AIX

Configure Oracle ASM Disks on AIX You can use below steps to configure the new disks for ASM after the raw disks are added to your AIX server by your System/Infrastructure team experts: # /usr/sbin/lsdev -Cc disk The output from this command is similar to the following: hdisk9 Available 02-T1-01 PURE MPIO Drive (Fibre) hdisk10 Available 02-T1-01 PURE MPIO Drive (Fibre) If the new disks are not listed as available, then use the below command to configure the new disks. # /usr/sbin/cfgmgr Enter the following command to identify the device names for the physical disks that you want to use: # /usr/sbin/lspv | grep -i none This command displays information similar to the following for each disk that is not configured in a volume group: hdisk9     0000014652369872   None In the above example hdisk9 is the device name and  0000014652369872  is the physical volume ID (PVID). The disks that you want to use may have a PVID, but they must not belong to a volu...

Load records from csv file in S3 file to RDS MySQL database using AWS Data Pipeline

 In this post we will see how to create a data pipeline in AWS which picks data from S3 csv file and inserts records in RDS MySQL table.  I am using below csv file which contains a list of passengers. CSV Data stored in the file Passenger.csv Upload Passenger.csv file to S3 bucket using AWS ClI In below screenshot I am connecting the RDS MySQL instance I have created in AWS and the definition of the table that I have created in the database testdb. Once we have uploaded the csv file we will create the data pipeline. There are 2 ways to create the pipeline.  Using "Import Definition" option under AWS console.                    We can use import definition option while creating the new pipeline. This would need a json file which contains the definition of the pipeline in the json format. You can use my Github link below to download the JSON definition: JSON Definition to create the Data Pipeline Using "Edit Architect" ...