Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backup database and remove sensitive data

I'm looking at backup routine which allows our production database to be backed up with sensitive data stripped out of certain columns within the database to be exported to our testing server.

The routine should require the least human intervention and hopefully just be a simple customisable SQL script without taking the production database offline.

Database server is SQL Server 2008.

like image 905
Mike737 Avatar asked Nov 13 '22 23:11

Mike737


1 Answers

I've run into similar requirements before, and the only sure solution I know of is to use a copy of your production database. You can mask/delete data on the copy and run backups from there. Yes it's ugly and a waste of resources, but to date I haven't found a solid alternative for this particular problem.

As for the copy method, you do have some options:

  • Replication
  • Scheduled DB copy
  • Backup/restore from production

So while I admit this solution is pretty cringe-worthy, it can be automated and serve your purposes. If you can find productive uses for the database copy that don't require your deleted information (e.g. reports, testing, development) then this can actually be a less-than-terrible solution. It can be a nice security boon to have a slightly out-of-date version of your production database with sensitive data removed.

like image 146
ajk Avatar answered Dec 06 '22 17:12

ajk