There are many incidents where I have seen that “User Profile Sync” doesn’t work properly. In spite of three “Full Profile Import” user profile doesn’t sync with web application’s and content database contains stale data. I would recommend you to perform below mentioned steps in phased manner.
As discussed, here are the list of command which I want you to execute. For reference please visit our TechNet site to the (http://technet.microsoft.com/en-us/library/cc263384.aspx).
1. Stsadm –o sync - listolddatabases <days>
< Lists content databases that have not been synchronized since n days. The presumption is that they have been deleted or moved>
2. If above command resulted any entry and SSP has only one web application associated with it, execute the deleteolddatabases command as mentioned below:
Stsadm –o sync –deleteolddatabases <days>
3. Stsadm –o synctiming m:5
[Sets the schedule for the main synchronization job. "M" denotes every n minutes (for example, “m:5” means every 5 minutes). Default is 60 minutes].
4. Stsadm –o preparetomove –contentdb <server name: database name> -site <URL name>
[Used to prepare sites and content databases before moving to a new Web application by setting up the profile and membership synchronization service. This prevents the synchronization service from failing and losing user privacy settings for those sites after the sites are moved.]
Command preparetomove is not required after Infrastructure Update patch on MOSS (Microsoft Office SharePoint Server 2007) Server.
Refer blog for detailed reason : http://blogs.msdn.com/toddca/archive/2009/01/30/preparetomove-away-from-running-this-command.aspx
Use preparetomove –undo switch, if you executed prepare-to-move by mistake.
5. stsadm.exe -o deletecontentdb –url <url name> -databasename <databasename>
[Detaches a content database when the Web application, database name, and database server are specified.]
6. stsadm.exe -o addcontentdb –url <url name> -datebasename <database name>
[Creates a new content database or adds a database that needs to be upgraded when the url and databasename parameters are specified.]
If all steps as mentioned above did not work try Phase II
Go to the content database and check dbo.userinfo table “tp_IsActive”
If we see many item under False, execute below mentioned command. (This switch will be available after Post SP1 update)
stsadm: stsadm -o sync -ignoreisactive 1
(All profiles will be syncronized, the flag will be ignored)
To delet all synchonization logs >> next profile sync run will be a "full sync", execute below mentioned command :
stsadm: stsadm -o deleteolddatabases 0
After the next profile synchronization job execution (by default every hour) all profiles will be synchronized. To check this, you can run stsadm -o listolddatabases 0 and search for the GUID of the affected content database further changes in AD will be applied to the userinfo table like changes of active marked user profiles.