Title: Re: [Oscar-users] How to recover from a lost DB ?
Hi Bruce,

Can you access the "oscar" database with the "oscar" user? If so, you can dump the "oscar" database with the following:
mysqldump -u oscar -p --databases oscar > oscar.sql
You need to input the password from your /etc/odapw.

BTW, do you need to restore the other databases with the root account?
MySQL setup on the OSCAR cluster does not have a root password and also the anonymous access is allowed too unless you have changed the configuration of MySQL on your OSCAR cluster.
So, I believe that mysqldump from the root account (without password) should work if you have not touched/setup MySQL of OSCAR manually.
But it looks like that you have installed MySQL and setup its root password before you install OSCAR or you have setup MySQL manually after OSCAR installation.
And you have removed the anonymous access.
If this is your case, I think that you can still access to any databases with your root account/password.
If your root access is not working, please let me know.

Anyways, the restore process is very simple.
mysql -u oscar -p oscar < oscar.sql

BTW, I usually drop the oscar database before I restore it because the contents can be mixed up if I don't.
So, my restore process can be like this
1. drop database:
   $ mysqladmin drop -u oscar -p oscar (If your root access is available, "mysqladmin drop -u root  -p oscar" )
   or
   $ mysql -u oscar -p 
   mysql> drop database oscar
2. create database:
   $ mysqlcreate create -u oscar
   or
   $mysql -u oscar -p
   mysql> create database oscar
3. restore database:
  mysql -u oscar -p oscar < oscar.sql
  or
  $ mysql -u oscar -p
  mysql>  \. oscar.sql

One more thing, my user table looks like this (I have not touched it after OSCAR installation).
mysql> SELECT Host, User FROM mysql.user;
+-----------+-----------+
| Host      | User      |
+-----------+-----------+
| %         | anonymous |
| %         | oscar     |
| localhost |           |
| localhost | oscar     |
| localhost | root      |
| oscar-fc3 |           |
| oscar-fc3 | root      |
+-----------+-----------+
7 rows in set (0.00 sec)

We have not written OSCAR srcipts to handle the database dump/restore yet but I am planning to do so in the near future.
Then, it would be much easier to backup and restore the OSCAR database.

Regards,

-ps-
What version of OSCAR have you tried to install? Is it a trunk version or released version(OSCAR 4.0, OSCAR 4.1, or OSCAR 4.2, ..)?
- DongInn

Bernard Li wrote:
*** DISCLAIMER: I have not tested this so do it at your own risk *** :-)
 
I was thinking that if you can just dump the contents out, then you can uninstall mysql-server, re-install it (root user will have no password), re-import the database and re-create the oscar user giving it access to the "oscar" database (and put the password in /etc/odapw).  Then if you re-run the wizard, it should just Do The Right Thing (tm).
 
However, perhaps it's best you let our database expert take a look at your problem to see if he can offer you any better solution.
 
Cheers,
 
Bernard


From: Bruce Becker [mailto:[EMAIL PROTECTED]]
Sent: Thu 04/05/2006 02:27
To: Bernard Li
Cc: gareth; [email protected]; [EMAIL PROTECTED]
Subject: Re: [Oscar-users] How to recover from a lost DB ?

Hi All.


> BTW, you have access to the database right?  Perhaps it's easier just to
> dump the contents and re-import it?
This is kinda what we want to do, but the problem is, I'm not sure how
to run _just_ the right script to re-import it. If you guys could
point us to where in the OSCAR code this is done, we could drop the
oscar database and re-import it....

Thanks
bruce


Reply via email to