Events Calendar

September 2010
M T W T F S S
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3

Select Language

Proof of concept (MySQL) PDF Print E-mail
Written by repostor   
Friday, 11 December 2009 18:54

1) Create a script that will insert some data in a database.

------------- Windows ----------------


C:\> notepad insert.bat

echo "create database test;|mysql"
set /p enter="press enter"

echo "create database test;"|mysql

echo "create table test (tid datetime);|mysql -D test"
set /p enter="press enter"
echo "create table test (tid datetime);"|mysql -D test

:forever
echo "insert into test (tid) values (now());|mysql -D test"
echo "insert into test (tid) values (now());"|mysql -D test
@ping 127.0.0.1 -n 2 -w 1000 > nul
goto forever

 

--------- UNIX / Linux ---------

# vi insert.sh

 

#!/bin/ksh

echo "create database test;|mysql"
read enter

echo "create database test;"|mysql

echo "create table test (tid datetime);|mysql -D test"
read enter
echo "create table test (tid datetime);"|mysql -D test

while [ 1 ]

do

echo "insert into test (tid) values (now());|mysql -D test"
echo "insert into test (tid) values (now());"|mysql -D test
sleep 1


done

 

2) run this script in a shell window

--- Windows ---

C:\> insert.bat

--------- UNIX / Linux ---------

# chmod 777 insert.sh

# ./insert.sh 

3) Do a full backup

--- Windows ---

C:\Program Files\repostor\Data Protector for MySQL\bin> mysqlbackup -s test

--------- UNIX / Linux ---------

# /opt/repostor/rdp4MySQL/bin/mysqlbackup -s test

 

4) Do a log backup (incremental)

--- Windows ---

C:\Program Files\repostor\Data Protector for MySQL\bin> mysqlbackup -s mysql -l

--------- UNIX / Linux ---------

# /opt/repostor/rdp4MySQL/bin/mysqlbackup -s mysql -l

 

( note the transaction log backups are on a per instanace, the -s mysql isn't used )

6) Terminate the "insert.bat" / "insert.sh" script

 

7) Do a new transaction log backup (incremental)

 

C:\Program Files\repostor\Data Protector for MySQL\bin> mysqlbackup -s mysql -l

--------- UNIX / Linux ---------

# /opt/repostor/rdp4MySQL/bin/mysqlbackup -s mysql -l

 

 

( note the transaction log backups are on a per instanace)

8) Verify the content of the "test" table, in the database test

echo select * from test;|mysql -D test

tid

2009-09-08 14:26:06
2009-09-08 14:26:07
2009-09-08 14:26:08
..
2009-11-25 19:11:26

9) Drop the database test

echo drop database test;|mysql

10) Create the database test

echo create database test;|mysql

11) Restore the database

execute the command:

--- Windows ---

C:\Program Files\repostor\Data Protector for MySQL\bin> mysqlrestore -s test -v -l -t YYYY-MM-DD.HH:MM:SS

--------- UNIX / Linux ---------

# /opt/repostor/rdp4MySQL/bin/mysqlrestore -s test -v -l -t YYYY-MM-DD.HH:MM:SS

Where YYYY-MM-DD.HH:MM:SS is any of the timestamp in the list above

Eg;

C:\Program Files\repostor\Data Protector for MySQL\bin> mysqlrestore -s test -v -l -t 2009-11-25.19:11:27

8) Verify the content of the test table in the test database

echo select * from test;|mysql -D test

Last Updated on Monday, 21 December 2009 22:37
 
Repostor : Your recovery expert