• Indexes,  Scripts

    INDEX DEFRAGMENTATION SCRIPT for SQL server 2000

      INDEX DEFRAGMENTATION SCRIPT SQL 2000 Index Defragmentation is one of the most important DBA tasks. This will significantly improve query performance. When you perform any DML operation (INSERT, UPDATE, or DELETE statements) table fragmentation can occur. If you use predefined maintenance plan it will take much server resource and time. Here is a custom stored procedure. Use the DBCC SHOWCONTIG statement. It will display the fragmentation information.   Here I used 3 conditions:   Fragmentation >=30 AND PAGES>1000 then rebuild Fragmentation between 15 to 29 AND PAGES>1000 then reorganize & update statistics If the above conditions are false then update the statistics Before you going to run the procedure…

  • DBA

    Difference between truncating and shrinking the transaction log file

      Difference between truncating and shrinking the transaction log file I have noticed in many forum the frequently asked question is “Truncating and shrinking the log file both are same” The answer is obviously NO. These both are totally different. Before going into discussion, let’s read the transaction log file architecture. Truncating the transaction log: Truncating a log file will change one or more VLF file’s status from active to inactive and mark the space for reuse. SQL server will change the VLF from active to inactive and reuses it automatically (Just like a circular).   When does it truncate and reuse it automatically? It depends upon your setting: recovery…