Renaming a SharePoint Central Administration Database with a GUID Appended to the Database Name

by Kindler Chase 4. February 2008 00:00

note: I'd urge you to read all the comments other users have posted before renaming your database.

During the installation and subsequent configuration of SharePoint you are provided the option of naming every database in your farm with the exception of one: The SharePoint Central Administration Database. SharePoint has a nasty habit of always naming the Central Administration database as: SharePoint_AdminContent_87c08891-c3ca-4510-963a-ca70368f37ab where that big long string of numbers and letters represents a GUID. For some, the GUID in the database name is never a concern. For others, such as myself who can be rather anal about naming conventions shiver at the thought of having a GUID in a database name.

If you have enough foresight, you can actually preempt the name SharePoint gives the Central Administration database during installation using the PSCONFIG command. Well, at least that's what I've read.

In my case, SharePoint is already installed. And I'm willing to go out on limb and say your installation is up-and-running as well.

Changing the Central Administration Database Name

Before following any of the steps outlined below, be sure to back up your databases for obvious reasons.

  1. Log on to your SQL Server with an account having full access; ideally, this is the same account you used for your SharePoint installation.
  2. Open up SQL Server Management and locate the SharePoint_AdminContent_<GUID> database and copy the name of the database for reference later. You can also find the name of the database by logging into Central Administration > Application Management > Content Databases > change the web application to SharePoint Central Administration and the database name should be the same as what you discovered in SQL Server.
  3. In SQL Server, back up the SharePoint_AdminContent_<GUID> database.
  4. Restore the database you just backed up with a human readable name such as: SharePoint_AdminContent
  5. Log into SharePoint Central Administration > Application Management > Content Databases
    1. Change the web application to SharePoint Central Administration
    2. Click on the database name, which should be: SharePoint_AdminContent_<GUID>
    3. Select the database status: Offline
    4. Do Not select to delete the content database
    5. Click OK
  6. Open up a command prompt by right clicking the command prompt icon and selecting "run as…" and the run the command prompt as the user that provisioned the database. The "run as…" user is typically a service user account that you configured SharePoint to provision the content databases when you initially installed SharePoint.
    1. If you usually open a command prompt using Start > Run… > cmd, then here's how you find the command prompt icon: Start > All Programs > Accessories > Command Prompt.
    2. It is very important to use the correct user for this step, otherwise you'll end up with an error and likely some access denied messages.
  7. Once you have the command prompt open:
    1. Change the directory to the 12-hive bin where you can run the STSADM commands from:
      C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\
    2. Delete the original content database with the following STSADM command using the database with the GUID you looked up previously (be sure to change UrlOfYourCentralAdministration and NamedInstanceOfYourSqlServer to your names):
      stsadm -o deletecontentdb -url http://UrlOfYourCentralAdministration -databasename SharePoint_AdminContent_<GUID> -databaseserver NamedInstanceOfYourSqlServer
    3. Re-Associate the backed up database with your Central Administration with the following STSADM command (be sure to change UrlOfCentralYourAdministration and NamedInstanceOfYourSqlServer to your names):
      stsadm -o addcontentdb -url http:// UrlOfYourCentralAdministration -databasename SharePoint_AdminContent -databaseserver NamedInstanceOfYourSqlServer
  8. Open up Central Administration > Application Management > Content Databases: verify that your Central Administration database has been updated.
  9. If everything is OK, then you can delete the original database with the GUID from your SQL Server. And since you have a DBA who follows best practices then you already have a backup of the database you are about to delete which you can reference in the future if you ever need to restore it later.
    1. Note: If you attempt to delete the original SharePoint_AdminContent_<GUID> database and encounter an error saying there are connections to the database, then you did not properly un-associate the database from SharePoint. Go back to Step 1 and start all over.

That is all!

Comments

3/10/2008 6:01:42 PM #

How do you RunAs something like the NT AUTHORITY\NETWORKSERVICE or something like that. I think that's what the account is set as, and I'm getting "Access Denied" otherwise. Help.

scoder United States

3/10/2008 6:10:51 PM #

How do you find out what the correct account is that you need to RunAs? Help.

scoder United States

3/10/2008 7:33:40 PM #

To find out what account is running the Central Administration:

1. Open IIS > Application Pools
2. Right Click "SharePoint Central Administration v3" > Properties
3. Under the identity tab you'll find which account is running Central Administration.

If your identity is "Predefined" with something along the lines of "Network Service" then you have configured your MOSS installation improperly. You need to update the identity account. DO NOT update the account from within IIS; rather, use STSADM to update the account.

You should be using a domain service account. A common account name is something along the lines of "SPConfig".

Create the domain service account and add it to the administrators group on your SQL server and your SharePoint servers. (I'm making some assumptions here that you have set up the connections to the SQL Server as windows authentication.)

Eli Robillard has a good post describing how to change various accounts using the STSADM commands at weblogs.asp.net/.../...ds-in-moss-and-wss-3-0.aspx


How to change the Application Pool Identity for SharePoint Central Administration (SCA)

Repeat these steps on each server which hosts the SharePoint Central Administration web application. If the web front-end (WFE) and application (APP) server roles are served by separate machines, SCA should be enabled on one APP server (or more) and stopped and/or removed from the WFE servers. This allows control over access to the SCA. The SCA service account should not be the same as that used for the SharePoint application pool so even if one is compromised, the other remains secure.

1. Open a command prompt.  
2. Run: stsadm -o updatefarmcredentials -userlogin domain\username -password password
3. Be patient. This may take a few minutes to run.
4. To restart the application pool, either open IIS and recycle the application pool, or open a command prompt and type iisreset -noforce
5. Open SharePoint Central Administration in a browser to confirm that the change was successful.

The above steps create an Administration Application Pool Credential Deployment timer job. You can see this in the Timer Job Definitions page. The job is complete when it no longer appears in the list of definitions (refresh the browser, this isn't automatic).


You should now be able to use the SPConfig account (or whatever you named it) in the RunAs command shown above.

HTH's
::kindler::

Kindler Chase United States

5/22/2008 3:19:34 PM #

Thank you!!   Worked perfectly!   Smile

John United States

7/8/2008 5:48:52 AM #

I just solved a problem with by reading this post. Thank you so much for posting this !!

Great work Cheers!!

Rammi India

8/23/2008 1:44:02 PM #

Is an excellent post.It helped me a lot.

Swati Jain India

8/23/2008 9:00:36 PM #

Glad to hear the post is helping!!!

::kindler::

Kindler Chase United States

9/5/2008 4:59:04 AM #

Thank you for this post.

I suggest restoring the database with move option and then issue alter database statement.
In this way you can rename both physical and logical file names of new database
This ensures a cleaner situation db server side.

ex. (sql 2005 syntax)

restore database [SharePoint_AdminContent]
  from disk = N'x:\sql_backup_folder\SharePoint_AdminContent_<GUID>.bak' with
    file = 1
   ,move N'SharePoint_AdminContent_<GUID>' to N'x:\sql_data_folder\SharePoint_AdminContent.mdf'
   ,move N'SharePoint_AdminContent_<GUID>_log' to N'x:\sql_data_folder\SharePoint_AdminContent_log.ldf'
   ,nounload
go

alter database [SharePoint_AdminContent]
  modify file (
     name = 'SharePoint_AdminContent_43443efa-84fe-4315-a60b-876b39cd9cec'  
    ,newname = 'SharePoint_AdminContent'
  )
go

alter database [SharePoint_AdminContent]
  modify file (
     name = 'SharePoint_AdminContent_43443efa-84fe-4315-a60b-876b39cd9cec_log'  
    ,newname = 'SharePoint_AdminContent_log'
  )
go

Luca Italy

9/15/2008 7:21:25 PM #

This is an excellent post, however there is one step missing. BE SURE to run the command
stsadm -o preparetomove -contentdb SHAREPOINT:SharePoint_AdminContent_<GUID> prior to step 7 part 2.

I didn't do this at first, and several months later I found out not executing the command during the rename had broken the MOSS Profile Synchronization job. Among other things, this timer job synchronizes the UserInfo tables in every site collection with any updated profile information from the user profile database.

This will save you a huge headache down the line.

For more information check here:
blogs.technet.com/.../...ss-2007-environments.aspx

Jason Sceski United States

10/21/2008 1:58:32 PM #

On Server 2008 you must disable UAC, or "Access Denied" will occur.

Bob C United States

4/2/2009 5:29:06 PM #

I am new to Sharepoint and I have inherited a MOSS 2007 environment.  I would like to change the main Portals physical and logical database name as when it was first installed, it was created with the WSS_Content_{number} type format default database name.

Thanks.

Paul Normington Australia

4/16/2009 2:19:37 AM #

Thanks for this post!
It worked very well..

Manuel R Germany

5/25/2009 11:18:45 PM #

Hey Jason, -o preparetomove is not an option in my WSS 3.0 version of stsadm. Is this still a necessary step to this process?

tnk United States

5/25/2009 11:20:08 PM #

I just read your link and it looks like that step is for MOSS 2007 only. If you are running WSS 3.0, you won't have preparetomove as an option in stsadm, which hopefully means you don't need to worry about it.

tnk United States

Kindler Chase

Kindler Chase
This is SharePoint's world. I'm only living in it.

Your host, on the right, with my better half, Sadi.