简体   繁体   English

SQL数据库从一台服务器复制到另一台服务器

[英]Sql database copy from one server to another server

I am just looking for some advice here as I am quite new to this. 我只是在这里寻找一些建议,因为我对此很陌生。 I have a client who requires a local copy of a SQL database and the same database running on a remote server. 我有一个客户端,该客户端需要SQL数据库的本地副本以及在远程服务器上运行的同一数据库。 the remote database is only kept as a backup and needs to be updated usign the information from the local database nightly. 远程数据库仅作为备份保存,需要每晚使用本地数据库中的信息进行更新。

What would be the best solution for this. 最好的解决方案是什么。 Should I write a C# application to copy the database accross to the live server nightly or does SQL server has something that we can use? 我应该每晚编写一个C#应用程序以将整个数据库复制到实时服务器中吗,还是SQL Server有我们可以使用的东西? If it is C# application do I need to use bulkcopy? 如果是C#应用程序,是否需要使用批量复制? would that also copy over the rows that has been changed or updated as well? 还会复制已更改或更新的行吗?

Any help would be greatly appriciated. 任何帮助将不胜感激。

Use SQL Server Agent and create a job with 3 steps: 使用SQL Server代理并通过3个步骤创建作业:

  1. Backup local database 备份本地数据库
  2. Copy .bak file to remote server 将.bak文件复制到远程服务器
  3. Restore .bak to remote server 将.bak还原到远程服务器

does it need to be an exact copy? 是否需要准确的副本? Why not blow away the tables each night on the backup and bulkcopy them over on a schedule? 为什么不每晚晚上删除备份表并按计划批量复制它们呢?

您还可以使用Redgate SQL比较SDK之类的工具来计划架构和数据更改,并通过

Here are couple options you can try: 您可以尝试以下几种选择:

  • SQL Server Agent job or a simple bat or powershell script that will backup, copy and restore database at the same time every day SQL Server代理作业或简单的bat或powershell脚本,每天将在同一时间备份,复制和还原数据库
  • Third party tools such as Red Gates comparison SDK or ApexSQL Diff API 第三方工具,例如Red Gates比较SDK或ApexSQL Diff API

How big are these updates? 这些更新有多大? If this is something that doesn't involve too much updates you might be able to do that with linked server and a bit more sophisticated queries. 如果这不涉及太多更新,则可以使用链接服务器和更复杂的查询来完成此操作。

暂无
暂无

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

相关问题 要将数据从sql server数据库传输到同一数据库的另一个副本 - To transfer data from sql server database to another copy of the same database ASP.NET应用程序如何将最近添加的数据从SQL Server数据库复制到不同SQL Server上的另一个相似数据 - How ASP.NET application can copy recently added data from SQL Server database to another similar one on different SQL Server 将整个数据库从一台服务器复制到.NET中的另一台服务器 - Copy entire database from one server to another in .NET 将整个表从SQL Server CE数据库复制到另一个表 - Copy a whole table from a SQL Server CE database to another 使用c#将数据库从一台服务器复制到另一台 - Copy database from one server to another using c# 使用asp.net C#将SQL Server 2016中的一个数据库复制到SQL Server 2012中的另一个数据库 - Copy one database in SQL Server 2016 to another in SQL Server 2012 using asp.net C# 使用 SQL Server 管理对象将存储过程从一个 SQL Server 2008 复制到另一个 - Copy a stored procedure from one SQL Server 2008 to another using SQL Server Management Objects 如何将数据从特定表中的一列复制到SQL Server中另一表中的相同命名列 - How to copy data from one column in certain table to same named column in another table in SQL Server 在代码中复制SQL Server数据库 - Copy SQL Server database in code 将表从一个SQL Server复制到另一个 - Copying table from one SQL Server to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM