Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 30 of 30

Displaying posts with tag: recovery (reset)

How to recover table structure from InnoDB dictionary
+2 Vote Up -0Vote Down

To recover a dropped or corrupt table with Percona Data Recovery Tool for InnoDB you need two things: media with records(ibdata1, *.ibd, disk image, etc.) and a table structure. Indeed, there is no information about the table structure in an InnoDB page. Normally we either recover the structure from .frm files or take it from some old backup.

A new tool sys_parser can recover the table structure from InnoDB dictionary.

Why do we need a new tool anyway? It is absolutely critical to have an accurate table definition to ensure a successful recovery. Even an unnoticeable difference like NULL or NOT NULL can shift all

  [Read more...]
Recovery after DROP & CREATE
+3 Vote Up -0Vote Down

In a very popular data loss scenario a table is dropped and empty one is created with the same name. This is because  mysqldump in many cases generates the “DROP TABLE” instruction before the “CREATE TABLE”:

DROP TABLE IF EXISTS `actor`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `actor` (
  `actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `first_name` varchar(45) NOT NULL,
  `last_name` varchar(45) NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`actor_id`),
  KEY `idx_actor_last_name` (`last_name`)
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

If there were no subsequent CREATE TABLE the recovery

  [Read more...]
5 Things You Overlooked with MySQL Dumps
+1 Vote Up -1Vote Down

Read the original article at 5 Things You Overlooked with MySQL Dumps

1. Point In Time Recovery If you’ve never done point in time recovery, it’s time to take a second look. With a standard mysqldump you restore your database to the time when the backup happened. Only do them once a day, then you can lose as much as 24 hours of data. Enter point-in-time recovery, [...]

For more articles like these go to Sean Hull's Scalable Startups

Related posts:
  • Ten things to remember about MySQL backups
  • Easy MySQL replication with hotbackups
  •   [Read more...]
    Server Ownership Legalities
    +0 Vote Up -0Vote Down

    As I reported via Twitter late last week, we encountered an issue that got some of our mail delivery delayed by about a day and a half. I’ll explain more about what happened as I believe in openness on these matters, and also the experience has educational content for others.

    Our mail server doesn’t have direct external interaction, it’s shielded by two relays that handle both the inbound MX and the outbound queue. This setup works remarkably well in terms of exposure to spam and other malicious activity. As previously discussed, it appears that it’s more difficult to make mail server infra more resilient without expending lots more time/effort and infrastructure expenditure. Just because of the way the common tools for mail delivery and imap are built, having two or more of each in a semi-active setup gets quite complex. Complexity is in itself a risk so it has to

      [Read more...]
    With InnoDB’s Transportable Tablespaces, Recovering Data from Stranded .ibd Files is a Thing of the Past
    +2 Vote Up -0Vote Down

    Being a data recovery specialist and having recovered countless GBs of corrupted, and/or stranded, InnoDB data in my days, I am very happy to hear about the new InnoDB Transportable Tablespaces coming in MySQL 5.6!

    Back in the day, if you had a stranded .ibd file (the individual InnoDB data file with –innodb-file-per-table option), you basically had nothing (even though that file contained all of the data). This was because unless you had the original instance that that particular .ibd file (table) originated from, there was no way to load it, import, or dump from it. So it was not of much use, though all the data was *right* there.

    Thus I created the method of Recovering an InnoDB table from only an .ibd file (I should note that this was before

      [Read more...]
    What a Hosting Provider did Today
    +0 Vote Up -0Vote Down
    I found Dennis the Menace, he now has a job as system administrator for a hosting company. Scenario: client has a problem with a server becoming unavailable (cause unknown) and has it restarted. MySQL had some page corruption in the InnoDB tablespace. The hosting provider, being really helpful, goes in as root and first deletes ib_logfile* then ib* in /var/lib/mysql. He later says “I am sorry if I deleted it. I thought I deleted the log only. Sorry again.”  Now this may appear nice, but people who know what they’re doing with MySQL will realise that deleting the iblogfiles actually destroys data also. MySQL of course screams loudly that while it has FRM files it can’t find the tables. No kidding! Then, while he’s been told to not touch anything any more, and I’m trying to see if I can recover the deleted files on ext3 filesystem (yes there are tools  [Read more...]
    MySQL Enterprise Backup 3.6 - New backup streaming, integration with Oracle Secure Backup and other common backup media solutions
    Employee_Team +5 Vote Up -0Vote Down
    All DBAs understand the importance and priority of quick, reliable database backup and recovery operations.  In fact, dating back to my early days with MySQL, the most commonly requested product features from the MySQL user base have been around online, non-blocking backup solutions for running MySQL servers.  In response, Oracle now provides MySQL Enterprise Backup (http://mysql.com/products/enterprise/backup.html) ("MEB") which performs high performant, online "hot" backups for MySQL databases.  MEB provides all of the backup/recovery features and functionality DBAs expect, all from a scriptable command line interface.  You can learn all about MEB in the related MySQL docs.

    My congratulations and appreciation go out to Lars Thalmann and the MySQL Enterprise

      [Read more...]
    Connecting orphaned .ibd files
    +2 Vote Up -0Vote Down

    There are two ways InnoDB can organize tablespaces. First is when all data, indexes and system buffers are stored in a single tablespace. This is typicaly one or several ibdata files. A well known innodb_file_per_table option brings the second one. Tables and system areas are split into different files. Usually system tablespace is located in ibdata1 file and every InnoDB table has two files e.g.  actor.frm and actor.ibd.

    The annoying thing about .ibd files you can’t easily copy the an .ibd file to another MySQL server. If you try to very often you’ll get an error in the log:

    InnoDB: Error: tablespace id is 10 in the data dictionary
    InnoDB: but in file ./sakila/actor.ibd it is 15!

    However sometimes you have to connect the .ibd file to an alien ibdata1.

    There are several situation when

      [Read more...]
    MySQL data backup: going beyond mysqldump
    +1 Vote Up -0Vote Down
    A user on a linux user group mailing list asked about this, and I was one of the people replying. Re-posting here as I reckon it’s of wider interest. > [...] tens of gigs of data in MySQL databases. > Some in memory tables, some MyISAM, a fair bit InnoDB. According to my > understanding, when one doesn’t have several hours to take a DB > offline and do dbbackup, there was/is ibbackup from InnoBase.. but now > that MySQL and InnoBase have both been ‘Oracle Enterprised’, said > product is now restricted to MySQL Enterprise customers.. > > Some quick searching has suggested Percona XtraBackup as a potential > FOSS alternative. > What backup techniques do people employ around these parts for backups > of large mixed MySQL data sets where downtime *must* be minimised? > > Has your backup plan ever been put to the test? You  [Read more...]
    Oracle Solaris Cluster 3.3 available
    Employee +2 Vote Up -2Vote Down
    On September 8, 2010 Oracle announced the availability of Oracle Solaris Cluster 3.3
    
    Oracle Solaris Cluster 3.3, built on the solid foundation of Oracle Solaris, offers the 
    most extensive Oracle enterprise High Availability and Disaster Recovery solutions for the 
    largest portfolio of mission-critical applications.
    
    Integrated and thoroughly tested with Oracle's Sun servers, storage, connectivity 
    solutions and Solaris 10 features, Oracle Solaris Cluster is now qualified with Solaris 
    Trusted Extensions, supports Infiniband for general networking or storage usage, and can 
    be deployed with Oracle Unified Storage in Campus Cluster configurations. It extends its 
    applications support to new Oracle applications such as Oracle Business Intelligence, 
    PeopleSoft, TimesTen, and MySQL Cluster.
    
    The single, integrated HA and DR solution enables multi-tier deployments in virtualized 
    environments.
      [Read more...]
    Oracle Solaris Cluster 3.3 available
    Employee +0 Vote Up -0Vote Down
    On September 8, 2010 Oracle announced the availability of Oracle Solaris Cluster 3.3
    
    Oracle Solaris Cluster 3.3, built on the solid foundation of Oracle Solaris, offers the 
    most extensive Oracle enterprise High Availability and Disaster Recovery solutions for the 
    largest portfolio of mission-critical applications.
    
    Integrated and thoroughly tested with Oracle's Sun servers, storage, connectivity 
    solutions and Solaris 10 features, Oracle Solaris Cluster is now qualified with Solaris 
    Trusted Extensions, supports Infiniband for general networking or storage usage, and can 
    be deployed with Oracle Unified Storage in Campus Cluster configurations. It extends its 
    applications support to new Oracle applications such as Oracle Business Intelligence, 
    PeopleSoft, TimesTen, and MySQL Cluster.
    
    The single, integrated HA and DR solution enables multi-tier deployments in virtualized
      [Read more...]
    Oracle Solaris Cluster 3.3 available
    Employee +0 Vote Up -0Vote Down
    On September 8, 2010 Oracle announced the availability of Oracle Solaris Cluster 3.3
    
    Oracle Solaris Cluster 3.3, built on the solid foundation of Oracle Solaris, offers the 
    most extensive Oracle enterprise High Availability and Disaster Recovery solutions for the 
    largest portfolio of mission-critical applications.
    
    Integrated and thoroughly tested with Oracle's Sun servers, storage, connectivity 
    solutions and Solaris 10 features, Oracle Solaris Cluster is now qualified with Solaris 
    Trusted Extensions, supports Infiniband for general networking or storage usage, and can 
    be deployed with Oracle Unified Storage in Campus Cluster configurations. It extends its 
    applications support to new Oracle applications such as Oracle Business Intelligence, 
    PeopleSoft, TimesTen, and MySQL Cluster.
    
    The single, integrated HA and DR solution enables multi-tier deployments in virtualized
      [Read more...]
    How long is recovery from 8G innodb_log_file
    +3 Vote Up -0Vote Down

    In my previous posts I highlighted that one of improvements in Percona Server is support of innodb_log_file_size > 4G. This test was done using Percona Server 5.5.7, but the same performance expected for InnoDB-plugin and MySQL 5.5.

    The valid question how long is recovery in this case, so let's test it. I took the same tpcc-mysql 1000W workload with 52GB and 144GB innodb_buffer_pool_size with data located on Virident tachIOn card and killed mysqld after 30 mins of work.

    The recovery time after start is:
    for 52GB innodb_buffer_pool_size:

    PLAIN
      [Read more...]
    Why do I recommend switching over from MyISAM to Innodb!
    +1 Vote Up -0Vote Down
    Although MyISAM has been the default storage engine for MySQL but its soon going to change with the release of MySQL server 5.5. Not only that, more and more people are shifting over to the Innodb storage engine and the reasons for that is the tremendous benefits, not only in terms of performance, concurrency, ACID-transactions, foreign key constraints, but also because of the way it helps out the DBA with hot-backups support, automatic crash recovery and avoiding data inconsistencies which can prove to be a pain with MyISAM. In this article I try to hammer out the reasons why you should move on to using Innodb instead of MyISAM.
    Lost innodb tables, xfs and binary grep
    +4 Vote Up -0Vote Down

    Before I start a story about the data recovery case I worked on yesterday, here's a quick tip - having a database backup does not mean you can restore from it. Always verify your backup can be used to restore the database! If not automatically, do this manually, at least once a month. No, seriously - in most of the recovery cases I worked on, customers did have some sort of backup, but it just wasn't working, complete and what not. Someone set it up and never bothered to check if it still works after a while.

    Anyway, this post is not really about the backups but rather about few interesting things I learned during last recovery case.

    First, some facts about the system and how data was lost:

    • MySQL had a dedicated partition on XFS file system
      [Read more...]
    An argument for not using mysqldump
    +2 Vote Up -0Vote Down

    I have a 5G mysqldump which takes 30 minutes to restore from backup.  That means that when the database reaches 50G, it should take 30x10=5 hours to restore.  Right?  Wrong.

    Mysqldump recovery time is not linear.  Bigger tables, or tables with more indexes will always take more time to restore.

    If I restore from a raw backup (LVM snapshot, xtrabackup, innodb hot backup), it is very easy to model how much longer recovery time will take:

    Backup is 80G
    Copy is at 70MB/s.
    10G is already complete.
    = ((80-10) * 1024)/70/60 = ~17 minutes

    I can tell progress with mysqldump by monitoring the rate at which show global status like 'Handler_write'; increases and compare it to my knowledge of about how many rows are in each table.  But progress != a magic number like "17





      [Read more...]
    Rectifying Corruption Issues in MyISAM Table in MySQL 5.0.22 Database
    +0 Vote Up -0Vote Down
    MySQL is the most popular open-source database in the world. It has the distinction of being the only database that is used in every continent. Yes, even Antartica!!! The reasons for such popularity is its availability, performance, robustness, etc. It provides three types of database engines, MyISAM, InnoDB, and MySQL Archive. Out of these, the MyISAM table is the default table type. It is fast, simple, and allows full-text searching. Although it is reliable, it can become corrupt and, thus, inaccessible following a system crash. You should use appropriate corrective measures to repair MySQL database. However, if you are not able to do so then you should use a third-party MySQL recovery software to do so.

    Consider a scenario wherein you have MySQL 5.0.22 database running in your system. You use it for MediaWiki installation that is reported as

      [Read more...]
    Restore MyISAM tables by MySQL Recovery Software
    +0 Vote Up -0Vote Down
    Any corruption in MyISAM table is a terrible situation for Database Administrator. These MyISAM tables are the most important components in the MySQL Database to store personal as well as professional data, and the corruption in these tables may inaccessibility to the database. In this situation, a database backup allows you to restore the database and access the records in the table. Duplicate file (Backup) of the database is mostly stored on a different storage media, the changes of database corruption still exist. In that situation, you will need to perform MySQL database repair by the using of third party software.

    Some error messages that enable you to identify that your MyISAM table (student) is corrupt:

    “Student.frm is locked against change”
    Or
    “Got error message student from table handler”

    Or







      [Read more...]
    BlitzDB Crash Safety and Auto Recovery
    +0 Vote Up -0Vote Down

    Crash Safety is a big deal in the database league. Lack of durability can lead to all sorts of terrible things upon a catastrophic event. Many projects, especially in the so called NoSQL world compromises crash safety in return for higher QPS. The argument there is that the availability of the overall system should be accomplished by replication since a database server can’t be rescued if the physical disk breaks. I happen to agree with this philosophy but I am also aware that this isn’t a correct answer for everyone. So, what will I do with BlitzDB?

    Several relational database hackers have pointed out that BlitzDB isn’t any safer than MyISAM since it doesn’t guarantee crash safety. This is currently true but I plan on making BlitzDB much safer than MyISAM by providing following features.

  • Auto Recovery Routine (startup option)
  • Tokyo
  •   [Read more...]
    Recover BLOB fields
    +2 Vote Up -0Vote Down

    For a long time long types like BLOB, TEXT were not supported by Percona InnoDB Recovery Tool. The reason consists in a special way InnoDB stores BLOBs.

    An InnoDB table is stored in a clustered index called PRIMARY. It must exist even if a user hasn't defined the primary index. The PRIMARY index pages are identified by 8-bytes number index_id. The highest 4 bytes are always 0, so index_id is often notated as o:<4 bytes number>, e.g. 0:258. The pages are ordered in a B-tree. Primary index is used as a key. Inside a page records are stored in a linked list.

    InnoDB page by default is 16k. Obviously if a record is too long, a single page can't store it. If the total record size is less than UNIV_PAGE_SIZE/2 - 200 (this is roughly 7k) then the full record is stored in the page of PRIMARY index. Let's call it internal. In InnoDB sources they have type FIL_PAGE_INDEX*.

      [Read more...]
    InnoDB recovery gets even faster in Plugin 1.1, thanks to native AIO
    +2 Vote Up -0Vote Down

    InnoDB Plugin 1.1 doesn’t add any recovery specific improvements on top of what we already have in Plugin 1.0.7. The details on the latter are available in this blog. Yet, when I tried to recover another big recovery dataset I created, I got the following results for total recovery time:

    • Plugin 1.0.7: 46min 21s
    • Plugin 1.1: 32min 41s

    Plugin 1.1 recovery is 1.5 times faster. Why would that happen? The numerous concurrency improvements in Plugin 1.1 and MySQL 5.5 can’t really affect the recovery. The honor goes to Native Asynchronous IO on Linux. Let’s try without it:

    • Plugin 1.1 with –innodb-use-native-aio=0: 49min 07s

    which is about the same as 1.0.7 time. My numerous

      [Read more...]
    Debugging problems with row based replication
    +3 Vote Up -3Vote Down

    MySQL 5.1 introduces row based binary logging.  In fact, the default binary logging format in GA versions of MySQL 5.1 is 'MIXED' STATEMENT*;   The binlog_format  variable can still be changed per sessions which means it is possible that some of your binary log entries will be written in a row-based fashion instead of the actual statement which changed data, even when the global setting on the master is to write binary logs in statement mode.   The row-based format does offer advantages particularly if triggers or stored procedures are used, or if non deterministic functions like RAND() are used in DML statements.

    A statement based replication slave can get out of sync with the master fairly easily, especially if data is changed on the slave.   It is possible for a statement to execute successfully on a slave even if the data is not 100% in

      [Read more...]
    InnoDB's tablespace ids and Partitions
    +3 Vote Up -0Vote Down
    There are times when what you have is a partially running database and a bunch of backup innodb tablespace files (the .ibd files). If you're using innodb_file_per_table, then you have a separate .ibd file for each InnoDB table.

    Now, you have your running database with a bunch of tables, and you want to replace some of them with the backup .ibd files. According to the MySQL docs, you'd do this:
  • ALTER TABLE foo DISCARD TABLESPACE; (this deletes the current .ibd file)
  • copy the old .ibd file into your database directory
  • ALTER TABLE foo IMPORT TABLESPACE;
    Assuming your .ibd file was from the same database and you did not drop the table and recreate it sometime between when you made the backup .ibd and now, this should work.


  •   [Read more...]
    How PostgreSQL protects against partial page writes and data corruption
    +5 Vote Up -4Vote Down

    I explored two interesting topics today while learning more about Postgres.

    Partial page writes

    PostgreSQL’s partial page write protection is configured by the following setting, which defaults to “on”:

    full_page_writes (boolean)

    When this parameter is on, the PostgreSQL server writes the entire content of each disk page to WAL during the first modification of that page after a checkpoint… Storing the full page image guarantees that the page can be correctly restored, but at a price in increasing the amount of data that must be written to WAL. (Because WAL replay always starts from a checkpoint, it is sufficient to do this during the first change of each page after a checkpoint. Therefore, one way to reduce the cost of full-page writes is to increase the

      [Read more...]
    Tool of the Day: rsnapshot
    +0 Vote Up -0Vote Down

    rsnapshot is a filesystem snapshot utility for making backups of local and remote systems, based on rsync. Rather than just doing a complete copy every time, it uses hardlinks to create incrementals (which are from a local perspective a full backup also). You can specify how long to keep old backups, and all the other usual jazz. You’d generally have it connect over ssh. You’ll want/need to run it on a filesystem that supports hardlinks, so that precludes NTFS.

    In the context of MySQL, you can’t just do a filesystem copy of your MySQL data/logs, that would be inconsistent and broken. (amazingly, I still see people insisting/arguing on this – but heck it’s your business/data to gamble with, right?)

    Anyway, if you do a local mysqldump also, or

      [Read more...]
    MySQL Cluster Data Node restart times
    Employee +0 Vote Up -0Vote Down

    Restarts are required for certain, infrequent maintenance activities. Note that there is no loss of service while a single node restarts.

    When a data node restarts, it first attempts to load the data into memory from the local log files and then it will catch up with any subsequent changes by retrieveing them from the surviving node(s) in its node group.

     Based on this, you would expect the time taken to restart a data node to be influenced by:

  • The amount of data that was stored on the data node before the restart
  • Rate of updates being made to the data during the restart
  • Network performance (assuming the data is being updated during recovery)
  • The times will also be influenced bycertain configuration parameters, performance of the host machine and whether the multi-threaded data node (ndbmtd) is being used.

    To

      [Read more...]
    Recovery after DROP [ TABLE | DATABASE ]
    +2 Vote Up -0Vote Down

    In your recovery practice we often face the problem when data lost by execution DROP TABLE or DROP DATABASE statement. In this case even our InnoDB Data Recovery tool can't help, as table / directory with files was deleted (if you have innodb-file-per-table). And the same for MyISAM, all .MYD / .MYI / .frm - files are deleted in this case.

    So first step after DROP is to restore files, and for ext3 file system there are two utilities which can help of you are fast (and lucky) enough.
    First one is ext3grep http://code.google.com/p/ext3grep/, with some instruction on this page http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html.
    And also there is

      [Read more...]
    Partial Binary Log Recovery
    Employee +1 Vote Up -0Vote Down

    I came across a situation recently where I was asked if it was possible to edit a binary log to remove a part of it to restore onto a slave server. Now the choice of doing something like a hexedit did not seem appealing, and the more experienced might suggest that it is simply a matter of using  mysqlbinlog with the --start-position and/or --stop-position options. However, the problem had arisen that required the binary log to played through the replication process onto the slave based on specific options in MySQL cluster, so using an SQL dump from the binary log was of no use.

    Initially this may seem like a daunting task where you will have to find some specialist tool or delve into the deep recesses of the binary log format, but a much simpler solution was found. The replication process allows the slave to be started up to a specific point in the log files. The

      [Read more...]
    Partial Binary Log Recovery
    Employee +0 Vote Up -0Vote Down

    I came across a situation recently where I was asked if it was possible to edit a binary log to remove a part of it to restore onto a slave server. Now the choice of doing something like a hexedit did not seem appealing, and the more experienced might suggest that it is simply a matter of using  mysqlbinlog with the --start-position and/or --stop-position options. However, the problem had arisen that required the binary log to played through the replication process onto the slave based on specific options in MySQL cluster, so using an SQL dump from the binary log was of no use.

    Initially this may seem like a daunting task where you will have to find some specialist tool or delve into the deep recesses of the binary log format, but a much simpler solution was found. The replication process allows the slave to be started up to a specific point in the log files.

      [Read more...]
    Partial Binary Log Recovery
    Employee +0 Vote Up -0Vote Down

    I came across a situation recently where I was asked if it was possible to edit a binary log to remove a part of it to restore onto a slave server. Now the choice of doing something like a hexedit did not seem appealing, and the more experienced might suggest that it is simply a matter of using  mysqlbinlog with the --start-position and/or --stop-position options. However, the problem had arisen that required the binary log to played through the replication process onto the slave based on specific options in MySQL cluster, so using an SQL dump from the binary log was of no use.

    Initially this may seem like a daunting task where you will have to find some specialist tool or delve into the deep recesses of the binary log format, but a much simpler solution was found. The replication process allows the slave to be started up to a specific point in the log files.

      [Read more...]
    Showing entries 1 to 30 of 30

    Planet MySQL © 1995, 2013, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.