Showing posts with label Orphan. Show all posts
Showing posts with label Orphan. Show all posts

Thursday, July 18, 2013

Event ID 6644 : Event manager error: Could not load file or assembly - Remove orphan evet handlers in SharePoint lists

שלום חברים,
הלקוח שלי ביצע מיגרציה לסביבת SharePoint 2010 מ- Moss 2007. לאחר המיגרציה (בוצעה לפני כחצי שנה) הופיע לעיתים קרובות ה-Error הבא ב- Event Log :



זה נובע בעיקר מחוסר ידיעה/תשומת לב לכל ה-DLL הרלוונטים ל- SharePoint(כולל של רכיבים שהוספו לחווה).
המשמעות של השגיאה היא, EventReceiver שהיה מקושר לרשימה לא רץ (לא קיים DLL ב-GAC) .

הפתרון הוא לבטל את הרישום של ה-Event לרשימה.
כתבתי Script ב- PowerShell , הרצתי אותו והבעיה שלי נפתרה.

מצ"ב ה-Script, תהנו :



# Get All SiteCollections
$siteCollection = Get-SPSite
 foreach ($site in $siteCollection)
 {
             <# Unmark the line below if you want to see the siteCollection Path each iteration
                   Write-Host "Site Collection Pathe :  " $site -foregroundcolor green #>
           
            #Check if there is a subsites under the SiteCollecyion if isn't write "The SubSite Doesn't Exist"
            if ($site.AllWebs.count -gt 0)
            {
              foreach($web in $site.AllWebs)
              {
              <# Unmark the line below if you want to see the SubSite Path each iteration
                   Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow#>

                         foreach ($list in $web.Lists)
                         {         
                              # Colelction of EventReceivers of the list
                               $ev = $list.EventReceivers
                                      
                             # Check if there is an EventReceivers
                               if ($ev.count -gt 0)
                               {
                                   
                       <# Unmark the line below if you want to see the List Name and the number of the EventReceivers
                             Write-Host "List Name :  " $list.Title -foregroundcolor Gray  
                            Write-Host "Number of eventRecivers in List :  " -foregroundcolor Gray -nonewline; Write-Host                             $ev.count -foregroundcolor Blue#>
                                               
                                    # Get the Curent EventReceiver
                                    foreach ($myev in $ev)
                                                {                      
                                     
                                                  if($myev.assembly -eq 'Write here the EventReceiver Assembly')
                                                   {
                                                            Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                                                            Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow
                                                            Write-Host "List Name :  " $list.Title -foregroundcolor Gray
                                                            Write-Host $myev.assembly -foregroundcolor cyan
                                                            $myev.delete()
                                                  }        
                                                }
                                       }
                         }
              }
            }
            else
            {
                        Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                        Write-Host "No SubSites" -foregroundcolor red
            }          
 }


בהצלחה !
רון נס.







============================================================================================================================================================================================================================================================




Hello Friends,
Befor 6 Months ,My client migrate his  Moss 2007 environment to SharePoint 2010 environment. After The Migration some Errors appeared frequently on the Event Log:



This is mainly due to lack of knowledge / attention to the relevant DLLs to SharePoint (including the components were added to the farm).
The Meaning of the error is the EventReceiver was linked to the list but was not running (there is no DLL in the GAC(.

The solution is to unregister the Event from the list.
I wrote a script inPowerShell, ran it, and my problem was solved.

Here is the script, enjoy:

# Get All SiteCollections
$siteCollection = Get-SPSite
 foreach ($site in $siteCollection)
 {
             <# Unmark the line below if you want to see the siteCollection Path each iteration
                   Write-Host "Site Collection Pathe :  " $site -foregroundcolor green #>
           
            #Check if there is a subsites under the SiteCollecyion if isn't write "The SubSite Doesn't Exist"
            if ($site.AllWebs.count -gt 0)
            {
              foreach($web in $site.AllWebs)
              {
              <# Unmark the line below if you want to see the SubSite Path each iteration
                   Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow#>

                         foreach ($list in $web.Lists)
                         {         
                              # Colelction of EventReceivers of the list
                               $ev = $list.EventReceivers
                                      
                             # Check if there is an EventReceivers
                               if ($ev.count -gt 0)
                               {
                                   
                       <# Unmark the line below if you want to see the List Name and the number of the EventReceivers
                             Write-Host "List Name :  " $list.Title -foregroundcolor Gray  
                            Write-Host "Number of eventRecivers in List :  " -foregroundcolor Gray -nonewline; Write-Host                             $ev.count -foregroundcolor Blue#>
                                               
                                    # Get the Curent EventReceiver
                                    foreach ($myev in $ev)
                                                {                      
                                     
                                                  if($myev.assembly -eq 'Write here the EventReceiver Assembly')
                                                   {
                                                            Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                                                            Write-Host "SubSite Pathe :  " $web -foregroundcolor Yellow
                                                            Write-Host "List Name :  " $list.Title -foregroundcolor Gray
                                                            Write-Host $myev.assembly -foregroundcolor cyan
                                                            $myev.delete()
                                                  }        
                                                }
                                       }
                         }
              }
            }
            else
            {
                        Write-Host "Site Collection Pathe :  " $site -foregroundcolor green
                        Write-Host "No SubSites" -foregroundcolor red
            }          
 }



 Good Luck :)

Ron Ness.

Tuesday, May 28, 2013

Orphaned items in SharePoint Content Databases


היי חברים,

מבדיקה שערכתי בחווה גיליתי את השגיאה הבאה (מוקף באדום בצילום המצורף). אז על מה בעצם מדובר

אובייקט יתום אינו נגיש למשתמשים, אבל עדיין תופס מקום במסד נתונים. אובייקט יתום יכול לפעמים לגרום לשדרוג להיכשל.
למה הוא נקרא אובייקט יתום ולמה אכפת לי?
אובייקטים מיותמים נקראים כך בגלל שאין להם הורה שמכיל אותם כמו למשל מסמך שאין לו ספריית מסמכים שהוא מוכל בו , ובנוסף אין דרך להגיע לתוכן באמצעות ממשק המשתמש.


כדי לזהות פריטי יתומים, השתמש בשורת הפקודה הבאה:



כתוב את שורת הפקודה הבאה:
stsadm -o databaserepair -url http://SiteURL -databasename DatabaseName

הפלט יהיה רשימת פריטים יתומים בפורמט XML (בתוך ה-CommandLine) מומלץ להעתיק את התוכן לקובץ txt ולבדוק את הפריטים.



כדי למחוק פריטי יתומים, השתמש בשורת הפקודה הבאה:
stsadm -o databaserepair -url http://SiteURL -databasename DatabaseName

פרמטרים דרושים: URL, databasename

פרמטר אופציונליים: deletecorruption



בהצלחה!
רון נס.
============================================================================================================================================================================================

When I was checking farm issues I discovered the following error (attached photo red ringed). 
So what actually is: 

Orphan objects are not accessible to the users, but still takes up spaces in content database.
It sometimes causes upgrade to fail as well. Why do they call them orphans and why do I care?
They are orphaned objects because they no longer have a parent container, and there's no way to get to the content through the UI

This is from the Moinitoring Section in Central Admin


To detect orphaned items, use the following command line:


Write the following Command line : 
stsadm -o databaserepair -url http://SiteURL -databasename DatabaseName


The output will be a list of orphaned items in XML format (inside the commandline) it's recommended to copy the content to txt file and check the items.




To delete orphaned items, use the following command line:
stsadm -o databaserepair -url http://SiteURL -databasename DatabaseName -deletecorruption

Required parameters: url, databasename
Optional parameter: deletecorruption

Good Luck :)
Ron Ness.