Moving your data and tables around comes in many different
flavours. The use of mysqldump is common practice to dump your
data and schema out to a file. It is also possible to pipe your
mysqldump into a 2nd server. Try the code below (adapting the
users and passwords!) in a test environment;
$ mysqldump -u UserA -p p455w0rd --single-transaction
--all-databases --host=Server1 | mysql -u UserA -p p455w0rd
--host=Server2
As you can see from the command we are taking all the databases
in a single transaction into Server2 from Server1. If you're not
using transactional tables substitute the --single-transaction
for --lock-all-tables to ensure you get a consistent copy.
Remember; You must be able to see the 'other' server over the
network and there must be permissions set for remote access from
your feeding Server. For large databases this technique may not
be suitable because of the performance restrictions surrounding …
Few years ago I was looking at crash recovery code, and realized that InnoDB has removed all the comments from the code [this assumption is debunked by Heikki in comments section], related to replay of transaction log. Judging by high quality of comments in the remaining codebase, I realized that it was all done to obscure any efforts to build another InnoDB hot backup solution – competitor to first Innobase standalone offering.
I was enjoying the moment when Percona launched their own implementation of the tool. Since the inception, it became more and more robust and feature rich.
We have used xtrabackup in our environment a lot – just… not for backup – the major use case right now is for cloning server instances – either for building new replicas, shadow servers, or …
[Read more]
I don't usually post these simple tricks, but it came to my
attention today and it's very simple and have seen issues when
trying to get around it. This one tries to solve the question:
How do I restore my production backup to a different
schema? It looks obvious, but I haven't seen many people
thinking about it.
Most of the time backups using mysqldump will include the
following line:
USE `schema`;
This is OK when you're trying to either (re)build a slave or
restore a production database. But what about restoring it to a
test server in a different schema?
The actual trick
Using vi (or similar) editors to edit the line will most
likely result in the editor trying to load the whole backup file
into memory, which might cause paging or even crash the server if
the backup is big enough (I've seen it happen). Using sed
(or similar) might take some time with a big …
MySQL Backup Script has been around for a long time. I have
used it on and off for years but now I’ve needed to make
some improvements. This script is based on VER.
2.6 – http://sourceforge.net/projects/automysqlbackup/
Copyright (c) 2002-2003 wipe_out@lycos.co.uk.
I have added my own Copyright (c) 2010 mark@grennan.com –
http://www.mysqlfanboy.com/Files/automysqlbackup.sh.
But as the code says: This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
My improvements include:
# VER 2.6 Beta 5 – MTG – (2010-04-18)
# …
I’ve been wanting to write a backup script for a while now that does the following: reads the partition information for the directory that you are backing up into and computes the used/available/percentage-available space. Then it reads the total data size from the MySQL tables and ensures that you have enough space on disk (for [...]
To whom it may concern,
in response to a query from André Simões (also known as ITXpander),
I slapped together a MySQL script that outputs mysqldump
commands for backing up
individual partitions of the tables in the current schema.
The script is maintained as a
snippet at MySQL Forge. How it worksThe script works by
querying the information_schema.PARTITIONS
system
view to …
Today I ran into my first MySQL binlog race condition: The initial problem was quite simple: A typical MySQL master->slave setup with heavy load on the master and nearly no load on the slave, which only serves as a hot … Weiterlesen →
Creating MySQL Backups With AutoMySQLBackup On Ubuntu 9.10
AutoMySQLBackup is a shell script that lets you take daily, weekly and monthly backups of your MySQL databases using mysqldump. It can back up multiple databases, compress the backups, back up remote databases, and email the logs. This tutorial explains how to install and use it on an Ubuntu 9.10 server.
Dave Edwards has offered me to write this week's Log
Buffer, and I couldn't help but jump at the opportunity. I'll
dive straight into it.
OracleI'll start with Oracle, the dust of the Sun acquisition has
settled, so maybe it's time to return our attention to the
regular issues.
Lets start with Hemant Chitale's Common Error series and his
Some Common Errors - 2 - NOLOGGING as a Hint
explaining what to expect from NOLOGGING. Kamran Agayev offers us
an insight into Hemant's personality with his Exclusive Interview with Hemant K Chitale. My
favorite quote is:
Do you refer to the documentation? And how often does …
How To Back Up MySQL Databases With mylvmbackup On Debian Lenny
mylvmbackup is a Perl script for quickly creating MySQL backups. It uses LVM's snapshot feature to do so. To perform a backup, mylvmbackup obtains a read lock on all tables and flushes all server caches to disk, creates a snapshot of the volume containing the MySQL data directory, and unlocks the tables again. This article shows how to use it on a Debian Lenny server.