new-spconfigurationdatabase reports the following error after creating the dbo.versions table in the config database. The version stamped in the database dbo.versions table is 12.0.0.6421 but the sharepoint version is 14.0.6029.1000. If I let the script create the database all it woks fine.
New-SPConfigurationDatabase : sp_farm_config_1s1 on spdb1s1-farm contains user-defined schema. Databases must be empty
before they can be used. Delete all of the tables, stored procedures and other objects or use a different database.
At \\lab.net\dfs01\bin\sp\AutoSPInstaller\SP2010\AutoSPInstaller\AutoSPInstallerFunctions.ps1:873 char:31
+ New-SPConfigurationDatabase <<<< -DatabaseName "$configDB" -DatabaseServer "$DBServer" -AdministrationCo
ntentDatabaseName "$CentralAdminContentDB" -Passphrase $SecPhrase -FarmCredentials $farmCredential
+ CategoryInfo : InvalidData: (Microsoft.Share...urationDatabase:SPCmdletNewSPConfigurationDatabase) [New
-SPConfigurationDatabase], SPUncleanDatabaseException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase
Comments: ** Comment from web user: ennoJena **
Hello,
I had the same problems while pre-creating databases for my SharePoint farm. Als already mentioned -- obviously the existence of the table 'dbo.Versions' causes the issue discussed in this thread.
How about this: SQL Native Client is a prerequisit component for installing SharePoint -- so the easiest way to solve the problem should be to delete this table by means of SQL Native Client. I have add some lines of code to AutoSPInstallerFunctions.ps1:
- - - - -
$connectFarm = Connect-SPConfigurationDatabase -DatabaseName "$configDB" -Passphrase $secPhrase -DatabaseServer "$dbServer" -ErrorAction SilentlyContinue
If (-not $?)
{
# Begin new code for deleting table 'dbo.Versions'
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection "server=$($dbserver);database=$($configDB);Integrated Security=sspi"
$sqlConnection.Open()
$sqlCommand = $sqlConnection.CreateCommand()
$sqlCommand.CommandText="drop table dbo.Versions"
$sqlReader = $sqlCommand.ExecuteReader()
$sqlConnection.Close()
# End new code for deleting table 'dbo.Versions'
Write-Host -ForegroundColor White " - No existing farm found.`n - Creating config database `"$configDB`"..."
# Waiting a few seconds seems to help with the Connect-SPConfigurationDatabase barging in on the New-SPConfigurationDatabase command; not sure why...
Start-Sleep 5
New-SPConfigurationDatabase -DatabaseName "$configDB" -DatabaseServer "$dbServer" -AdministrationContentDatabaseName "$centralAdminContentDB" -Passphrase $secPhrase -FarmCredentials $farmCredential
If (-not $?) {Throw " - Error creating new farm configuration database"}
Else {$farmMessage = " - Done creating configuration database for farm."}
}
- - - - -
So the way it should work is the following: If Connect-SPConfigurationDatabase fails, a table 'dbo.Versions' will be created by the cmdlet, but also an error occurs, so that the part of deleting table an create a new SPConfigurationDatabase will executed. If trying to connect to SPConfigurationDatabase is successfully -- everything is fine: nothing has to be deleted or new created.
OK -- I checked this only one time.
Could somebody please validate, if this is an proper mean to avoid the issue discussed in this threat?