SQL Server 的 mysqldump 等效项
是否有等效的模式& 用于 SQL Server 的数据导出/转储工具,就像用于 MySQL 的 mysqldump 一样。 试图重新定位旧的 ASP 站点,但我对在 Windows 服务器上工作感到很不高兴。
注意:DTS 导出实用程序自己似乎可以导出数据,而无需表定义。 使用企业管理器和导出数据库与导出架构和导出数据库更加接近。 数据...但仍然缺少存储过程。
基本上寻找一种万能的解决方案,可以立即获取我需要的一切。
Is there an equivalent schema & data export/dumping tool for SQL Server as there is for MySQL with mysqldump. Trying to relocate a legacy ASP site and I am way out of happy place with working on a windows server.
Note: The DTS export utility own seems to export data, without table defs.
Using the Enterprise Manager and exporting the db gets closer with exporting the schema & data... but still misses stored procedures.
Basically looking for a one does it all solution that grabs everything I need at once.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
备份/恢复不会做两件事:
是原始问题的一部分
两个数据库之间应该
当其中之一具有相同的结构
他们跑得很慢。 Unix 差异,
或 sdiff,忽略空白,但是
需要一种方法来制作输入文件。
Two things a backup/restore won't do:
was part of the original question
between two DBs that are supposed to
have the same structure when one of
them is running slowly. Unix diff,
or sdiff, ignoring white space but
need a way to make input files.
如果您需要等效的 SQL 语句,例如 CREATE TABLE... & INSERT INTO...,那么我推荐你尝试HeidiSQL。 它是一个非常棒的免费实用程序,可以访问 Microsoft SQL Server、MySQL 和 PostgreSQL。 它使您能够浏览和编辑数据,创建和编辑表、视图、过程、触发器和计划事件。 此外,您还可以将结构和数据导出到 SQL 文件。
http://www.heidisql.com
转到“工具”/“将数据库导出为 SQL”并选择架构。
选中该框以创建表和“插入”数据。 就是这样。
与“Microsoft SQL Server Management Studio”或 phpMyAdmin...等相比,我更喜欢 HeidiSQL。
If you need equivalent SQL statements like CREATE TABLE... & INSERT INTO..., then I recommend you try HeidiSQL. It's a fantastic and free utility that can access Microsoft SQL Server, MySQL and PostgreSQL. It enables you to browse and edit data, create and edit tables, views, procedures, triggers and scheduled events. Also, you can export structure and data to SQL file.
http://www.heidisql.com
Go to Tools / Export database as SQL and select the schema.
Check the box to create the tables and “Insert” data. That’s it.
I prefer HeidiSQL to "Microsoft SQL Server Management Studio" or phpMyAdmin... etc.
SQL Enterprise Manager 或 SQL Server Management Studio 具有基于向导的方法,后者将生成脚本,以便您可以查看其完成方式。
您还可以使用 BACKUP 和 RESTORE 命令。 更多详细信息请参见:http://msdn.microsoft.com/en-us/库/ms189826.aspx
SQL Enterprise manager or SQL Server Management studio have wizard based approaches, and the latter will generate the scripts so you can see how its done.
You could also use the BACKUP and RESTORE commands. More detail here: http://msdn.microsoft.com/en-us/library/ms189826.aspx
要使用 SQL Server 2008 Management Studio 轻松完成此操作:
1.) 右键单击数据库(不是表)并选择“任务”->“任务”。 生成脚本
2.) 单击第一页上的“下一步”
3.) 如果要复制整个数据库,只需单击下一步。 如果要复制特定的表,请单击“选择特定数据库对象”,选择所需的表,然后单击下一步。
4.) 应选择“保存到文件”。 重要:点击“保存到文件”旁边的“高级”按钮,找到“脚本的数据类型”,然后将“仅架构”更改为“架构和数据”(如果您想创建表) )或“仅数据”(如果您要将数据复制到现有表)。
5.) 单击其余部分即可完成! 它将另存为 .sql 文件。
To do this really easily with SQL Server 2008 Management Studio:
1.) Right click on the database (not the table) and select Tasks -> Generate Scripts
2.) Click Next on the first page
3.) If you want to copy the whole database, just click next. If you want to copy specific tables, click on "Select Specific Database Objects", select the tables you want, and then click next.
4.) "Save to File" should be selected. IMPORTANT: Click the Advanced button next to "Save to File", find "Types of data to script", and change "Schema only" to "Schema and data" (if you want to create the table) or "Data only" (if you're copying data to an existing table).
5.) Click through the rest and you're done! It will save as a .sql file.
最简单的方法是sql server数据库发布向导。
它没有 mysqldump 的所有功能,但已经足够接近了。
http://www.codeplex.com/sqlhost/wiki /view.aspx?title=database%20publishing%20wizard
The easiest way is the sql server database publishing wizard.
It does not have all the features of mysqldump but it is close enough.
http://www.codeplex.com/sqlhost/wiki/view.aspx?title=database%20publishing%20wizard
移动数据库的最简单方法是使用 SQL Server Management Studio 将数据库导出到另一台服务器,或者如果这不起作用,请按照其他人的建议进行备份,然后将其还原到其他位置。
如果您正在寻找一种将表结构转储到 SQL 以及为数据创建插入脚本的方法,一个很好的免费选择是使用 http://www.asql.biz/en/Download2005.aspx。
如果您想要一个好的付费版本,我会查看 Red-Gate SQL Compare 和 Red-Gate SQL-Data Compare。 不过,这些工具可能有点过头了,而且如果您不打算经常使用它们,它们可能会有点贵。 我认为这主要是由 DBA 负责的。 您可以在 http://www.red-gate.com/ 查看 Red-Gate 工具。
The easiest way to move a Database would be to use SQL Server Management Studio to Export the database to another server, or if that doesn't work, make a backup like other's had suggested and restore it elsewhere.
If you are looking for a way to dump the table structure to SQL as well as create insert scripts for the data a good free option would be to use amScript and amInsert from http://www.asql.biz/en/Download2005.aspx.
If you want a good pay version I would check out Red-Gate SQL Compare and Red-Gate SQL-Data Compare. These tools are probably overkill though and probably a bit pricey if you don't intend to use them a lot. I would think it would mostly be relegated to DBAs. You can look at the Red-Gate tools at http://www.red-gate.com/.
由于找不到合适的工具,我决定创建自己的工具:sqlserverdump 命令行实用程序。 在 github 上查看。
Not finding the right tool, I decided to create my own: a sqlserverdump command line utility. Check it out on github.
使用 SMO API 更简单。 它可以让你像 mysqldump 一样,甚至更好。 下面是一个代码示例:
http://samyem。 blogspot.com/2010/01/automate-sql-dumps-for-sqlserver.html
Even easier is to use the SMO API. It lets you do exactly like mysqldump, and even better. Here is a code example:
http://samyem.blogspot.com/2010/01/automate-sql-dumps-for-sqlserver.html
最简单的方法是备份和恢复或分离并附加
或编写所有表的脚本,然后 BCP 输出数据,然后 BCP 写入新服务器上的数据
,或者使用 DTS/SSIS 来执行此操作
easiest would be a backup and restore or detach and attach
or script out all the tables and BCP out the data then BCP in the data on the new server
or use DTS/SSIS to do this
如果您可以让 DTS 或集成服务连接到两台服务器,则可以使用向导将对象从一台服务器“复制”到另一台服务器。 “复制数据库”要求两台服务器可以相互验证,这通常意味着位于同一域中,并且服务在域登录下运行。
否则,您可以为架构生成脚本,并且可以使用 Integration Services/DTS 包将数据导出到一个文件,然后将其导入到另一个文件中。
我们现在一般使用SQL Compare和SQL 数据比较。 Red Gate 的 SQL Packager 也可能是一个选择。
If you can get DTS or Integration Services to connect to both servers, you can use the wizards to 'copy objects' from one server to another. 'Copy Database' requires that the two servers can authenticate with each other, which typically means being on the same domain and that the service runs under a domain logon.
Otherwise, you can generate a script for the schema, and you can use an Integration Services/DTS package to export data to a file, then import it on the other.
We now generally use SQL Compare and SQL Data Compare. Red Gate's SQL Packager might also be an option.
嗯,Mysqldump 是一系列 SQL 语句。 您可以使用 DTS 来完成此操作,但为什么不直接创建备份并在新计算机上恢复它呢?
如果你想通过 SQL 来完成:
http://msdn.microsoft.com/en-us /library/aa225964(SQL.80).aspx
或者右键单击数据库并点击“任务”->“ 备份 (http://msdn.microsoft.com/en-us/library/ ms187510.aspx)
Well, Mysqldump is a series of SQL statements. You can do this with DTS, but why not just create a backup and restore it on your new machine?
If you want to do it via SQL:
http://msdn.microsoft.com/en-us/library/aa225964(SQL.80).aspx
Or just right click the DB and hit Tasks -> Backup (http://msdn.microsoft.com/en-us/library/ms187510.aspx)