创建 Sql Server 数据库夜间复制的最佳方法

发布于 2024-11-15 23:31:53 字数 209 浏览 9 评论 0原文

我想创造一份每晚都运行的工作。我有一个数据库 (MyDatabase),我想用它复制/替换我的临时数据库 (MyDatabase_Stage)。

我认为最简单的方法是做一些与 SQL Server Agent 相关的事情,但我以前从未做过这样的事情。进行此设置和测试的最佳实践和最简单的途径是什么?

我不在乎数据是否是 24 小时前的,最重要的标准是每晚同时进行完整复制。

I want to create a job that runs every night. I have a database (MyDatabase) that I want to copy/replace my staging database with (MyDatabase_Stage).

I presume the easiest way is to do something related to SQL Server Agent, but I have never done anything like this before. What is the best practice and easiest route to go to get this setup and tested?

I do not care if the data is 24 hours old and the most important criteria is that is does a full copy every night at the same time.

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

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

发布评论

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

评论(2

北方的巷 2024-11-22 23:31:53

将 .bak 文件复制到临时服务器并使用脚本从那里恢复。
在代理作业中按计划运行脚本。

脚本的好处是您可以稍后添加功能 - 例如,您可能不需要审计表,并且这些表可以被截断。

copy the .bak file to your staging server and restore from there using a script.
Run the script on a schedule in an agent job.

The benefit of a script is that you can add functionality later - for instance you might not require audit tables and these can be truncated.

指尖上的星空 2024-11-22 23:31:53

查看快照复制。作为设置的一部分,它将创建一个 SQL 代理作业来执行数据复制等操作。然后,您可以按照自己喜欢的时间和频率安排该工作。

Check out snapshot replication. As part of the setup, it'll create a SQL Agent job to do the copy of the data and whatnot. You can then schedule that job at whatever time and frequency you like.

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