SQL Server 2008 备份最佳实践

发布于 2024-08-20 02:46:32 字数 172 浏览 12 评论 0原文

无缘无故地,我丢失了数据库中的所有数据。幸运的是,这只是测试数据,但这让我思考如果使用生产数据库完成这一步会发生什么。

最终,每个开发人员都会遇到数据库问题并希望回滚数据库。我们不做任何事情来保护数据库,因为我们认为这是 DBA 的工作,但后来我们遇到了麻烦......

你们的备份最佳实践是什么?

Without not reason, I lose all my data in my database. Fortunately this was just test data, but this made me to think what will happen if this was done with a production db.

Ultimately, every developer got a db problem and want to rollback the db. We don't do things to protect the db, as we think its a DBA work, but then we got into trouble...

What are your backup best practices?

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

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

发布评论

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

评论(3

你的心境我的脸 2024-08-27 02:46:32

由于所有开发人员也是我工作的 DBA,因此我们也共同负责我们的备份策略 - 如果您关心数据,请确保您至少了解备份的工作原理,即使您是不属于实际决策的一部分。

我做的第一件事(在设置任何数据库之前)是制定夜间维护计划,其中包括完整备份,并将这些备份定向到另一台计算机(我们的 NAS)上的中央网络共享。至少,出于对工作的热爱,不要将备份放在数据库文件所在的同一物理存储上。如果您在丢失磁盘的同时也丢失了备份,那么备份还有什么用呢?

我们不进行时间点恢复,因此我们不进行日志备份(我们所有的数据库都设置为简单恢复模式),但如果您想要备份日志,请确保也包括这些日志,作为也是可以接受的间隔。

附带说明一下,SQL 2008 支持压缩备份,这大大加快了备份时间并使文件变得非常非常小 - 我想不出您不想使用此选项的实例。不过,我很想听听,并且我愿意重新考虑!

Since all the developers are also the DBAs where I work, we're collectively responsible for our backup strategy as well - if you care about the data, make sure you're at least informed about how the backups work, even if you're not part of the actual decisions.

The VERY first thing I do (before I even have any databases set up) is set up nightly maintenance plans that include a full backup, and direct those backups to a central network share on a different computer (our NAS). At the very least, for the love of your job, don't put the backups on the same physical storage that your database files sit on. What good are backups if you lose them at the same time you lose the disk?

We don't do point-in-time restores, so we don't do log backups (all our databases are set to Simple recovery mode), but if you want logs backed up, make sure you include those as well, as an acceptable interval as well.

On a side note, SQL 2008 supports compressed backups, which speeds up backup time considerably and makes the files much, much smaller - I can't think of an instance where you wouldn't want to use this option. I'd love to hear one, though, and I'm willing to reconsider!

梦在深巷 2024-08-27 02:46:32

以下是我自己的经验中的一些要点:

  • 将备份和 SQL Server 数据库文件存储在不同的物理存储上。否则,如果您的物理存储出现故障,您将丢失备份和数据库文件。
  • 创建您自己的 SQL Server 数据库备份计划。
  • 测试您的 SQL Server 备份。如果您从未测试过备份,我怀疑您是否能够在发生故障时恢复数据库。有时您需要练习在测试服务器上恢复备份。
  • 测试你的恢复策略 - 这是另一个提示。如果发生故障,您需要多长时间才能将数据库恢复到工作状态?
  • 备份 SQL Server 的系统数据库。

这不是完整列表,您可以在我的文章 https 中找到更多提示://sqlbak.com/blog/backup-and-recovery-best-practices/

Here are some points from my own experience:

  • Store your backups and SQL Server database files on the different physical storages. Otherwise, if your physical storage failed you will lose both backups and database files.
  • Create your own SQL Server database backup schedule.
  • Test your SQL Server backup. If you never tested your backups I have a doubt that you will be able to restore your database if the failure occurs. Time to time you need to have the practice to restore your backup on a test server.
  • Test your recovery strategy - here is another tip. If the failure occurs how much time do you need to restore your database to the working state?
  • Backup SQL Server's system databases.

And this isn't a whole list, you can find more tips in my article https://sqlbak.com/blog/backup-and-recovery-best-practices/

甜味拾荒者 2024-08-27 02:46:32

选择正确的备份策略是 DBA 在开发数据库时应考虑的最重要因素之一。

然而,您选择的备份策略取决于许多因素:

  1. 数据库上执行事务的频率是多少:每分钟是否有数千个事务正在进行,或者每天可能只有很少的事务?对于非常繁忙的数据库,我想说,每 10 分钟或更短时间进行一次完整的夜间备份和事务日志备份。
  2. 数据内容有多重要:可能是员工工资数据吗?那么您将没有可接受的借口,或者当您想开车回家时,您的车周围可能会出现一些愤怒的面孔!对于非常关键的数据库,可能在两个位置进行夜间备份,并每 5 分钟进行一次事务日志备份。 (还要考虑实施镜像)。
  3. 备份位置的位置:如果您的备份位置靠近数据库位置,那么与位于几跳之外且之间带宽不佳的情况相比,您可以进行更频繁的备份。

但总而言之,我想说的是,每晚安排一次备份,然后每隔一段时间进行事务日志备份。

Choosing the right backup strategy is one of the most important factors a DBA should consider at the point of developing the DB.

However the backup strategy you choose depends on a number of factors:

  1. How frequent is transaction carried out on the DB: are there thousands of transactions going on every minute or maybe few transactions per day? For very busy database, i would say, take full nightly backups and transaction log backups every 10 mins or even less.
  2. How critical the data content is: may it be employee payroll data? Then you'll have no acceptable excuse or you may have a few angry faces around your car when you want to drive home! For very critical database, take nightly backups possibly in two locations and transaction log backups every 5 mins. (Also think of implementing mirroring).
  3. Location of your backup location: if your backup location is close to the DB location, then you can afford to take more frequent backup than when it is located several hops away with not excellent bandwidth between.

But in all, i would say, schedule a nighly backup every night, and then transaction log backups at intervals.

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