Showing posts with label changing. Show all posts
Showing posts with label changing. Show all posts

Monday, March 26, 2012

Rename machine with SQL server

I'm trying to write a script to run after changing the computer name of a machine running SQL Server 2005. I know about the article on the SQL Developer center that talks about sp_dropserver and sp_addserver. My question is about the Windows groups that are created with the machine name embedded inside (e.g. MACHINENAME\SQLServer2005MSFTEUser$MACHINENAME$MSSQLSERVER).

Do I need to worry about these? If the answer is no because the name of the group is irrelevant, how do I go about changing the machine name for the login (i.e. the MACHINENAME in front of the slash)? I don't want to hardcode these group names into my script.

Thanks for any help.

There is no need to do anything with those local groups. They're created when you install/setup sqlserver. When you change the computer name, you would need to update sqlserver so that its servername matches up with the computername. See the following article for more detail.

http://msdn2.microsoft.com/en-us/library/ms143799(SQL.90).aspx

Tuesday, March 20, 2012

rename a database

Hi,
How do I rename a database without changing the users permissions?
I have tried
ALTER DATABASE old_db_name
MODIFY NAME = new_db_name
and
EXEC sp_renamedb 'old_db_name','new_db_name'
and both give me:
Server: Msg 5030, Level 16, State 2, Line 1
The database could not be exclusively locked to perform the operation.
Thanks
// MalinMake sure that Old_db is not used by other resources at the time of
rename
Madhivanan