• DBA

    Restoring a database from higher version to lower version SQL server

    Restoring a database from higher version to lower version SQL server How to downgrade a database from higher version to lower version? There is no direct way to do this like Backup/Restore. You can use an alternative ways. The alternative ways are,   1. Generate Script 2. Import/Export 3. Transaction replication You may use the alternative ways. It depends upon your environment. Restore errors A backup has taken from higher version (SQL 2008/2005) BACKUP DATABASE dba_test TO DISK='E:\mu\dba_2008.bak' Restore the backup to lower version (SQL 2005/2000)   RESTORE FILELISTONLY FROM DISK ='E:\mu\dba_2008.bak'   Restore error from SQL server 2005 to SQL server 2000 Server: Msg 3205, Level 16, State 2, Line 1 Too many backup…

  • SQL party

    Meme Monday: I Got 99 SQL Problems And the Disk Ain’t One

      Meme Monday: I Got 99 SQL Problems and the Disk Ain’t One I am a bit late to this party. I have seen this post from Grant’s blog now only. Thanks to Thomas LaRock such a great topic. Here is mine:   1. Too many indexes on a table Developers didn’t check their codes and an execution plan too. They just go and create the indexes (Duplicate indexes too).   2. Improper memory setting Improper min, max memory setting especially for 64-bit servers.   3. Improperly configured transaction log Whenever I got a new server, I have seen log backups are failing because, there is no current database backup. BACKUP LOG cannot be…

  • DBA,  Scripts

    Shrinking the log file script for SQL server database

    Shrinking the log file script for SQL server database                                This script mainly for a DBA’s, because most of the time the log file grow again and again and eats up all the disk space and finally an application goes down. Errors from SQL server error log: Error: 9002, Severity: 17, State: 2.   The transaction log for database ‘test’ is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases If you got an error “Error: 9002, Severity: 17, State: 2.” like this go and check the log_reuse_wait_desc column in sys.databases by running below command and see what value it returns.   SELECT name,…

  • 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…