I accidentally removed one of the content databases from a web application. I mounted it back but now the content database shows zero site collections in it. I really messed up the production system, can anyone help me?
Thanks.
|
I accidentally removed one of the content databases from a web application. I mounted it back but now the content database shows zero site collections in it. I really messed up the production system, can anyone help me? Thanks. |
|||||||
|
|
You probably need to update the site map in the config db:
|
|||||||
|
|
Ok, I assume that you have removed the Content Database from the Web application but that is still existing in the SQL Server. You can attach the Content Database using
Run a |
|||
|
|
Did you check to make sure that you mounted the right db. If you type the database name wrong it will create a new database and it will show 0 current site count. I know - I've done this and because I didn't refresh the sql node I didn't see the new content_database listed. For example: Your content database is named:
You meant to type
But instead you type:
You will see that the database is attached to the web app but it will show 0 for the currentsitcount. Now if your upset that your site isn't up in the first place its easy to type the wrong name in powershell. What is annoying to me is that a new database is created and attached to the web application. I wish it would just throw back an error and state that the database doesn't exist but it doesn't. It just goes along its happy way and creates a new empty db for your web app. This may not be what happened to you but this happened to me and its an easy mistake to make and can set you off on a wild goose chase. |
||||
|
|
|
I know this question is nearly a year old, but we recently had a similar problem and I thought I'd post here in case it helps anyone else. We had the same issue, a web application that, according to central admin, had a single content database with 0 site collections in it. I ran the following commands:
Which outputted 2 instead of the 1 I was expecting (and that central admin was showing). These findings led me here. So I ran the suggested SQL query on the config database looking for the dodgy database reference in the Xml. When I had this guid I ran the suggested commands:
However, this gave a null reference exception. I then ran these commands:
Finally I ran the commands that Wictor suggested And central admin finally accepted that there was a site collection in the content database and over the course of an hour or so the web application started working properly again (I'm guessing that this was caused by numerous time jobs). |
|||
|
|