If you are a Site Collection Administrator, SharePoint allows you to go to a Site Collection, Site Actions->Site Permissions->Permission Levels, then edit a permission level and delete it.
Some predefined Permission Levels (SPRoleDefinition) have a Type (SPRoleType) defined. This is not visible via the UI. However you can get this via Powershell as follows:
$web = Get-SPWeb your-web-url
$web.RoleDefinitions | Format-Table Id, Name, Type, Hidden -AutoSize
This gives output like the following:
Id Name Type Hidden
-- ---- ---- ------
1073741829 Full Control Administrator False
1073741828 Design WebDesigner False
1073741827 Contribute Contributor False
1073741826 Read Reader False
1073741825 Limited Access Guest True
Now, if you delete one of these such as the Contribute and then decide to recreate it, the type is now "None". There is no way to make the Type "Contributor".
This is all fine, but if you have some code that calls Microsoft.SharePoint.SPRoleDefinitionCollection.GetByType then your code is now broken.
To "resolve" (using the term very loosely as I do not know if there are any implications), I was able to restore this by hacking the database directly.
Essentially, I looked into the Roles table in the WSS_Content database, filtered on the WebId and RoleId and set the Type column directly in the database. Is it a good idea? Who knows? It seemed to work for me, but I do not know what I may have broken as a result of this.
Learning how to do things and fix stuff as I go because who really has time to sit in a classroom. Posting it all here because I can not remember it all.
Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts
Tuesday, May 5, 2015
Friday, January 21, 2011
User Profile Service Application Synchronization DB size
I have a SharePoint instance that is running out of disk space. Doing some poking around, I found that the User Profile Service Application Sync_DB has grown to almost 7GB. So, I ran the following SQL query to get more insight into what is going on:
exec sp_MSforeachtable @command1="EXEC sp_spaceused '?'"
Looking through the results I see that the culprits are as follows:
I decided to take a peek inside these tables and it looks like there are thousands of objects created every day. So what are these and do they get cleared out any time?
I found a similar question asked: User Profile Service Application SyncDB Database Size. There is an response that is marked as an answer, but it merely leads us to recommended provisioning sizes of these databases to be medium to large (100GB to 1TB). There is no explanation why. This is quite bogus as I only have 75 profiles.
Argh!
I have posted a followup here: Moving the User Profile Service Application Synchronization Database
exec sp_MSforeachtable @command1="EXEC sp_spaceused '?'"
Looking through the results I see that the culprits are as follows:
name | rows | reserved | data | index_size | unused |
---|---|---|---|---|---|
ObjectsInternal | 3156618 | 2089728 KB | 800296 KB | 1288776 KB | 656 KB |
InstanceData | 177997 | 4698144 KB | 4697048 KB | 296 KB | 800 KB |
I decided to take a peek inside these tables and it looks like there are thousands of objects created every day. So what are these and do they get cleared out any time?
I found a similar question asked: User Profile Service Application SyncDB Database Size. There is an response that is marked as an answer, but it merely leads us to recommended provisioning sizes of these databases to be medium to large (100GB to 1TB). There is no explanation why. This is quite bogus as I only have 75 profiles.
Argh!
I have posted a followup here: Moving the User Profile Service Application Synchronization Database
Subscribe to:
Posts (Atom)