PDA

View Full Version : Restore Issues v1.1.1-1



trickykid
November 13th, 2006, 08:23 AM
Previous problem was here: http://forums.zmanda.com/showthread.php?t=215

I've now downloaded and installed the latest version of mysql-zrm and encountering new errors/issues. It seems to be attempting a restore but during the restore, it fails to select a database, complaining there's not database selected from the backup.sql file created from backup.

This is the command I used to restore after the successful backup:

mysql-zrm --action restore --backup-set test --source-directory /var/lib/mysql-zrm/test/20061113104517/

Which failed with this error:



INFO: ZRM for MySQL Community Edition - version 1.1
INFO: Mail address: me@company.net is ok
INFO: Input Parameters Used {
INFO: verbose=1
INFO: retention-policy=1D
INFO: backup-level=0
INFO: mailto=me@company.net
INFO: destination=/var/lib/mysql-zrm
INFO: source-directory=/var/lib/mysql-zrm/test/20061113104517
INFO: html-reports=backup-status-info
INFO: database=test
INFO: html-report-directory=/var/www/mysql-zrm/reports/
INFO: backup-mode=logical
INFO: tables=Domains
INFO: password=******
INFO: comment=Test Backup
INFO: user=root
INFO: mysql-binlog-path=/var/lib/mysql
INFO: }
INFO: Getting mysql variables
INFO: mysqladmin --user="root" --password="*****" variables
INFO: datadir is /var/lib/mysql/
INFO: mysql_version is 4.1.12-standard-log
INFO: log_bin=ON
INFO: restoring using command mysql --user="root" --password="*****" -e "set character_set_client=utf8;set character_set_connection=utf8;set character_set_database=utf8;set character_set_results=utf8;set character_set_server=utf8;source /var/lib/mysql-zrm/test/20061113104517/backup.sql;"
ERROR 1046 (3D000) at line 20 in file: '/var/lib/mysql-zrm/test/20061113104517/backup.sql': No database selected
ERROR: Restore from logical backup failed
INFO: Shutting down MySQL
ERROR: Restore failed
MySQL server has been shutdown. Please restart after verification.

So I tried specifying the database in the command like this:

mysql-zrm --action restore --database test --backup-set test --source-directory /var/lib/mysql-zrm/test/20061113104517/

Which also failed with same errors, claiming no database selected:

ERROR 1046 (3D000) at line 20 in file: '/var/lib/mysql-zrm/test/20061113104517/backup.sql': No database selected

The index file created from the initial backup indicates the database "test". Here is the index file:



backup-set=test
backup-date=20061113104517
host=localhost
backup-date-epoch=1163436317
retention-policy=1D
mysql-zrm-version=ZRM for MySQL Community Edition - version 1.1
mysql-version=4.1.12-standard-log
backup-directory=/var/lib/mysql-zrm/test/20061113104517
comment=Test Backup
backup-level=0
logical-tables=Domains
logical-databases=test
next-binlog=bin.000019
/var/lib/mysql-zrm/test/20061113104517/backup.sql=5219252fcaf6858ef1f2ad7957888b9f
backup-size=0.01 MB
read-locks-time=00:00:00
flush-logs-time=00:00:00
backup-time=00:00:00
backup-status=Backup succeeded


Any suggestions? Seems as if it's getting the right info, just not selecting the database to use upon login, ignoring the command line option to select the database as well.

kkg
November 13th, 2006, 08:58 AM
Hi,

The problem is when you do a
mysqldump --database db --tables "abcd"
the dump produced does not include a "use db" statement.

This is why when you try to restore you get this problem.

--kkg

kkg
November 13th, 2006, 09:00 AM
The simple work around for this is to, while restoring to edit the backup.sql file and add a
"use db"
just before the first
"DROP TABLE IF EXIST `table_name'
statement

Will update you if mysql has a work around for this or if there is someother way to work around this issue.

--kkg

trickykid
November 13th, 2006, 09:27 AM
I would imagine the software used to perform the backup should specify the database in the connection to perform the restore. Seems tedious to have to add a line to the backup.sql file created to use the correct database when it should be passed in the parameter.

When I run a command like:

mysql -u root -p test < backup.sql
Enter password:

It works because the database is specified in the connect string. I realize the dumps don't create the "use db", but this should be avoided by specifying the db to use in the command to perform the restore.

kkg
November 13th, 2006, 09:54 AM
Thanks for pointing that out. My only concern, doing this is that if somebody specifies --databases on the command line during restore and it is different from the database that the tables were backed up from, then that could result in a issue. But we will provide the database name used while doing the backup in the connection while restoring.

We will add this as part of the restore process in the next release.

Please do open a bug report for this.
--kkg

trickykid
November 13th, 2006, 10:21 AM
http://forums.zmanda.com/bugzilla/show_bug.cgi?id=16 submitted.

Thanks.