Adding the volume on Amazon EC2 was very straightforward. It was just a matter creating a new volume, attaching it to the server, enabling and then formatting the drive. This is covered quite nicely in Attaching an EBS Volume to EC2.
Now with the drive ready, I needed to move the DB files over. The instructions for Moving User Databases are pretty straightforward. However, I ran into some hiccups - I had open connections to the database (from when I was troubleshooting the database size :-) ) and the command to take the database offline simply waits until those connections are closed and you're none the wiser. Also, the new files / locations need to have the right permissions otherwise you can't bring the database back online. So, here are my updated steps.
- Close all connections to your database. You can check for open connections by executing an sp_who2
- Take the database offline by running the following:
ALTER DATABASE [Sync DB] SET OFFLINE - Move the files to the new location
- Update the new location in the system catalog as follows (make sure you use your own location!)
ALTER DATABASE [Sync DB] MODIFY FILE ( NAME = 'Sync DB', FILENAME = 'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Sync DB.mdf' );
ALTER DATABASE [Sync DB] MODIFY FILE ( NAME = 'Sync DB_log', FILENAME = 'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Sync DB_log.LDF' ); - Make sure that the database user has the correct permissions to the database files. I just copied the original settings which is giving the SQLServerMSSQLUser group full control access to the DATA folder (and the new database files).
- Bring the database back online by running the following:
ALTER DATABASE [Sync DB] SET ONLINE - Verify the file change by running the following:
SELECT name, physical_name FROM sys.master_files WHERE sys.master_files.database_id = DB_ID(N'Sync DB')
According to http://technet.microsoft.com/en-us/library/ff830030(WS.10).aspx FIM 2010 ships with 4 SQL agent jobs:
ReplyDeleteFIM_DeleteExpiredSystemObjectsJob
FIM_TemporalEventsJob
FIM_Maintain_GroupsJob
FIM_Maintain_SetsJob
One of the steps is specifically named:
FIM_TruncateInstanceDataStep
These SQL Agent jobs do not appear to be installed along with the FIM 2010 service installed as part of SharePoint 2010. It appears to me that these missing jobs are causing the enourmous SyncDB growth rate. IIRC the documentation indicated the SyncDB should be about 650 KB per profile, which is most certainly is not right now.
Interesting. On my servers, the SQL Server Agent is not even enabled. It does make sense that missing these jobs would cause the database to grow in size. However, I also have several other servers that are setup the same way, without these jobs, and they are running fine.
ReplyDeleteThanks for the tip, I will definitely do some more digging.
Have you figured out how to shrink the profile sync database? I don't have FIM and I have an ever growing sync db on my test farm.
ReplyDeleteI worked with Microsoft on this issue and they gave me a supported workaround which I blogged about here:
ReplyDeletehttp://paulliebrand.com/2011/05/26/user-profile-synchronization-database-growing-out-of-control/
Hopefully they put a proper fix in at some point.
Paul Liebrand
I found your article very useful, installing the Feb 2012 CU solved the problem somewhat, but I needed a way to reduce the database size further, I did this by changing a property on a timer job. I've written a post about it at http://troyvssharepoint.blogspot.co.uk/2012/10/sharepoint-user-profile-sync-database.html
ReplyDeleteHopefully this helps someone else