A script enabled browser is required for this page to function properly.
Skip to main content
StorageTek Tape Analytics Administration Reference Guide, Version 1.0.2
E28379-03
Table of Contents Previous Next Index


Database Services Administration : STA Database Restoration : ▼ Restore the Database

Restore the Database

Perform the following commands as the MySQL root user:

Reload the Database

1.
# mysql -uroot -p -e 'drop database stadb;'
Password: 
2.
# mysql -uroot -p -e 'source 2011223.stafullbackup.sql;'
Password: 

Replay the Binlogs

3.

If you have more than one binary log to execute on the MySQL server, the safest method is to process them all using a single connection to the server and a single mysql process to execute the contents of all of the binary logs.

For example:

#  mysqlbinlog 2011223.sta-binlog.000021 \
> 2011223.sta-binlog.000022 \
> 2011223.sta-binlog.000023 \
> 2011223.sta-binlog.000024 | mysql -u root -p

Another approach is to concatenate all the logs to a single file and then process the file:

# mysqlbinlog 2011223.sta-binlog.000021 >  /tmp/recoversta.sql
# mysqlbinlog 2011223.sta-binlog.000022 >> /tmp/recoversta.sql
# mysqlbinlog 2011223.sta-binlog.000023 >> /tmp/recoversta.sql
# mysqlbinlog 2011223.sta-binlog.000024 >> /tmp/recoversta.sql
# mysql -u root -p -e 'source /tmp/recoversta.sql'

Note – If you do not supply a password on the command line, MySQL prompts you for it before proceeding.

Avoid Multiple Connections to the Server

Processing binary logs as shown in the example below may create multiple connections to the server. Multiple connections cause problems if the first log file contains a CREATE TEMPORARY TABLE statement, and the second log contains a statement that uses that temporary table. When the first mysql process terminates, the server drops the temporary table. When the second mysql process attempts to use that table, the server reports “unknown table.”

# mysqlbinlog binlog.000001 | mysql -u root -p #<=== DANGER!!
# mysqlbinlog binlog.000002 | mysql -u root -p #<=== DANGER!!

Restart All Services

4.
# STA start

Table of Contents Previous Next Index Link to documentation
Copyright © 2012 Oracle and/or its affiliates. All rights reserved.