If your AD Connect SQL Express Database is nearing the limit of 10 GB. Which is the size limit of SQL Express Database. The Database that a local install of AD Connect uses. Then you have an option to actually shrink and reclaim database space. Which is the process described here:
On the server running AD Connect server:
1. Stop the AD Sync service
2. Take a backup of the AD Connect database files (ADSync.mdf and ADSync_log.ldf), located in:
- %ProgramFiles%\Microsoft Azure AD Sync\Data
3. Start the AD Sync service again
4. Start Powershell and go to the folder:
- %ProgramFiles%\Microsoft SQL Server\110\Tools\Binn
5. Run the following command to logon to the database (The instance name, can be found using the command from my previous blog post):
- .\SQLCMD.EXE -S “np:\\.\pipe\LOCALDB#SHDDF17A\tsql\query”
6. Next run the following command:
- DBCC Shrinkdatabase(ADSync,1);
Followed by GO to execute the command, as shown here:
The database has now been shrunk.
To check the actual size of the AD Sync SQL Express Database, see my previous blog post: How to check the size of the AD Connect SQL Express Database.
It is also recommended to reclaim some data, by clearing some historic data from within the AD Connect. This is done by:
1. Start the AD Sync “Synchronization Service” (Go to Start – Synchronization Service)
2. Go to the Operations Tab
3. Go to Actions and select Clear Runs and select the either all runs or within a date frame:
This clears out the history of the run jobs within the Synchronization Scheduler.
Azure AD Connect: How to recover from LocalDB 10-GB limit: https://docs.microsoft.com/en-us/azure/active-directory/hybrid/tshoot-connect-recover-from-localdb-10gb-limit