如何在 Toad for MySQL 中生成所有数据库对象的脚本

发布于 2024-10-03 19:37:35 字数 409 浏览 0 评论 0原文

Toad for MySQL(最新版本),我可以在一个文件中生成数据库中所有表的脚本。但是,对于存储过程和函数,Toad 会为每一个存储过程和函数生成一个单独的脚本/文件。

理想情况下,我想要一个简单的步骤来为数据库中的所有对象(表、视图、过程、函数、触发器)生成脚本到单个文件

是Toad for MySQL 可以吗?

In the freeware version of Toad for MySQL (latest version), I can generate a script of all tables in my database in one file. However, for stored procedures and functions, Toad generates a separate script/file for each one.

Ideally, I'd like a simple step to generate a script for all objects in my database (tables, views, procedures, functions, triggers) to a single file.

Is that possible in Toad for MySQL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

菊凝晚露 2024-10-10 19:37:35

我很高兴地报告 HeidiSQL 完全符合我的需要。 仅此功能就值得在您的系统上安装 3 MB .exe:

>好处是,它轻量且快速。它不能完成 Toad for MySQL 所做的所有事情,但对于大多数任务,我将默认使用 Heidi 而不是 SUPER SLOW Toad!

如果有人仍然可以回答我关于如何在 Toad for MySQL 中执行此操作的问题,我将更改我接受的答案。

(我的另一个选择是使用 mysqldump)

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)

ま昔日黯然 2024-10-10 19:37:35

我想我已经找到了明确的答案。此操作无法在 Toad for MySQL 中完成。你们都是做什么的?!

我们多年来一直要求此功能,但从未实现。我们希望今年能做到这一点。我们拭目以待。

-欧内斯特

我不知道为什么很少有人要求这些“脚本”增强功能。我来自 Microsoft SQL 方面,使用 Toad,我无法选择任何对象(视图、过程)然后生成 DDL 并在生产系统中重新运行它。除非添加“分隔符”,否则从 Toad 生成的存储过程脚本甚至无法在生产环境中运行。

-Lawrence

注意:我已经找到了现在使用 HeidiSQL 的合适选项(请参阅其他答案),但 HeidiSQL 不如 Toad for MySQL 强大,而且我不希望混合使用 IDE。

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.

破晓 2024-10-10 19:37:35

对于任何仍然需要蟾蜍答案的人......
转到对象资源管理器 ->选择所有表->右键单击并选择“发送至”->编辑器作为脚本'

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'

天生の放荡 2024-10-10 19:37:35

数据库怎么样 -> 导出 -> 生成架构脚本。之后 - 指定 DDL 文件名并在对象类型选项卡上选择所需的类型。

PS:哎呀,我已经给出了 Toad for Oracle 的配方,但对于 mysql 可能是类似的

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

忱杏 2024-10-10 19:37:35

转到工具 ->导出-->导出向导
单击下一步

单击下一步 ->添加->数据库

选择要导出的数据库

单击下一步

选择输出格式为 SQL 脚本

选择其他选项如下

单击下一步 -> ;下一步->下一步->导出数据

您的 .sql 脚本将导出到文件位置

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

莫多说 2024-10-10 19:37:35

找到了解决方法。
在对象资源管理器中选择所有表,然后生成 SQL >创建脚本。如果您有关系,您必须在新数据库上运行几次。
不幸的是,这对于程序来说是无法完成的。

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.

淡忘如思 2024-10-10 19:37:35

可以使用“工具”>“工具”来实现。比较功能。
您将数据库与空数据库进行比较,然后 Toad 比较数据库后按“同步”,然后您将看到在编辑器中打开脚本的选项。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文