Sponsored Content
Full Discussion: Mysqldump certain tables
Top Forums UNIX for Dummies Questions & Answers Mysqldump certain tables Post 302742667 by timgolding on Tuesday 11th of December 2012 12:17:53 PM
Old 12-11-2012
Mysqldump certain tables

Hi,

I have to upload part of my database periodically when i make changes to product data etc. However I only want to upload certain tables. We suffer from bandwidth chock here, so i want to write a couple of separate scripts that upload parts of the database that changed. The database is large and it is split into to sections Feed driven data, which is 27MB and Manual driven data which is 8MB. To reduce the upload time i decided to write a script that uploads the feed stuff (to be run once a month) and another script to upload the manual stuff (could be run daily) to reduce the upload time. I therefore decided i would have a script to copy the sections of the database in to a smaller database on the development server. Then a script on the live server to download the smaller database from the development server. I am however having troubles creating the first script.

Here is what i have.

Code:
mysqladmin -u root --password='mypassword' --socket=/tmp/mysql.sock drop DATABASE_TEMP
mysqladmin -u root --password='mypassword' --socket=/tmp/mysql.sock create DATABASE_TEMP


for table in TABLE TABLE2 TABLE3 TABLE4 TABLE5
do
echo "copying table"
mysqldump -u root --password='mypassword' DATABASE $table | mysql --socket=/tmp/mysql.sock -u root --password='mypassword' DATABASE_TEMP
done

Am i on the right track? Should i be doing this with a single command somehow? Will this work? I am reluctant to test it without some advice because i don't want to much anything up.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

2. Shell Programming and Scripting

mysqldump script without hardcode password

OS: Linux ambglx02 2.6.16.60-0.21-default #1 Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux Shell: bash Currently I have a mysqldump script to backup my mysql database, the command is as below: /opt/novell/mysql/bin/mysqldump --add-drop-table -u root -p -h mydb > /home/john/mydb.sql ... (5 Replies)
Discussion started by: bulkbiz
5 Replies

3. UNIX for Dummies Questions & Answers

mysqldump bus error - cored dumped

hi, I need to backup a database but I'm getting the error "bus error - core dumped" just after I run mysqldump command. The server has installed solaris 9. Any help would be appreciated (3 Replies)
Discussion started by: dahr
3 Replies

4. UNIX for Advanced & Expert Users

mysqldump slowing down the process?

Hi All, I have a data calculation process-a perl script running each and every hour which will do some calculations on the data stored in a mysql server. Normally it tooks around 2minutes (max) to complete. But in case if i did any actions on the linux box where the database is... (7 Replies)
Discussion started by: DILEEP410
7 Replies

5. Shell Programming and Scripting

Help needed for mysqldump command

I want to take a backup of a database and redirect the output of the whole process to a log file. I am using the below command: mysqldump -A --add-drop-table > mysql-daily-backup.sql &> /tmp/backup_log/mysql.log Is there anything wrong with the syntax? ---------- Post updated at 08:32 PM... (0 Replies)
Discussion started by: proactiveaditya
0 Replies

6. UNIX for Dummies Questions & Answers

Problem with my crontab file, using mysqldump

My crontab file tells cron to run a certain shell script at 10:30 AM every day. The shell script backs up my database with mysqldump and then runs a sed script that does some editing of the backup file. I have programmed the shell script to write an error message to a file I have in my home... (1 Reply)
Discussion started by: Ultrix
1 Replies

7. Shell Programming and Scripting

Mysqldump rotate backup

I have a very simple script that uses a cron job to take a daily backup of our orders database. echo "Dumping ORDERS database"; mysqldump -u root --password='mypassword' -h '1.1.1.1' --opt --compress ORDERS $tbl_names > /Volumes/Files_Backup_1/db_backups/orders.sql echo "Copied database to... (2 Replies)
Discussion started by: timgolding
2 Replies

8. Shell Programming and Scripting

Need Help with automatically Import from special mysqldump

Hi @ all I need a little bit help with a tricky problem ... Here´s the situation: We´ve 2 MySQL-Servers, one is productive, the other is Backup. At the productive Server there runs every 2 hours a cron Job which does a Dump from MySQL-DB with script 'automysqlbackup.sh' and copy it then... (7 Replies)
Discussion started by: jackcracker
7 Replies
MYSQL-STRESS-TE(1)					       MySQL Database System						MYSQL-STRESS-TE(1)

NAME
mysql-stress-test.pl - server stress test program SYNOPSIS
mysql-stress-test.pl [options] DESCRIPTION
The mysql-stress-test.pl Perl script performs stress-testing of the MySQL server. (MySQL 5.0 and up only) mysql-stress-test.pl requires a version of Perl that has been built with threads support. Invoke mysql-stress-test.pl like this: shell> mysql-stress-test.pl [options] mysql-stress-test.pl supports the following options: o --help Display a help message and exit. o --abort-on-error=N Causes the program to abort if an error with severity less than or equal to N was encountered. Set to 1 to abort on any error. o --check-tests-file Periodically check the file that lists the tests to be run. If it has been modified, reread the file. This can be useful if you update the list of tests to be run during a stress test. o --cleanup Force cleanup of the working directory. o --log-error-details Log error details in the global error log file. o --loop-count=N In sequential test mode, the number of loops to execute before exiting. o --mysqltest=path The path name to the mysqltest program. o --server-database=db_name The database to use for the tests. The default is test. o --server-host=host_name The host name of the local host to use for making a TCP/IP connection to the local server. By default, the connection is made to localhost using a Unix socket file. o --server-logs-dir=path This option is required. path is the directory where all client session logs will be stored. Usually this is the shared directory that is associated with the server used for testing. o --server-password=password The password to use when connecting to the server. o --server-port=port_num The TCP/IP port number to use for connecting to the server. The default is 3306. o --server-socket=file_name For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use. The default if /tmp/mysql.sock. o --server-user=user_name The MySQL user name to use when connecting to the server. The default is root. o --sleep-time=N The delay in seconds between test executions. o --stress-basedir=path This option is required. path is the working directory for the test run. It is used as the temporary location for result tracking during testing. o --stress-datadir=path The directory of data files to be used during testing. The default location is the data directory under the location given by the --stress-suite-basedir option. o --stress-init-file[=path] file_name is the location of the file that contains the list of tests to be run once to initialize the database for the testing. If missing, the default file is stress_init.txt in the test suite directory. o --stress-mode=mode This option indicates the test order in stress-test mode. The mode value is either random to select tests in random order or seq to run tests in each thread in the order specified in the test list file. The default mode is random. o --stress-suite-basedir=path This option is required. path is the directory that has the t and r subdirectories containing the test case and result files. This directory is also the default location of the stress-test.txt file that contains the list of tests. (A different location can be specified with the --stress-tests-file option.) o --stress-tests-file[=file_name] Use this option to run the stress tests. file_name is the location of the file that contains the list of tests. If file_name is omitted, the default file is stress-test.txt in the stress suite directory. (See --stress-suite-basedir.) o --suite=suite_name Run the named test suite. The default name is main (the regular test suite located in the mysql-test directory). o --test-count=N The number of tests to execute before exiting. o --test-duration=N The duration of stress testing in seconds. o --threads=N The number of threads. The default is 1. o --verbose Verbose mode. Print more information about what the program does. COPYRIGHT
Copyright (C) 2006, 2013, Oracle and/or its affiliates. All rights reserved. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Oracle Corporation (http://dev.mysql.com/). MySQL 01/23/2014 MYSQL-STRESS-TE(1)
All times are GMT -4. The time now is 11:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy