在 SQL Server Express 2008 上归档旧数据

发布于 2024-10-07 18:16:18 字数 323 浏览 0 评论 0原文

[SQL Server 2008 Express] [C# 4.0]

我开发了一个winforms应用程序,我想让用户有机会在每年年初归档旧数据。

例如,用户可以连接到查阅他的档案。

真实的场景是这样的:用户正在处理数据库,直到明年(2011)年初,他点击 ,我想复制然后删除所有 2010 年的交易数据(保留客户、供应商、员工、余额。 ..) 数据到一个名为 的新数据库,我跟踪 XML 文件中的所有存档文件名和位置。

我想知道 SQL 和 C# 双方要遵循的步骤才能完成此任务。

我欢迎任何建议、提示、示例、链接、书籍...

谢谢。

[SQL Server 2008 Express]
[C# 4.0]

I've developed a winforms application, I want to give the user the opportunity to archive old data at the beginning of each year.

The user can for example connect to to consult his archive.

The real scenario happens as follows: The user is working on the database, till the beginning of the next year(2011), he clicks on , I want to copy then delete all 2010 transactional data (keeping customers, suppliers, employees, balances...) data to a new database called , I keep track of all archive filenames and location in an XML file.

I'd like to know the steps to follow on both sides, SQL and C# in order to achieve this task.

I welcome any suggestion, tip, samples, links, books...

Thanks.

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

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

发布评论

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

评论(1

心头的小情儿 2024-10-14 18:16:18
  • 您是否有维护窗口来完成此任务?这是为了了解存档过程正在进行时没有事务发生
  • 如果您有维护时段,下面是我的建议
  • 步骤 1 - 在维护时段期间获取完整的数据库备份
  • 步骤 2 - 拥有一个存档脚本,该脚本将删除前几年的数据
  • 步骤 3 - 验证删除数据,这可以在测试数据集上进行测试和验证
  • 步骤 4 - 批量删除数据。有时您可能会遇到日志已满问题,您将删除巨大记录集中的记录,使其批量删除
  • 第5步 - 如果出现任何问题,请使用第1步中进行的完整备份并继续,直到您拥有正确的存档脚本
  • Do you have a maintenance window to accomplish this task. This is to understand there is no transaction happening while archival process is in progress
  • If you have a maintenance window below is my suggestion
  • Step 1 - Get FUll DB backup during maintenance window
  • Step 2 - Have a Archival Script which would delete the data for previous years
  • Step 3 - Validate the Delete data, This can be tested and validated on a Test Data Set
  • Step 4 - Delete the Data in batches. Sometimes you may end up with log full issues, You would be delete records in huge records sets, Make it batched delete
  • Step 5 - In case of any issues, Use the Full backup taken in Step 1 and continue until you have a proper archival script
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文