"Attempt to register null pointer at" after patching SharePoint 2016 - Fabian Neve

About SharePoint, Javascript, PowerShell, and other technical stuff

Friday, June 8, 2018

"Attempt to register null pointer at" after patching SharePoint 2016

I keep it short because another blog helped me to solve this issue.

Source: https://sharepointsecrets.blogspot.com/2012/08/sharepoint-2010-patching-issues.html

Description

The first issue I faced as mentioned above was after installing the SP1 patch and trying to run PSConfig command. I have done a fair bit of patching but never encountered this issue. The PSConfig failed and referred to the upgrade logs as usual to find the error. The upgrade log error listed below was cryptic and did not provide any direct information on what was causing it.


Resolution

After breaking my head and stuck at this point I ran a script that we used to list all the databases attached to all the webapplications in the environment. When I checked the file with the output, I found that there was one line with nothing listed there except quotes. This indicated that there was some orphan database entry for a webapplication but was not sure which one. Following are the steps taken to find the webapplication and orphan database entry.

Run the following commands for all the webapplications in the farm


Note – This is easy to figure if you are using dismount and mount method for patching and upgrading the schema. When all the databases are dismounted and you run this command, the count for databases should be "1"

To get the count of databases attached to the webapplication type the following and hit enter


This outputs the number of content databases attached to webapplication on the screen, which in myr case should be "1" because all DBs are mounted. Finally one of the webapplications showed the count as "2" which meant that we had got our culprit webapplication. Next step was to delete the orphan entry to do which we needed the guid of the database.

To get the guid we ran the following sql query on the config database (objects table).


This provided as on output as shown in the screenshot below. The left column contained the name of the webapplication and right column contains a link to an xml file that lists all the properties of the objects table.


We went through the xml file associated with the webapplication that listed the database count as “1” and searched for the following pattern:


Where the “null” in the “fld type” tag denoted an orphan object. We noted down the guid. The next step was to delete the entry. We ran the following commands to do that, here you have to insert the URL of the WebApplication which has the noted guid:


Next run the following command to delete the orphan entry


Use the guid we noted down in the earlier step when we ran the sql query. Once the command has run successfully, please verify that the databases count is "1" by the running the following command:


Now you can rerun the PSConfig command and it should complete successfully.

No comments:

Post a Comment