2017-06-20 8 views
0

MySQLワークベンチを使用して、テーブルMS SQLをMYSQLサーバにコピーします。 2つの日付の間でデータを選択することは可能ですか?mysql workbenchマイグレーション選択データ

今日、このエクスポートは150,000行以上で3時間続きます。この処理を高速化したいと思います。

おかげ

答えて

1

あなたは再び移行ウィザードを実行しますが、「データ転送のセットアップ」ステップは選択でオプション「ワークベンチの外からデータをコピーするシェルスクリプトを作成」しなければなりません。そのワークベンチの後、次のようになり可能性がある、あなたのためのシェルスクリプトを生成します。あなたがソース・データベースとターゲット・データベースのパスワードを置くために必要なすべての

#!/bin/sh 
# Workbench Table Data copy script 
# Workbench Version: 6.3.10 
# 
# Execute this to copy table data from a source RDBMS to MySQL. 
# Edit the options below to customize it. You will need to provide passwords, at least. 
# 
# Source DB: [email protected]:8000 (MySQL) 
# Target DB: [email protected]:8000 


# Source and target DB passwords 
arg_source_password= 
arg_target_password= 

if [ -z "$arg_source_password" ] && [ -z "$arg_target_password" ] ; then 
    echo WARNING: Both source and target RDBMSes passwords are empty. You should edit this file to set them. 
fi 
arg_worker_count=2 
# Uncomment the following options according to your needs 

# Whether target tables should be truncated before copy 
# arg_truncate_target=--truncate-target 
# Enable debugging output 
# arg_debug_output=--log-level=debug3 

/home/milosz/Projects/Oracle/workbench/master/wb_run/usr/local/bin/wbcopytables \ 
--mysql-source="[email protected]:8000" \ 
--target="[email protected]:8000" \ 
--source-password="$arg_source_password" \ 
--target-password="$arg_target_password" \ 
--thread-count=$arg_worker_count \ 
$arg_truncate_target \ 
$arg_debug_output \ 
--table '`test`' '`t1`' '`test_target`' '`t1`' '`id`' '`id`' '`id`, `name`, `date`' 

まず。次に、wbcopytablesコマンドの最後の引数を--ableから--table-に変更し、行末に条件を追加します。 サイドノート:--help引数でwbcopytablesコマンドを実行すると、すべてのオプションが表示されます。私はそれがあなたのために役立つことを願う

#<...> 
# Source and target DB passwords 
arg_source_password=your_sorce_password 
arg_target_password=your_target_password 

if [ -z "$arg_source_password" ] && [ -z "$arg_target_password" ] ; then 
    echo WARNING: Both source and target RDBMSes passwords are empty. You should edit this file to set them. 
fi 
arg_worker_count=2 
# Uncomment the following options according to your needs 

# Whether target tables should be truncated before copy 
# arg_truncate_target=--truncate-target 
# Enable debugging output 
# arg_debug_output=--log-level=debug3 

/home/milosz/Projects/Oracle/workbench/master/wb_run/usr/local/bin/wbcopytables \ 
--mysql-source="[email protected]:8000" \ 
--target="[email protected]:8000" \ 
--source-password="$arg_source_password" \ 
--target-password="$arg_target_password" \ 
--thread-count=$arg_worker_count \ 
$arg_truncate_target \ 
$arg_debug_output \ 
--table-where '`test`' '`t1`' '`test_target`' '`t1`' '`id`' '`id`' '`id`, `name`, `date`' '`date` >= "2017-01-02" and `date` <= "2017-01-03"' 

:あなたに似たように見えるスクリプトを取得する必要があり、すべての後