How do you guys fix the data in production
Very very carefully!
This may be too general a question: there are many variables involved regarding data size, error severity, how active that data is, what service level agreements you have with the client, ...
- Test the scripts in your dev/test environments as extensively as time allows.
- If you can, take a copy of the production system to test the scripts on. You probably need to do this on production services if your application handles PPI or other sensitive data.
- If you have an upcoming maintenance window when you can offline the production environment to test and apply the change (and rollback the DB if something goes wrong).
- If there is time in that window take a fresh copy of production database to retest before applying to production proper.
- Take a backup of production, so you can rollback if the update fails and makes more mess.
- Apply the change to production and test that the result is as desired.
- If all is well, drop the extra test copies and turn production back on, if not rollback to your backups and try again...
Of course if the data fix needs to be made more urgently, you may need to be much less cautious than the above list.