Connecting Tech Pros Worldwide Forums | Help | Site Map

Command for dumping stored procedures

Needs Regular Fix
 
Join Date: Mar 2007
Posts: 304
#1: May 12 '07
hi,
I would like to know the command for dumping stored procedures.
Thought that I knew the command and dumped the db using the -R option, only to realise that dumping of procedures had failed because of some delimiter problem. Now , I would like to transfer only the stored procedures.
Also, I would like to know as to how I could dump the procedures because changing the delimiter to say $$ from the normal ; also doesn't help because it is read as ; at the server .
thanks,
gomzi.

pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: May 12 '07

re: Command for dumping stored procedures


Are you trying to do this through a script, or from the shell?
Needs Regular Fix
 
Join Date: Mar 2007
Posts: 304
#3: May 12 '07

re: Command for dumping stored procedures


Quote:

Originally Posted by pbmods

Are you trying to do this through a script, or from the shell?

From the shell.
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#4: May 12 '07

re: Command for dumping stored procedures


Expand|Select|Wrap|Line Numbers
  1. mysqldump -u user -p database --routines
is giving you an error? What is the error message you're getting?
Needs Regular Fix
 
Join Date: Mar 2007
Posts: 304
#5: May 13 '07

re: Command for dumping stored procedures


Quote:

Originally Posted by pbmods

Expand|Select|Wrap|Line Numbers
  1. mysqldump -u user -p database --routines
is giving you an error? What is the error message you're getting?

writing that command doesn't give me any error but when I upload the text file to my server, i get a error in 'delimiter ;'

Searched on net..Found that one has to encode the delimiters, because I am using $$ for the stored procedures.But i don't know how?
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#6: May 13 '07

re: Command for dumping stored procedures


Quote:

Originally Posted by gomzi

writing that command doesn't give me any error but when I upload the text file to my server, i get a error in 'delimiter ;'

Searched on net..Found that one has to encode the delimiters, because I am using $$ for the stored procedures.But i don't know how?

Take a look at this thread:
http://forums.mysql.com/read.php?98,...118#msg-134118
Needs Regular Fix
 
Join Date: Mar 2007
Posts: 304
#7: May 13 '07

re: Command for dumping stored procedures


Quote:

Originally Posted by pbmods

Take a look at this thread:
http://forums.mysql.com/read.php?98,...118#msg-134118

Tried a solution which Bob was talking about on the URL you gave me above.
mysqldump -u root -p --routines --databases io \
| sed -e "s/;;/\$\$/g" \
> io.sql

Executing this, i get sed not recognized command error.
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#8: May 13 '07

re: Command for dumping stored procedures


Quote:

Originally Posted by gomzi

Tried a solution which Bob was talking about on the URL you gave me above.
mysqldump -u root -p --routines --databases io \
| sed -e "s/;;/\$\$/g" \
> io.sql

Executing this, i get sed not recognized command error.

Thats an odd one; it sure looks like a valid sed command to me. Tried a similar command on my system, and it worked great.

What system are you dumping on?

If it's a *n?x system, try `man sed` to see if sed expects commands in a different format.
If you're using Windows, I think you have to install sed. You can grab a copy here:
http://gnuwin32.sourceforge.net/packages/sed.htm
Reply