| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

07-04-11, 10:10
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
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.
|
|

07-05-11, 00:32
|
|
Registered User
|
|
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;
|
|

07-05-11, 01:43
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
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.
|
|

07-05-11, 02:32
|
|
Registered User
|
|
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....
|
|

07-05-11, 02:51
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
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 .
|
|

07-05-11, 03:17
|
|
Registered User
|
|
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....
|
|

07-05-11, 04:35
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
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.
|
|

07-05-11, 05:01
|
|
Registered User
|
|
Join Date: May 2011
Posts: 11
|
|
Hi Vijay,
Post your dump and import statement...
|
|

07-05-11, 05:17
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
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>
|
|

07-05-11, 05:46
|
|
Registered User
|
|
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
|
|

07-05-11, 05:59
|
|
Registered User
|
|
Join Date: May 2011
Posts: 11
|
|
You can use this also,
mysql -uocm -pocm --socket=<Socket Name> <db name> -e "source <DUMP file name>"
|
|

07-06-11, 00:27
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
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.
|
|

07-06-11, 00:37
|
|
Registered User
|
|
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...
|
|

07-06-11, 01:32
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
|
|
Dump file content
Hari,
Only below stuff is there in my dump file
Quote:
-- 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 */;
|
|
|

07-06-11, 01:55
|
|
Registered User
|
|
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
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|