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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 1: Basics of <strong>Backup</strong> <strong>and</strong> <strong>Restore</strong><br />

In short, when operating in FULL recovery model, you must be taking transaction log<br />

backups to manage the growth of data in the transaction log; a full database backup does<br />

not cause the log file to be truncated. Once you take a transaction log backup, space in<br />

inactive VLFs will be made available for new transactions (except in rare cases where you<br />

specify a copy-only log backup, or use the NO_TRUNCATE option, which will not truncate<br />

the log).<br />

Bulk Logged<br />

The third, <strong>and</strong> least-frequently used, recovery model is BULK_LOGGED. It operates in a<br />

very similar manner to FULL model, except in the extent to which bulk operations are<br />

logged, <strong>and</strong> the implications this can have for point-in-time restores. All st<strong>and</strong>ard<br />

operations (INSERT, UPDATE, DELETE, <strong>and</strong> so on) are fully logged, just as they would<br />

be in the FULL recovery model, but many bulk operations, such as the following, will be<br />

minimally logged:<br />

• bulk imports using the BCP utility<br />

• BULK INSERT<br />

• INSERT … SELECT * FROM OPENROWSET(bulk…)<br />

• SELECT INTO<br />

• inserting or appending data using WRITETEXT or UPDATETEXT<br />

• index rebuilds (ALTER INDEX REBUILD).<br />

In FULL recovery model, every change is fully logged. For example, if we were to use<br />

the BULK INSERT comm<strong>and</strong> to load several million records into a database operating in<br />

FULL recovery model, each of the INSERTs would be individually <strong>and</strong> fully logged. This<br />

puts a tremendous overhead onto the log file, using CPU <strong>and</strong> disk I/O to write each of<br />

the transaction records into the log file, <strong>and</strong> would also cause the log file to grow at a<br />

tremendous rate, slowing down the bulk load operation <strong>and</strong> possibly causing disk usage<br />

issues that could halt your entire operation.<br />

44

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

Saved successfully!

Ooh no, something went wrong!