简体   繁体   English

升级数据库时使用的最佳方法是什么

[英]What is the best approach to use when upgrading a Database

We have a system that has a Mysql database with about 2Gigs of data. 我们有一个系统,它有一个包含大约2Gig数据的Mysql数据库。

The PC application that talks to the database has just been updated. 与数据库通信的PC应用程序刚刚更新。

There are a number of tables whose structure have changed and we need to run a conversion script. 有许多表的结构已更改,我们需要运行转换脚本。

The system is only used in office hours 该系统仅在办公时间使用

Question: 题:

What is the best approach to doing this upgrade? 进行此升级的最佳方法是什么?

  1. Wait until no one is using the system (since that's an option for you, I would plan to do it after hours). 等到没有人使用该系统(因为这是你的选择,我打算在下班后进行)。
  2. Backup the database. 备份数据库。
  3. Check your backup to make sure it worked. 检查您的备份以确保它有效。
  4. Double check you backup. 仔细检查你的备份。
  5. Run the update script. 运行更新脚本。
  6. Make sure your daily backup job still does what is needed (not usually an issue, but worth the energy to check). 确保您的每日备份工作仍然能够满足需要(通常不是问题,但值得检查的能量)。

A couple of other extra things. 还有其他一些额外的东西。 Let your users know you are going to do this even if it is after hours. 让您的用户知道您即使在下班后也会这样做。 The financial people get cranky when they plan to stay late to get W2s out (they have a legal deadline) and find out that they can't access the database. 当他们计划迟到W2s(他们有一个合法的截止日期)并发现他们无法访问数据库时,财务人员会变得暴躁。

If your database will allow you to put it into single user user mode, do this before making the changes. 如果您的数据库允许您将其置于单用户用户模式,请在进行更改之前执行此操作。 That way no one random person who is staying late will be able to make changes while you are midway through the change. 这样,任何一个迟到的随机人都无法在你改变的中途做出改变。

Be very ready to revert back in the morning when the users come back in if something is wrong. 如果出现问题,当用户回来时,请准备好在早上恢复。 That means you need to be there at start of business even if you normally come in later. 这意味着即使您通常在以后进入,也需要在业务开始时就在那里。

There are basically two approaches. 基本上有两种方法。 Both start with setting the database offline and creating a backup. 两者都从将数据库设置为脱机并创建备份开始。

Then you could build the new database and copy to the new database. 然后,您可以构建新数据库并复制到新数据库。

Or you could update each table/query. 或者您可以更新每个表/查询。

Then you could put the database back online. 然后你可以把数据库重新上线。

暂无
暂无

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

相关问题 .net核心数据库托管的最佳方法是什么? - What is the best approach for .net core database hosting? 将本地数据库sqlite与生产服务器(MySQL)同步的最佳方法是什么? - What is the best approach for sync local database sqlite with Production server (MySQL)? 在 GCP 帐户之间迁移 MySQL 数据库的最佳方法是什么? - What is the best approach to migrate MySQL database between GCP Accounts? 使用 postmeta 和 usermeta 的最佳方法? (Wordpress,Mysql 数据库) - best approach to use postmeta and usermeta? (Wordpress, Mysql Database) 将mySQL数据库中的数值分配给PHP变量时,最佳方法是什么? - What is the best method to use when assigning a numerical value from a mySQL database to a PHP variable? 插入由特定用户保存到数据库中的多个URL的最佳方法是什么? - what is the best approach to insert multple urls which is saved by a perticular user to the database? 什么是锁定mysql数据库的最佳方法。 没有创建更新和删除操作 - what is the best approach to lock the mysql database. no create update and delete opparation 设计跟踪订单和愿望清单的数据库的最佳方法是什么? - What's the best approach to designing a database that keeps track of orders and wish lists? 对于数据库查询,返回与您所关注的人的Twitter推文源类似的结果的最佳查询方法是什么? - What is the best approach for database queries that return results similar to Twitter's feed of tweets by people you follow? 跨 EC Core 上下文同步大型数据库表的最佳方法是什么? - What is the best approach to synchronizing large database tables across EC Core contexts?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM