简体   繁体   English

我可以在SQL中将一个数据库复制到另一个数据库吗

[英]In SQL can I copy one database to another

I have two databases for my customers, a LIVE database and a TEST database. 我有两个供我的客户使用的数据库,一个是LIVE数据库,另一个是TEST数据库。 Periodically my customers would like the LIVE data copied over to the TEST database so it has current data that they can mess around with. 定期,我的客户希望将LIVE数据复制到TEST数据库中,以便拥有他们可以使用的最新数据。

I am looking for a simple way that I could run maybe a command in my application that would copy all the data from one and move it into the other. 我正在寻找一种简单的方法,可以在我的应用程序中运行一个命令,该命令可以将一个中的所有数据复制到另一个中。

Currently I have to remote in with their IT department or consultant and restore from a backup of the LIVE to the TEST. 目前,我必须与他们的IT部门或顾问远程联系,并从LIVE的备份还原到TEST。 I would prefer to have a button in my application that says RESTORE TEST and it will do that for me. 我希望在我的应用程序中有一个“ RESTORE TEST”按钮,它将为我做到这一点。

Any suggestions on how I could do this? 关于如何执行此操作的任何建议? Is it possible in SQL? 在SQL中可以吗? Is there a tool out there in .NET that could help? .NET中是否有可以提供帮助的工具?

Thanks 谢谢

If you have a backup plan, which I hope you do, you could simply restore the latest full .bak, if it is accessible to your application. 如果您有一个备份计划(希望这样做),则可以恢复最新的完整.bak(如果应用程序可以访问它)。 However, this would require some tunneling for your application to access the latest backup file and this is generally a no-no for zones containing database servers. 但是,这将需要一些隧道来使您的应用程序访问最新的备份文件,这对于包含数据库服务器的区域通常是禁忌。

Perhaps you could set up a scheduled delivery of a backup from machine to machine. 也许您可以设置计算机之间备份的预定交付。 Does the LIVE server have access to your TEST server. LIVE服务器是否可以访问您的TEST服务器。 I wouldn't think that a DBA would be inclined to set up a delivery of backup unless it was to have a remote backup location for disaster recovery and that is usually to dedicated locations, not a testing server. 我不认为DBA倾向于设置备份的交付,除非它具有用于灾难恢复的远程备份位置,并且通常用于专用位置,而不是测试服务器。 Maybe you could workout a scenario where your TEST server doubles as an extra remote backup location for the production environment. 也许您可以锻炼一个场景,其中TEST服务器可以兼作生产环境的额外远程备份位置。

It would be better to be shipped a backup and then periodically or manually start a job to restore from a local backup. 最好提供一个备份,然后定期或手动启动作业以从本地备份还原。 This would take the burden of your application. 这将负担您的应用程序的负担。 Then you would only need to simply kick of the sql job from within your app as needed. 然后,您只需要根据需要从应用程序内部简单地踢出sql作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以将数据从一个数据库表复制到另一个已经存在的数据库表sql服务器吗? - Can i copy data from one database table to another already existing database table sql server? 如何使用Visual Studio 2010和SQLEXPRESS将表从一个SQL Server数据库复制到另一个数据库 - How can I copy tables from one SQL Server database to another using Visual Studio 2010 & SQLEXPRESS 将表数据从一个数据库复制到另一个数据库SQL - Copy a table data from one database to another database SQL Sql 将表从一个数据库复制到另一个数据库 - Sql Copy table from One Database to Another Database SQL:自动将记录从一个数据库复制到另一个数据库 - SQL: Automatically copy records from one database to another database 如何在SQL Server中将一列从一个表复制到另一表 - How can I copy one column to from one table to another in SQL Server 将一个数据库复制到另一个数 - Copy one database to another database 在 SQL 服务器中将 Partial Table 从一个数据库复制到另一个数据库 - Copy Partial Table from one database to another in SQL Server 将记录从一个数据库上的表复制到另一个 Oracle SQL 开发人员 - COPY records from table on one database to another Oracle SQL Developer 在SQL Server数据库中将一列复制到另一列超过十亿行 - Copy one column to another for over a billion rows in SQL Server database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM