List:General Discussion« Previous MessageNext Message »
From:Prabhat Kumar Date:May 19 2011 3:12pm
Subject:Re: Restore only one database or one table
View as plain text  
might be my blog will help you :)

http://adminlinux.blogspot.com/2009/11/extract-single-dbtable-from-dump-file.html

have a good time..

On Thu, May 19, 2011 at 7:42 AM, Eric Bergen <eric.bergen@stripped> wrote:

> The mysql command line has the -o option to only execute queries for
> the default database. This can be used to restore one database from a
> dump file that contains many. For specific tables you can setup a
> restore user that only has permissions on the tables you want to
> restore then use the -f flag to continue on error. Only use this in
> emergencies though.
>
> On Thursday, May 19, 2011, Adarsh Sharma <adarsh.sharma@stripped> wrote:
> > Johan De Meersman wrote:
> >
> > ----- Original Message -----
> >
> >
> > From: "Suresh Kuna" <sureshkumarilu@stripped>
> >
> > Try to take a tab separated dump, so you can restore what ever you
> > want in terms of tables or databases.
> >
> >
> >
> > Uhh. I'm a bit fuzzy today, but I really don't see how a tab-separated
> dump will help split off tables or databases :-)
> >
> >
> > To answer the original question, though; the technically accurate answer
> is "yes, you can". It's made "easy" because mysqldump conveniently dumps
> database-per database and table-per table. It's a bugger to do, however,
> because if you take a monolithic dump you need to open the whole dumpfile in
> a text editor and copy the data you want to another file or straight to the
> MySQL commandline. Good luck with your 250G backup :-)
> >
> > You can use sed or awk to look for markers and split the file up that
> way. You'd be much better off in the future to dump database-per-database,
> and if you think you need it table-per-table. 's Not all that hard, just
> script to loop over the output of show databases and show tables. Probably
> plenty of scripts on the internet that do exactly that.
> >
> > Compressing your dumps is a good idea, too - the output is a text file,
> so bzip2 will probably compress that a factor 10 or better. Simply use bzcat
> to pipe the file back into the MySQL client to restore.
> >
> >
> >
> >
> > That's pretty nice & What I am expected to hear.
> >
> > I will let u know after some practical implementation.
> >
> > Thanks & best Regards,
> > Adarsh Sharma
> >
>
> --
> Eric Bergen
> eric.bergen@stripped
> http://www.ebergen.net
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>


-- 
Best Regards,

Prabhat Kumar
MySQL DBA

My Blog: http://adminlinux.blogspot.com
My LinkedIn: http://www.linkedin.com/in/profileprabhat

Thread
Restore only one database or one tableAdarsh Sharma19 May
  • Re: Restore only one database or one tableMichael Dykman19 May
    • Re: Restore only one database or one tableSuresh Kuna19 May
      • Re: Restore only one database or one tableAdarsh Sharma19 May
        • Re: Restore only one database or one tableSuresh Kuna19 May
          • Re: Restore only one database or one tableJohan De Meersman19 May
            • Re: Restore only one database or one tableAdarsh Sharma19 May
              • Re: Restore only one database or one tableEric Bergen19 May
                • Re: Restore only one database or one tablePrabhat Kumar19 May
            • Re: Restore only one database or one tablehsv20 May