TIP: SharePoint PowerShell Mount-SPContentDatabase "creates" databases on SQLServer


Hey there SharePoint Community,

Recently I was deliverying the SharePoint 2010 Migration Workshop which I strongly recommend, during a Lab I realized some behaviour that freacked me out. One of the labs requires to attach a pre-existen content database, the content database is already created in SQL Server as part of the Virtual Machines deployment used in this workshop. Lab instructed students to use cmdlet Mount-SPContentDatabase with the correct sintax, a student rised his hand to ask for help, as per student he executed the command with no errors, to be sincere I did not believe him so I decided to double check what he did, after a deep reading I noticed that he made a mistake with the database name and the content database with the wrong name was created in SQL Server. I checked the execution of the cmdlet and effectively Mount-SPContentDatabase was succeed, no errors or warnings.

WSS_Content_2007 – Content Database name provided in LAB

WSS_Conten_2007 – Content Database name wrote by student

From my point of view if Mount-SPContentDatabase attaches an EXISTANT database a PowerShell error should be thrown, so I checked using powershell help the cmdlet description as shown in pic below…

Descirption says that the cmdlet Attaches an EXISTANT database but it did not do that, it created a new one on SQL Server, this can be an issue for the DBA’s cause they could complain about the creation of the blank databases or databases that will not be used, so be careful.

Additionally I will share to you a cmdlet that DO CREATE new content databases New-SPContentDatabase.

References:

Add a content database (SharePoint Server 2010) – http://technet.microsoft.com/en-us/library/cc825314.aspx

New-SPContentDatabase (SharePoint Server 2010) – http://technet.microsoft.com/en-us/library/ff607581(office.14).aspx

Take care, until de next POST

Comments (1)

  1. Denzil Fernandes says:

    We just discovered this as we were creating scripts to migrate SP2007 databases and noticed new databases created

Skip to main content