备份数据库并删除敏感数据
我正在研究备份例程,它允许我们的生产数据库使用从数据库中的某些列中剥离出来的敏感数据进行备份,然后导出到我们的测试服务器。
该例程应该需要最少的人工干预,并且希望只是一个简单的可定制 SQL 脚本,而无需使生产数据库脱机。
数据库服务器是SQL Server 2008。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前遇到过类似的要求,我所知道的唯一可靠的解决方案是使用生产数据库的副本。您可以屏蔽/删除副本上的数据并从那里运行备份。是的,它很丑陋并且浪费资源,但迄今为止我还没有找到解决这个特定问题的可靠替代方案。
至于复制方法,您确实有一些选择:
因此,虽然我承认这个解决方案相当令人畏惧,但它可以自动化并满足您的目的。如果您可以找到不需要删除的信息(例如报告、测试、开发)的数据库副本的高效用途,那么这实际上可能是一个不太糟糕的解决方案。拥有稍微过时的生产数据库版本并删除敏感数据可能是一个很好的安全保障。
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:
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.
如果您想进行备份,则只需键入
BACKUP DATABASE Dbname
如果您想指定脱机或其他任何内容,则可以执行此操作。
备份文件将在SQL SERVER 2008的默认路径上生成。
If you want to take a backup then Just type
BACKUP DATABASE Dbname
If you want to specify offline or anything else then you can do it.
The backup file will generate on the default path of the SQL SERVER 2008.