Moving SQL Express Database and Log File for a Lync Standard Edition Server

Databases in Lync Server 2010 are starting to become a pet hate of mine as when left to their not pre-created or SQL server is not configured with specific data and log location the SQL database and log files just create anywhere.

With Enterprise Edition, Archiving and Monitoring database, do check out my previously article Manual creation of Lync 2010 Databases for pre-created them

With standard edition especially the first standard edition, there has been a couple times where the database and logs have created somewhere I haven’t wanted them to.

On most cases it really doesn’t matter, however I have worked in a number environments where applications and data have to be stored on specific drives as the C: is reserved only to the Windows OS.

With every Lync server SQL express is installed with a RTCLOCAL instance and with Standard Edition there is additionally a RTC instance, here is a better explanation of the difference that I can do The Lync Server Databases

So here is how to move the .mdf and .lfd file to another location (disclaimer: I don’t know how supported this is, plus do test it also)

Firstly backup the databases (just in case)

Stop all Lync Server 2010 Services

  • Lync Server Application Sharing
  • Lync Server Audio Test Service
  • Lync Server Audio/Video Conferencing
  • Lync Server Call Park
  • Lync Server Conferencing Announcement
  • Lync Server Conferencing Attendant
  • Lync Server File Transfer Agent
  • Lync Server Front-End
  • Lync Server IM Conferencing
  • Lync Server Master Replicator Agent
  • Lync Server Mediation
  • Lync Server Replica Replicator Agent
  • Lync Server Response Group
  • Lync Server Web Conferencing
  • Lync Server Web Conferencing Compatibility

Stop RTCLocal SQL Service “SQL Server (RTCLOCAL)”

Restart RTC SQL server service “SQL Server (RTCLOCAL)” – This is just to close the XDS database (I ran into an issue detaching the CMS DB)

Detached SQL Database via SQL Management Studio on another SQL server, open a connection to the RTC instance standard edition server and then run the following query:

Use Master
GO
sp_detach_db ‘cpsdyn’
GO
sp_detach_db ‘lis’
GO
sp_detach_db ‘rgsconfig’
GO
sp_detach_db ‘rgsdyn’
GO
sp_detach_db ‘rtc’
GO
sp_detach_db ‘rtcab’
GO
sp_detach_db ‘rtcab1’
GO
sp_detach_db ‘rtcdyn’
GO
sp_detach_db ‘xds’
GO

Next copy the .MDF and .LDF (XCOPY C:\CsData\*.* F:\CsData /E) and then rename to original source folder you can deleted them at a later data

Next attach the databases in their new location

Use Master
GO
sp_attach_db ‘cpsdyn’, ‘F:\csdata\ApplicationStore\rtc\dbpath\cpsdyn.mdf’, ‘F:\csdata\ApplicationStore\rtc\logpath\cpsdyn.ldf’
GO
sp_attach_db ‘lis’, ‘F:\csdata\CentralMgmtStore\rtc\dbpath\lis.mdf’, ‘F:\csdata\CentralMgmtStore\rtc\logpath\lis.ldf’
GO
sp_attach_db ‘rgsconfig’, ‘F:\csdata\ApplicationStore\rtc\dbpath\rgsconfig.mdf’, ‘F:\csdata\ApplicationStore\rtc\logpath\rgsconfig.ldf’
GO
sp_attach_db ‘rgsdyn’, ‘F:\csdata\BackendStore\rtc\dyndbpath\rtcdyn.mdf’, ‘F:\csdata\BackendStore\rtc\dynlogpath\rtcdyn.ldf’
GO
sp_attach_db ‘rtc’, ‘F:\csdata\BackendStore\rtc\dbpath\rtc.mdf’, ‘F:\csdata\BackendStore\rtc\logpath\rtc.ldf’
GO
sp_attach_db ‘rtcab’, ‘F:\csdata\ABSStore\rtc\dbpath\rtcab.mdf’, ‘F:\csdata\ABSStore\rtc\logpath\rtcab.ldf’
GO
sp_attach_db ‘rtcab1’, ‘F:\csdata\ABSStore\rtc\dbpath\rtcab1.mdf’, ‘F:\csdata\ABSStore\rtc\logpath\rtcab1.ldf’
GO
sp_attach_db ‘rtcdyn’, ‘F:\csdata\ApplicationStore\rtc\dbpath\rgsdyn.mdf’, ‘F:\csdata\ApplicationStore\rtc\logpath\rgsdyn.ldf’
GO
sp_attach_db ‘xds’, ‘F:\csdata\CentralMgmtStore\rtc\dbpath\xds.mdf’, ‘F:\csdata\CentralMgmtStore\rtc\logpath\xds.ldf’
GO

Finally reboot the Standard Edition

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s