Eliminating Duplicate Records From MySQL Tables. Anyone who works with database driven development to any extent, will occasionally run into a situation where duplicate information is added to their database.
I have personally run into such a problem on many occasions since I started working with database driven software. Being able to quickly undo data corruption is extremely important in production databases. As much as we like to have a perfect production environment; it is often very difficult to do dedicate the time and resources necessary to avoid all mistakes.
The following example is a great way to remove duplicates, based upon a set of fields. Basically you create an unique index on a list of fields (composite key) of your specification. Locating Duplicate Entries in a MySQL Table. If you don’t have unique indexes on your table, it is likely that you will occasionally have entries that are duplicated.
This can often happen because of a software bug or possibly a user error. Some applications even choose not to have unique indexes for performance reasons; though this happens at the cost of data integrity. The best I know of, to demonstrate how to locate the duplicate entries, is to use an example. So let’s say you have the following table: In this example, let’s say you want the following field set to have a unique combination of values. Well, let’s say that you are concerned about having duplicate values in your data. In the example you group by the list of fields that you want to use as your composite key and select the fields you want to see in your output. What we have in this example is four of each of these records which are supposed to be unique. Copying Yesterday’s Exceptions with Stack Traces from Logs, Then. When you have a java application server which generates a great deal of logs, it can be tricky to find the most important information, especially if you have detailed logging.
Fortunately grep is capable of doing this very well. The following command will gather all WARN , ERROR , FATAL , and Exception stack traces . This command can be very useful for Java log monitoring scripts. cat /jboss-4.0.2/server/default/log/server.log | grep "ERROR\|FATAL\|Exception\|at.*\.java\:. Understanding this expression In this expression ‘\|’ is used as an OR operator to look for different patterns.
Filtering by Date: Yesterday’s Logs. How To Repair MySQL Replication. Version 1.0 Author: Falko Timme <ft [at] falkotimme [dot] com> Last edited 05/29/2008 If you have set up MySQL replication, you probably know this problem: sometimes there are invalid MySQL queries which cause the replication to not work anymore.
In this short guide I explain how you can repair the replication on the MySQL slave without the need to set it up from scratch again. I do not issue any guarantee that this will work for you! 1 Identifying The Problem To find out whether replication is/is not working and what has caused to stop it, you can take a look at the logs. Grep mysql /var/log/syslog server1:/home/admin# grep mysql /var/log/syslog May 29 09:56:08 http2 mysqld[1380]: 080529 9:56:08 [ERROR] Slave: Error 'Table 'mydb.taggregate_temp_1212047760' doesn't exist' on query.
You can see what query caused the error, and at what log position the replication stopped. SYSSTAT - Linux Monitoring Packages. Documentation Some of the following notes come from the Linux From Scratch documentation.
Introduction to sysstat The sysstat package contains utilities to monitor system performance and usage activity. Sysstat contains various utilities, common to many commercial Unixes, and tools you can schedule via cron to collect and historize performance and activity data. Iostat(1) reports CPU statistics and input/output statistics for devices, partitions and network filesystems. mpstat(1) reports individual or combined processor related statistics. pidstat(1) reports statistics for Linux tasks (processes) : I/O, CPU, memory, etc. sar(1) collects, reports and saves system activity information (CPU, memory, disks, interrupts, network interfaces, TTY, kernel tables,etc.) sadc(8) is the system activity data collector, used as a backend for sar.
Installation of sysstat: Compile and install sysstat by running the following commands: Command explanations: . $ . Enter ". PHP-LDAP-Admin: LDAP Administration Console. Oracle Session.