Command for dumping stored procedures

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gomzi
    Contributor
    • Mar 2007
    • 304

    Command for dumping stored procedures

    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
    Recognized Expert Expert
    • Apr 2007
    • 5821

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

    Comment

    • gomzi
      Contributor
      • Mar 2007
      • 304

      #3
      Originally posted by pbmods
      Are you trying to do this through a script, or from the shell?
      From the shell.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Code:
        mysqldump -u user -p database --routines
        is giving you an error? What is the error message you're getting?

        Comment

        • gomzi
          Contributor
          • Mar 2007
          • 304

          #5
          Originally posted by pbmods
          Code:
          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?

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            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:

            Comment

            • gomzi
              Contributor
              • Mar 2007
              • 304

              #7
              Originally posted by pbmods
              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.

              Comment

              • pbmods
                Recognized Expert Expert
                • Apr 2007
                • 5821

                #8
                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:

                Comment

                Working...