mysql用のToadですべてのデータベースオブジェクトのスクリプトを生成するにはどうすればよいですか

StackOverflow https://stackoverflow.com/questions/4240173

質問

のフリーウェアバージョンで mysql用のヒキガエル (最新バージョン)、データベース内のすべてのテーブルのスクリプトを1つのファイルに生成できます。ただし、ストアドプロシージャと関数の場合、Toadはそれぞれに個別のスクリプト/ファイルを生成します。

理想的には、データベース内のすべてのオブジェクトのスクリプトを生成するための簡単なステップ(テーブル、ビュー、手順、関数、トリガー)が必要です。 単一のファイルに.

それはMySQLのヒキガエルで可能ですか?

役に立ちましたか?

解決 2

I think I have found a definitive answer. This operation cannot be done in Toad for MySQL. What do all of you do?!

We have been asking for this feature for many years and it has been never implemented. We hope to have that this year. We'll see.

-Ernest

I don't know why so few people are asking for those "Scripts" enhancement features. I comes from the Microsoft SQL sides, with Toad, I can't select any objects(views, procedures ) then generate DDL and rerun it in Production system. The stored procedures script generated from Toad can't even run in Production unless "Delimiter" is added.

-Lawrence

Note: I have found a suitable option for now using HeidiSQL (see other answer), but HeidiSQL is not as robust as Toad for MySQL, and I would prefer not to mix IDEs.

他のヒント

I am happy to report that HeidiSQL does exactly what I need it to do. This feature alone is worth having the 3 MB .exe on your system:

alt text

As a bonus, it's lightweight and fast. It can't do everything Toad for MySQL does, but for most tasks, I will default to Heidi instead of SUPER SLOW Toad!

If someone can still answer my question about how to do this operation in Toad for MySQL, I will change my accepted answer.

(and another option I have is using mysqldump)

What about Database -> Export -> Generate schema script. After that - spefify DDL file name and on Object types tab select needed types.

PS: oops, I've given a recipe for Toad for Oracle, but may be for mysql it is similar

For anyone still needing an answer for Toad... Go to the Object Explorer -> select all the tables -> Right click and select 'Send To -> Editor As Script'

Go to tools -> Export --> Export wizard Click Next

Click Next -> Add -> Databases

Select the databases you want to export

Click Next

Select the output format as SQL script

Select other options as below

Click Next -> Next -> Next -> export data

Your .sql scripts will exported to the file location

Found a workaround how to do it. In Object Explorer select all tables then Generate SQL > Creation Script. You have to run it few times on fresh database if you have relations. Unfortunately this can not be done for procedures.

It can be achieved using Tools > Compare function. You compare database with empty one, than after Toad compared databases Press Synchronize, then you will see option to open script in an editor.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top