Skip to main content

New SharePoint Config DB on pre-existing server

Today I had the pleasure of having to deal with a SharePoint test environment whose Config DB had a corruption. Being a test environment, and knowing that it was quite old and crufty as far as Test environments go, I decided the best way to deal with it was to kill the Config DB and create a new one, re-attach the content dbs and go from there.

A couple of points about this situation:
- the SharePoint environment is a single server environment (with SQL 2000 Standard running)
- I didn't want to set up an entirely new SharePoint server, simply use the current one keeping all the other stuff already running on it
- When re-creating the Config DB, I renamed it to a new naming standard

So I went about disconnecting the server from the farm by using the SharePoint Products and Technologies Configuration Wizard. This is a relatively straight-forward, wizard based task.

I re-ran the SharePoint Products and Technologies Configuration Wizard, this time creating a new farm with the desired Config DB name (SharePointTest_Config).

I then performed the usual initial tasks against the Config DB - create an SSP, set up index services, etc.

I then wanted to reconnect the content db's from the previous test config db. This is done by creating the first Site Collection, with the desired IIS config (port 80, host header, etc). It is well documented that you then need to remove the default content db, and attach your original content db with an stsadm command:

stsadm -o addcontentdb -url [url] -databasename [sql_db_name]

The following error would result:

Cannot open database requested in login '[old_config_sql_name]'. Login fails. Login failed for user '[farm_account]'.

The same error would appear in SharePoint's log files when you try to create a content db using Central Admin.

The culprit is a registry setting that stores the DSN that points to the Config db. The process of using the SharePoint Products and Technologies Configuration Wizard to create a new config db apparently doesn't update this DSN, but it is used when performing the stsadm -o addcontentdb command.

The registry key to look for is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\Secure\ConfigDb

Update this to point to the new SQL db, and re-run the stsadm -o addcontentdb command, and you should then see the magical "Operation completed successfully." message.


Popular posts from this blog

Thoughts, shortcomings, gotchas on SPFx Dynamic Data capabilities

It's the festive break, and I thought I'd try the new Dynamic Data capabilities that recently went to General Availability in SharePoint Framework 1.7.

I've been building a lot of React components lately, and all the SPFx web parts and application customisers with visual elements we create at Engage Squared, are built on React.  Dynamic Data in SPFx introduces a whole new world of modularity that we haven't had before. We can now split up the page elements into multiple web parts that, in the past, have been combined as one web part so state can be passed between them.  Doing this gives control back to the page author, with the ability to position components how they wish.

Breaking components up in to individual web parts also changes the way the components are designed, and forces the developer to leverage the responsive capabilities of modern pages.  Modern pages are designed from the ground up to work on many different screen sizes, and as long as each individual co…

Apps for SharePoint 2013 - Client and Server-side code

It's about time I blew the dust off this blog. Tonight I did a presentation at the Melbourne SharePoint User Group entitled Apps For SharePoint (2013). It included two demos based on the App For SharePoint 2013 solution template in Visual Studio 2012.

The two demos illustrated how you can create a separate ASP.Net Web Application. Demo 1 showed how easy it is to hook in to SharePoint to obtain List properties via server-side code (populating an ASP.Net Repeater Control). Demo 2 showed what you can do with SharePoint 2013's Javascript hooks. Specifically, using SP.UI.Controls.js from the /_layouts/15/ SharePoint folder to pull chrome elements out of SharePoint, and render them in your ASP.Net web app.

No animals were harmed in the making of these demos, but a few articles kindly provided on the Microsoft MSDN site helped put it together:
How to: Set up an on-premises development environment for apps for SharePointHow to: Create high-trust apps for SharePoint 2013 using the se…

SharePoint "Like" button

Ever wondered what the users of your Intranet really like or don't like? Ever wanted your SharePoint 2007 site to be more "web 2.0"-ey? Well I've published this quick and dirty codeplex project that allows the addition of a "Like" button the any SharePoint List item page.
The project is available as a WSP, and source code.
It consists of two things - a Web Part that is the button that users click to "Like" or "Unlike" something, and a List Template that can be used to create a list to store who "Likes" an item.
The button has two ways of operating. If it finds a list that was built on the List Template included in the WSP, it allows each user to Like or Unlike an item as they see fit. The button uses the List it found to keep track of who likes a given item, and queries the list when it renders to determine which option should be presented. Along with the button, the web part also displays a brief message explaining how many pe…