The Undocumented "Feature" of Mount-SPContentDatabase

Today we are going to look at an undocumented (as of 8/6/14) functionality related to the Mount-SPContentDatabase PowerShell command for SharePoint 2010/2013.  If you are unfamiliar with this command, I suggest reviewing the TechNet documentation, which can be found here.  I was doing some migration testing for a customer recently and had to mount some content databases.  I opened PowerShell, typed the command, waiting a few minutes for the database to be mounted, and reviewed the PS output.  What!?!  No sites in the database?  That couldn’t be right.

At this point, I jumped over to SQL Server Management Studio.  The database was there and it contained all the standard SharePoint tables.  Problem was, these tables were empty.  So what happened to my content?  I checked the create date/time on the database and noticed that it was created a few minutes earlier.  As it turned out, the database did not exist prior to my Mount-SPContentDatabase command execution.  The Mount-SPContentDatabase command is supposed to attach existing databases to a SharePoint farm, so how did this database get created?  Testing revealed that, if the specified database does not exist, the Mount-SPContentDatabase command will create a new database (tested in SharePoint 2010 and 2013).  Creating a new database instead of notifying the user that the database name specified does not exist can lead to frustrating troubleshooting.  So the next time that your migrated content does not appear as expected following the Mount-SPContentDatabase command execution, you might want to check the create date/time on the content database.  Ya gotta love undocumented features.

Comments (2)

  1. Anonymous says:

    This is definitely a neat feature. Makes creating content databases faster if you use this hidden feature.

  2. Eric says:

    Yep, I had a similar freak-out moment when the same thing happened to me.  The MS PFE assigned to me was even surprised and then commented, "Thanks SharePoint…you did us a solid!".

Skip to main content