Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jan 14th, 2013  |  syntax: SQL  |  size: 1.04 KB  |  hits: 4  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. USE master;
  2. GO
  3. DROP DATABASE BulkLoggedRecovery;
  4.  
  5. CREATE DATABASE BulkLoggedRecovery;
  6.  
  7.  
  8. ALTER DATABASE BulkLoggedRecovery SET RECOVERY BULK_LOGGED;
  9.  
  10. BACKUP DATABASE BulkLoggedRecovery TO DISK ='C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\BulkLoggedRecovery.bak'
  11.  
  12. USE BulkLoggedRecovery;
  13.  
  14. SELECT top(200) REPLICATE('a',2000) AS Somecol
  15. INTO SomeTable
  16. FROM sys.COLUMNS AS c;
  17. GO
  18. SHUTDOWN WITH NOWAIT;
  19.  
  20. SELECT  * FROM sys.DATABASES WHERE name = 'BulkLoggedRecovery'
  21.  
  22.  
  23. BACKUP LOG BulkLoggedRecovery TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\BulkLoggedRecovery_tail.trn' WITH NO_TRUNCATE
  24.  
  25.  
  26. RESTORE DATABASE BulkLoggedRecovery FROM DISK ='C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\BulkLoggedRecovery.bak' WITH NORECOVERY
  27.  
  28. RESTORE LOG BulkLoggedRecovery FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\BulkLoggedRecovery_tail.trn' WITH RECOVERY,CONTINUE_AFTER_ERROR
  29.  
  30.  
  31. USE BulkLoggedRecovery
  32. SELECT * FROM SomeTable