Tuesday, 25 September 2012

How to Rename SQL Server

With the release of SQL 2012 most of the companies might have started migration of SQL server to new version, In case of server migrations most of the time we will end up in a situation to rename the physical server hosting SQL Server, Renaming SQL Server to host the new physical server name is pretty simple as done below

MSDN Reference for Add Server http://msdn.microsoft.com/en-us/library/ms174411.aspx
As said in the article, This procedure must be executed on all instances of the Database Engine hosted on the computer. The instance name of the Database Engine cannot be changed.
 
On the SQL Server instance, run the following query.
sp_dropserver '<oldservername>'
go

sp_addserver '<newservername>', local
go

Now restart the SQL Server related services. Then, run @@servername to verify if the new name has been updated.
select @@servername

Monday, 3 September 2012

Process Explorer


As a DBA you land in situation where you need to find which process is using a File on the disk,
 
For Eg:- Your Tape backup process may be holding a old backup from Archiving or using it of Restore or a Application process may be holfing a File used in ETL making the ETL process to fail.
 
The best tool to find which WIN process is holding Flat files is "Process Explorer"
 
The exe is found in Windows Resource tool kit and does not need any install, all you need to do is copy the exe and start using it.

I have been using this for nearly 10 years now and works perfect every time. All you need to do is enter the file name are part of filename in the search box and you will get all the information you require. You can Also Kill the WIN Process or process tree using Process Explorer.

File:Process Explorer Screenshot.png