Unix Technical Forum

Re: Re: Readind a Dump W/o Expanding It

This is a discussion on Re: Re: Readind a Dump W/o Expanding It within the MySQL General forum forums, part of the MySQL category; --> That worked! Thanks! However, when I restored the database, it seemed to have trashed all the images. What do? ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:33 PM
Ted Johnson
 
Posts: n/a
Default Re: Re: Readind a Dump W/o Expanding It

That worked! Thanks! However, when I restored the database, it seemed to have trashed all the images. What do?

TIA,
Ted

----- Original Message ----
From: Dan Buettner <drbuettner@gmail.com>
To: Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com>
Cc: mysql@lists.mysql.com
Sent:Saturday, October 14, 2006 9:59:31 PM
Subject: Re: Re: Readind a Dump W/o Expanding It

That's a little trickier, but definitely possible. I can think of 3
ways to do it, I'm sure there are others.

Approach #1,works if your dumpfile is a manageable size:
- make a copy and work fromthe copy
- open the copy in a text editor, and find the line where your
database starts. Delete everything above it.
- locate the line where the next database starts, and delete
everything below it.
- save
- pipe your altered file back into MySQL. You may need to CREATE
DATABASE first.


Approach #2, works if your dumpfile is not a manageable size
- make a copy and work from the copy
- using something like perl, openthe copy and read line by line until
you encounter where your database starts. Then continue reading but
also writing out to a new file until you encounter the next line where
a database starts. Close files and exit the script at that point.
- pipe your output file back into MySQL. You may need to CREATE DATABASE first.


Approach #3, works if you have a 2nd mysql server at your disposal
- pipe full dumpfile into a MySQL installation
- use mysqldump to dump just the database in question
- pipe that dumpfile into your original server

HTH,
Dan


On 10/14/06, Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com> wrote:
>
> That worked! It's there! Now...how can I rebuild *just* that database (which
>was removed from my MySQL server) without affecting the other databases?
> TIA,
> Ted
>
> ----- Original Message ----
> From: Dan Buettner <drbuettner@gmail.com>
> To: Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com>
> Cc: mysql@lists.mysql.com
> Sent: Saturday, October 14, 2006 9:41:46 AM
> Subject: Re: Readind a Dump W/o Expanding It
>
> Ted, if you're on a *NIX variant, you could use grep. Something like:
>
> cat DUMPFILE | grep Database: | grep Host:
>
> A dump file I have laying about has a line like this:
> -- Host: localhost Database: outsell_web_prod
>
> and the command above finds that line. Getting a little fancier with
> grep could filter the excess out of the line.
>
> Hopethis helps,
> Dan
>
>
> On 10/14/06, Ted Johnson
> <whatawonderfulworldweliveintoo@yahoo.com> wrote:
> > 107Hi;
> > Is there a command by which I can read the names of databases in a

> mysqldump without expanding the dump into my mysql instance (and thus
> overwriting databases already extant)?
> > TIA,
> > Ted
> >
> >
> >
> >
> >

>
>
>








Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 09:33 PM
Dan Buettner
 
Posts: n/a
Default Re: Re: Re: Readind a Dump W/o Expanding It

How were they stored in the database? Which way did you end up
restoring the data? And the dumpfile you have - how has it been
handled? I ask because if it contains binary data and was FTP'd from
one machine to another the wrong way, that could have done it.

Dan

On 10/15/06, Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com> wrote:
> That worked! Thanks! However, when I restored the database, it seemed to have trashed all the images. What do?
>
> TIA,
> Ted
>
> ----- Original Message ----
> From: Dan Buettner <drbuettner@gmail.com>
> To: Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com>
> Cc: mysql@lists.mysql.com
> Sent: Saturday, October 14, 2006 9:59:31 PM
> Subject: Re: Re: Readind a Dump W/o Expanding It
>
> That's a little trickier, but definitely possible. I can think of 3
> ways to do it, I'm sure there are others.
>
> Approach #1, works if your dumpfile is a manageable size:
> - make a copy and work from the copy
> - open the copy in a text editor, and find the line where your
> database starts. Delete everything above it.
> - locate the line where the next database starts, and delete
> everything below it.
> - save
> - pipe your altered file back into MySQL. You may need to CREATE
> DATABASE first.
>
>
> Approach #2, works if your dumpfile is not a manageable size
> - make a copy and work from the copy
> - using something like perl, open the copy and read line by line until
> you encounter where your database starts. Then continue reading but
> also writing out to a new file until you encounter the next line where
> a database starts. Close files and exit the script at that point.
> - pipe your output file back into MySQL. You may need to CREATE DATABASE first.
>
>
> Approach #3, works if you have a 2nd mysql server at your disposal
> - pipe full dumpfile into a MySQL installation
> - use mysqldump to dump just the database in question
> - pipe that dumpfile into your original server
>
> HTH,
> Dan
>
>
> On 10/14/06, Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com> wrote:
> >
> > That worked! It's there! Now...how can I rebuild *just* that database (which
> > was removed from my MySQL server) without affecting the other databases?
> > TIA,
> > Ted
> >
> > ----- Original Message ----
> > From: Dan Buettner <drbuettner@gmail.com>
> > To: Ted Johnson <whatawonderfulworldweliveintoo@yahoo.com>
> > Cc: mysql@lists.mysql.com
> > Sent: Saturday, October 14, 2006 9:41:46 AM
> > Subject: Re: Readind a Dump W/o Expanding It
> >
> > Ted, if you're on a *NIX variant, you could use grep. Something like:
> >
> > cat DUMPFILE | grep Database: | grep Host:
> >
> > A dump file I have laying about has a line like this:
> > -- Host: localhost Database: outsell_web_prod
> >
> > and the command above finds that line. Getting a little fancier with
> > grep could filter the excess out of the line.
> >
> > Hope this helps,
> > Dan
> >
> >
> > On 10/14/06, Ted Johnson
> > <whatawonderfulworldweliveintoo@yahoo.com> wrote:
> > > 107Hi;
> > > Is there a command by which I can read the names of databases in a

> > mysqldump without expanding the dump into my mysql instance (and thus
> > overwriting databases already extant)?
> > > TIA,
> > > Ted
> > >
> > >
> > >
> > >
> > >

> >
> >
> >

>
>
>
>
>
>
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com