Results 1 to 15 of 15
  1. #1
    Join Date
    Jul 2011
    Posts
    7

    Smile Unanswered: Taking MySql DB dump for selected tables.

    Hi,

    My requirement is taking MySql DB dump for particular tables in a DB using mysqldump script.My DB is running on Solaris server.

    I tried following command to take db dump for single table,

    mysqldump --socket=<Socket name> -u<UserName> -p<Password> <DB Name> --skip-lock-tables <TableName1> >> Test.dump

    It is creating Test.dump file. But I am not sure , whether this is the correct way of taking db dump for single table.

    And Please guide me to take db dump of multiple tables using single command.

  2. #2
    Join Date
    May 2011
    Posts
    11

    Taking MySql DB dump for selected tables

    For taking Multiple tables dump:

    -> mysqldump -u username -p -P portno --socket dbname tab1 tab2 tab3 .. > dumpfile;

  3. #3
    Join Date
    Jul 2011
    Posts
    7

    Thumbs down multiple table dump is not working

    Hi HariSankar,

    thanks for your reply.

    I used the commad given by you, But i got the following error msg.

    ./mysqldump: Got error: 1146: Table 'db.tab1' doesn't exist when doing LOCK TABLES

    Then I used '--skip-lock-tables' option in my command.After using this , It is creating dump file but the dump file size is always being as 1053kb.

    Please give some idea about it.

  4. #4
    Join Date
    May 2011
    Posts
    11
    Hi Vijay,

    In my query tab1 tab2 means your table names which you want to take dump..

    Just replace the dbname with your database name and tab1 tab2 etc with your table names....

  5. #5
    Join Date
    Jul 2011
    Posts
    7

    Talking Used the same

    Hi Hari,

    I used the same . In the above error ,db is my DB name and tab1 is one of the table name in my db. I didnt want to mention my db name and table name , that's why mentioned like db.tab1 .

  6. #6
    Join Date
    May 2011
    Posts
    11
    > /mysqldump: Got error: 1146: Table 'db.tab1' doesn't exist when doing LOCK TABLES
    It means that table is not exist in your datbase check that you provided the correct name.

    .> It is creating dump file but the dump file size is always being as 1053kb.

    You are worrying about size of the dumpfile.. I can't understand here..

    Do you feel the dump is not taken properly?

    If you want to check the dump just create the sample database and import the dump into that and check the table data....

  7. #7
    Join Date
    Jul 2011
    Posts
    7

    Unhappy

    Yeah Hari,

    I think it is not taking db dump properly. I tried importing the dump into the DB but it is not importing the data in the tables.

  8. #8
    Join Date
    May 2011
    Posts
    11
    Hi Vijay,

    Post your dump and import statement...

  9. #9
    Join Date
    Jul 2011
    Posts
    7

    Unhappy NOn shareable

    Hi Hari,

    That db is being used in my client side . So i wont be able to share it .

    I Used following command for importing

    mysql --socket=<Socket Name> -uocm -pocm -e "source <DUMP file name>" <db name>

  10. #10
    Join Date
    May 2011
    Posts
    11
    Hi Vijay,

    Use this command to import dump,

    mysql -u username -p -P port --socket socketfile dbname < dump.sql

  11. #11
    Join Date
    May 2011
    Posts
    11
    You can use this also,

    mysql -uocm -pocm --socket=<Socket Name> <db name> -e "source <DUMP file name>"

  12. #12
    Join Date
    Jul 2011
    Posts
    7

    Thumbs down Not working

    hi Hari,

    i tried the both commands , but still it is not importing the data.

    I guess, dumpfile is not having data.Taking db dump is itself not proper.

  13. #13
    Join Date
    May 2011
    Posts
    11
    Hi,

    Is it showing any error message while importing data?

    Check whether the tables are created or not in database and open the dump file using vi editor and see whether it contains insert statement or not...

  14. #14
    Join Date
    Jul 2011
    Posts
    7

    Exclamation Dump file content

    Hari,

    Only below stuff is there in my dump file

    -- MySQL dump 10.9
    --
    -- Host: localhost Database: ocm
    -- ------------------------------------------------------
    -- Server version 4.1.12-standard

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
    */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

    /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

  15. #15
    Join Date
    May 2011
    Posts
    11
    Hi Vijay,

    Check the user has a sufficient privileges for taking dump.
    Try to take dump again using root user and ensure that the tables are exist in database.
    If mysql dump showing any error message post it here.

    ex:
    mysqldump -u root -p dbname tab1 tab2 etc > dump.sql

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •