30.06.2013 Views

SQL Server Backup and Restore - Simple Talk

SQL Server Backup and Restore - Simple Talk

SQL Server Backup and Restore - Simple Talk

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4: Restoring From Full <strong>Backup</strong><br />

It would only take one rogue employee to steal a list of all clients <strong>and</strong> their sensitive<br />

information to sell to a competitor or, worse, a black market party.<br />

If you work at a financial institution, you may be dealing on a daily basis with account<br />

numbers, passwords <strong>and</strong> financial transaction, as well as sensitive user information<br />

such as social security numbers <strong>and</strong> addresses. Not only will this data be subject to strict<br />

security measures in order to keep customers' information safe, it will also be the target of<br />

government agencies <strong>and</strong> their compliance audits.<br />

More generally, while the production servers receive the full focus of attempts to<br />

deter <strong>and</strong> foil hackers, security can be a little lacking in non-production environments.<br />

This is why development <strong>and</strong> QA servers are a favorite target of malicious users, <strong>and</strong><br />

why having complete customer records on such servers can cause big problems, if a<br />

compromise occurs.<br />

So, what's the solution? Obviously, for development purposes, we need the database<br />

schemas in our development <strong>and</strong> test servers to be initially identical to the schema that<br />

exists in production, so it's common practice, in such situations, to copy the schema but<br />

not the data. There are several ways to do this.<br />

• <strong>Restore</strong> the full database backup, but immediately truncate all tables, purging all<br />

sensitive data. You may then need to shrink the development copy of your database;<br />

you don't want to have a 100 GB database shell if that space is never going to be<br />

needed. Note that, after a database shrink, you should always rebuild your indexes, as<br />

they will get fragmented as a result of such an operation.<br />

• Use a schema comparison tool, to synch only the objects of the production <strong>and</strong><br />

development databases.<br />

• Wipe the database of all user tables <strong>and</strong> use SSIS to perform a database object transfer<br />

of all required user objects. This can be set up to transfer objects only <strong>and</strong> to ignore any<br />

data included in the production system.<br />

119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!