Saturday, January 20, 2018
SQL Server Script Repository
Facebook Twitter LinkedIn Google+ Addthis
Term: Upgrading a database
2 post(s)

SQL Script - Database Compatibility

By Saleem Hakani on 8/25/2014

Setting the database to the right compatibility level is very important as it can have a negative impact on the performance and behavior of your databases. I've seen that many customers upgrade their SQL Servers from 2008 -> 2012 or from 2012 -> 2014 but forget to upgrade the compatibility of their databases. This basically means that though you have an upgraded version of SQL Server, your database cannot benefit from any new or enhanced features of SQL Server since your database is running on an old compatibility level.

Incompatible database compatibility could also lead to inefficient query plans. Therefore, it is important that you upgrade the compatibility of databases right after the database is upgraded to a newer version of SQL Server. This script can help go thru all the databases and provide you with a report on what databases are on old compatibility level and what compatibility level they need to be upgraded to.

Database Compatibility
Upgrading a database

SQL Script - Attach and Detach Databases

By Saleem Hakani on 8/25/2014

This script allows you to generate script to detach and attach one or all databases from your local SQL Server instance. This can be very useful when performing maintenance, upgrade, backups of files, relocating data/log files to other drives, etc. You no longer need to remember the long hard-coded file path after detaching the database since this procedure takes care of generating the entire command along with the path for you.

This script also takes care of the 16 file limit when using SP_Attach_DB system stored procedure. Please follow the help for successful implementation of this script.

Attach and Detach Databases
Attach database
Create Database For Attach
Detach database
Moving a Database
Relocating Database Files
Upgrading a database
Script Categories
Copyright [2014] by SQLCOMMUNITY.COM