Installing Lync Databases on a SQL Cluster (or standalone SQL back end) - Error_Create_DB (-4)

Hi Everyone

I hit an interesting hurdle the other day at a customer location where we were deploying Lync in a test environment. The Lync CMS and Pool databases were going to be hosted on instances in a SQL Server 2008 Cluster, that would be used by other applications as well. The DBAs had locked down those particular instances in a few particular ways, which I will get to later on in this article. I was using the following commands when installing the Lync DBs for an environment with two Enterprise Edition Pools (plus Monitoring/Archiving and CMS):

  • Pool 1 Databases - Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn -ForInstance SQL01 -UseDefaultSqlPaths -Report "C:\InstallDatabases.html"
  • Pool 2 Databases - Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn -ForInstance SQL02 -UseDefaultSqlPaths -Report "C:\InstallDatabases.html"
  • New CMS Database - Install-CsDatabase -CentralManagementDatabase -SqlServerFqdn -SqlInstanceName SQL01 -UseDefaultSQLPaths -Report "C:\InstallDatabases.html"

When running any of the above database creation cmdlets I would get the error below. Unfortunately the "Create-BackendStore-db02.child.contoso.org_sql02-[2012_05_03][16_51_21].log" referenced in the error provided no additional detail.

PS C:\Users\steve-a> Install-CsDatabase -ConfiguredDatabases -SqlServerFqdn -ForInstance sql02 -Report C:\dbresults4.html -UseDefaultSqlPaths
Running script: C:\Windows\system32\cscript.exe //Nologo "C:\Program Files\Common Files\Microsoft Lync Server 2010\DbSetup\DbSetup.wsf" /\sql02 /serveracct:CHILD\RTCHSUniversalServices /adminacct:CHILD\RTCUniversalServerAdmins /roacct:CHILD\RTCUniversalReadOnlyAdmins /role:se /verbose
Installed SQL Server 2005 Backward Compatibility version is 8.05.2312
Connecting to SQL Server on\sql02
SqlMajorVersion : 10
SqlMinorVersion : 0
SqlBuildNo : 4000
SQL version is acceptable: 10.0.4000.0
Default database data file path is E:\Data1\Data
Default database log file path is F:\Log1\Log
(Database rtcdyn doesn't exist.)
Creating database rtcdyn
    DbFile : PhysicalName = E:\data1\data\rtcdyn.mdf
    LogFile: PhysicalName = F:\log1\log\rtcdyn.ldf
Failed to create database rtcdyn
Error (
  name: Error
  number: -2147171504
Exit code: ERROR_CREATE_DB (-4)

Install-CsDatabase : Exception of type 'Microsoft.Rtc.Management.Deployment.DeploymentException' was thrown.
At line:1 char:19
+ Install-CsDatabase <<<< -ConfiguredDatabases -SqlServerFqdn -ForInstance sql02 -Report C:\db.results4.html
    + CategoryInfo : InvalidOperation: (:) [Install-CsDatabase], DeploymentException
    + FullyQualifiedErrorId : Script failed (code "ERROR_CREATE_DB") when installing "BackendStore" on "\sql02". For details, see the following log file: "C:\Users\steve-a\AppData\Local\Temp\Create-BackendStore-db02.child.contoso.org_sql02-[2012_05_03][16_51_21].log",Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet

Now unfortunately Bing'ing for this error didn't return a lot of results and so the next step was to have a look at what the Lync Resource Kit Tool cserror.exe yielded for the 214171504 error code. Below is what cserror.exe came back with. CSError.exe didn't leave me with much I could pursue further.

C:\WINDOWS\system32>cserror 2147171504
0xBFFFFFFF -> None matched

0x8000FFFF -> (E_UNEXPECTED) (kernel32.dll) Catastrophic failure

SQL Permissions

Now up until this point I hadn't had a lot of database creation failures with Lync, and I have installed Lync a lot of times in my lab. Typically if you have the following pre-requisites setup in SQL the Lync installation of DBs works beautifully:

  • Sysadmin rights in the SQL instance you are installing into;
  • Local Administrator rights on the SQL server;
  • That you have the right SQL Server and DB instance;
  • And that the Windows Firewall (or other in path firewalls) have been configured to allow SQL access from the remote Lync Servers;

So at this point I triple checked my SQL access to make sure all was well and that my access aligned with our recommended access levels. For more specifics on the required deployment SQL permissions for Lync please refer to the "Deployment Permissions for SQL Server" article found here

File Permissions

So if it isn't the SQL permissions what's next? The next thing to check was to make sure that the E:\Data1 and F:\Log1 folders weren't ACL'd in such a way that I couldn't create files there, despite being a local administrator. I attempted to create a couple of dummy files in those default SQL locations and this was successful. So wasn't file permissions.

I did however think at this point it would be interesting to see if any files are getting written to the default locations as the Lync cmdlets attempt to create the databases. So I re-ran the Install-CSDatabase and interestingly, for each of the Lync databases that the cmdlet attempts to create, each time the .ldf and .mdf files were created but just before the cmdlet error'd out the files were removed. Ahh a hint of where the problem lies...

Custom SQL Configurations

It was at this point that I reconnected with our DBAs and discussed what was happening. The DBA's then began investigating from their end into what might be happening. I discussed the error with a colleague of mine and he suggested something simple, "How about attempting to create one of the Lync databases manually in SQL Management Studio?". I thought this sounds like a pretty reasonable idea, and was something that I hadn't yet tried. Creating the database in SQL Management Studio failed and provided a pretty useful error (see below).

So the database creation error turned out to be due to a DBA policy that database names, on that particular SQL instance, should start with the letter "I". The DBAs were using a special trigger on DB creates and ensuring that the database naming standard was being adhered to.

Minimum Database Size

The DBAs kindly disabled the naming standard trigger and I then continued on with the database installation cmdlets. Unfortunately I then hit another snag where the database creation process was successful for all of the Lync databases except for the XDS, and RGSConfig. Interestingly enough the XDS and RGSConfig databases are two of the 4 Lync databases created with a starting size less than 50MB. I checked with the DBAs and they confirmed they had a policy in place preventing creation of databases under 100MB (using the Model DB). Preventing creation of small databases is a configuration regularly performed on Enterprise SQL clusters. The minimum database size issue has been seen by support and has been documented in the "Lync Server 2010 Install-CsDatabase command returns the error - Failed to create database" article found here

Wrapping it up

I hope this article helps others who might stumble onto the ERROR_CREATE_DB error to get a little quicker to the bottom of the problem.

Lync Rocks!




Additional References

Server Collocation in an Enterprise Edition Front End Pool Deployment -