Quantcast
Channel: CodeFari
Viewing all articles
Browse latest Browse all 265

Truncate or Shrink a SQL Server log file

$
0
0


Many way you can shrink the log file, some trick is given below.

1. Management studio:
  • Don't do this on a live environment, but to ensure you shrink your dev db as much as you can:
  • Right-click the database, choose properties, then options.
  • Make sure "Recovery model" is set to "Simple", not "Full"
  • Click Ok
  • Right-click the database again, choose tasks -> shrink files
  • Change file type to "log"
  • Click ok.
2. By Command you can do as below


ALTERDATABASEYourDatabaseNameSETRECOVERYSIMPLE
DBCCSHRINKFILE('YourDatabaseName_log', 0,TRUNCATEONLY)

Viewing all articles
Browse latest Browse all 265

Trending Articles