PDA

View Full Version : how to restore database in temporary directory



fedora
August 14th, 2007, 04:05 AM
Hi Guys,

I am newbie here. I have successfully backup my DB remotely. Then I tried to restore and I found ZRM will restore direct to DB directory in /var/lib/mysql. Is ZRM do the restoration like that? I am just wondering if I restore the backup DB, it will replace the original one. I don't want that. Can ZRM do restoration on temporary folder so that I can choose which DB to put in /var/lib/mysql? I did tried to read the man page but I found no such thing I want.

paddy
August 14th, 2007, 01:34 PM
If you are using ZRM for MySQL version 1.2, you can use --port, --host options to restore the database to another MySQL server. You can test your application on a different MySQL server. See mysql-zrm-restore(1) man page.

Paddy

fedora
August 15th, 2007, 01:26 AM
If you are using ZRM for MySQL version 1.2, you can use --port, --host options to restore the database to another MySQL server. You can test your application on a different MySQL server. See mysql-zrm-restore(1) man page.

Paddy

Yes i am using ZRM for MySQL version 1.2. I think we have misunderstanding here. I can restore database backup to another MySQL server by running: mysql-zrm --action restore --backup-set dailyrun --source-directory \
/var/lib/mysql-zrm/dailyrun/20061025161624/ with or without --port and --host.

here is the results:
restore:INFO: ZRM for MySQL Community Edition - version 1.2
cent6_backupset:restore:INFO: Restored database(s) from logical backup: DBTest mysql test
cent6_backupset:restore:INFO: Restore done in 571 seconds.

But ZRM will restore direct to /var/lib/mysql (the original MySQL directory) that contains those DBs. After backup I have renamed those DBs with .bak extension to make it different. After that I did restoration and I found DBTest, DBTest.bak, mysql, mysql.bak, test and test.bak in /var/lib/mysql. That means ZRM will direct restore to /var/lib/mysql. If I did not rename it to .bak extension, it will replace the original DB rite??

What I want is, restore DB backup to another MySQL server to /tmp/mysql-zrm (for example) so that I can choose which DB to put it back to original directory (/var/lib/mysql). ZRM can do that?

paddy
August 15th, 2007, 03:01 PM
Yes i am using ZRM for MySQL version 1.2. I think we have misunderstanding here. I can restore database backup to another MySQL server by running: mysql-zrm --action restore --backup-set dailyrun --source-directory \
/var/lib/mysql-zrm/dailyrun/20061025161624/ with or without --port and --host.

here is the results:
restore:INFO: ZRM for MySQL Community Edition - version 1.2
cent6_backupset:restore:INFO: Restored database(s) from logical backup: DBTest mysql test
cent6_backupset:restore:INFO: Restore done in 571 seconds.

But ZRM will restore direct to /var/lib/mysql (the original MySQL directory) that contains those DBs. After backup I have renamed those DBs with .bak extension to make it different. After that I did restoration and I found DBTest, DBTest.bak, mysql, mysql.bak, test and test.bak in /var/lib/mysql. That means ZRM will direct restore to /var/lib/mysql. If I did not rename it to .bak extension, it will replace the original DB rite??


ZRM will restore databases with the same name. But if you have different MySQL server with different port and different datadir (not /var/lib/mysql), you can restore to different location.

ZRM does not provide option to rename databases/tables during restore because it is easier to test restoration using MySQL application if the names are unchanged.

Paddy

fedora
August 15th, 2007, 09:04 PM
ZRM will restore databases with the same name. But if you have different MySQL server with different port and different datadir (not /var/lib/mysql), you can restore to different location.

ZRM does not provide option to rename databases/tables during restore because it is easier to test restoration using MySQL application if the names are unchanged.

Paddy
I know ZRM will restore with the same name. All my MySQL servers used same port 3306 and same datadir /var/lib/mysql. So, ZRM will restore the backup to another MySQL server with same name and same datadir somehow?? If so, the original DB will be overwritten.

I did renamed the DB just want to know where ZRM will restore the backup to. That why I got same DB name like DBTest (this is from backup) and DBTest.bak (this is the original one). I successfully tested OK for the restoration. Backup and testing was not my problem actually..

Only one thing... How to make ZRM restore the backup to different directory instead of original datadir (var/lib/mysql)?

paddy
August 17th, 2007, 03:44 PM
I know ZRM will restore with the same name. All my MySQL servers used same port 3306 and same datadir /var/lib/mysql. So, ZRM will restore the backup to another MySQL server with same name and same datadir somehow?? If so, the original DB will be overwritten.


Create a new MySQL server running on different port (other than 3306) and different datadir (other than /var/lib/mysql). Use this MySQL server for backup image restore
testing.

Paddy

fedora
August 22nd, 2007, 10:46 PM
Create a new MySQL server running on different port (other than 3306) and different datadir (other than /var/lib/mysql). Use this MySQL server for backup image restore
testing.
Paddy

I have over 40 servers. If u suggest to create new server with diff port and datadir then it would waste my time. Ur suggestion could solve the problem and I also think as ur way. But if I don't want to follow ur suggestion, how can I restore in diff folder in MySQL server which used port 3306 and datadir /var/lib/mysql (remain existing setting)? Hope to hear from u soon.