📜 ⬆️ ⬇️

Resurrection Sharepoint or how not to burn at the stake of the Inquisition

image

What if one day you find that your favorite Sharepoint site is not available and all that is left of it is a content base that you cannot attach to the Sharepoint server? How to restore the "trillion" of the most important documents stored in the Sharepoint database? A short sad story and answers to these questions can be found in this article.

In one not the most beautiful morning I happened to face the situation described in Todd Klindt ’s article “Recovering SharePoint 2010 in emergency situations. Part 2 :
Suppose you have a typical small farm consisting of one SQL Server system and one SharePoint server. As a good SQL Server administrator, you make copies of all databases every night. One fine morning you come and hear the cries of users: “SharePoint collapsed!”. After drinking a cup of coffee, you are trying to connect to SharePoint and understand that it really refused. And not only SharePoint, but the entire server. You can not connect to the server via RDP, it does not respond to requests for ping - this is a clear death. You rush to the server room and see that the SharePoint server is frozen on the download screen, because it cannot find the hard disk from which this download should be performed. Whatever the disk subsystem, whether one disk, RAID 1 or RAID 5, all this can break. The server and all the content on it disappeared. What do you do other than to look in your pocket for a flash drive with your resume ?!
In fact, this is not a serious type of emergency, as only your SharePoint server crashed. Although the SharePoint server is an important part of the SharePoint system, SQL Server is just as important, so you can take advantage of the SQL Server system to quickly fix the situation. You need to make the server work either with the help of a new server, or by repairing what was broken in the existing server, and then reinstall Windows and download all the updates, complete the settings and join the domain. Then you need to reinstall SharePoint. After all the prerequisites have been met and the SharePoint files are installed, you should run the SharePoint Products Configuration Wizard.
That's exactly where the "magic". Instead of building a new SharePoint farm, you can simply connect to an existing farm. When you are asked which farm to connect to, specify the existing SQL Server system and the SharePoint configuration database that this system contains. Armed with the information contained in your farm's configuration database, a newly built SharePoint server can access existing web applications and start their maintenance almost immediately. SharePoint uses scheduled tasks to create the environment that is needed to serve content. Your web applications will be created in Microsoft IIS using these targets. The solutions that were installed in your farm will be installed on the new server using these tasks. When the configuration parameters are set, it may be necessary to clean up some trivialities, but these tasks are nothing compared with the server recovery performed after a complete crash.


Sighing with relief, I thought - this is the solution to the problem, but my case was not simple and the “magic” did not happen, I could not connect to the existing SQL server and tighten the configuration database. The SharePoint Import Wizard assured me in every way that the configuration database is not valid and nothing can be done. It was also not possible to convince SharePoint of the opposite (as it turned out later, this SharePoint server was obtained by migrating from the SharePoint version of 2007 and even then it was not without dances with a tambourine).
At this point, it became clear that the "resurrection" of SharePoint was delayed, and the user with torches and forks was already on the way.
')
Half an hour of google tormenting various requests for SharePoint disaster recovery led me to Mike Smith's article “Exploring SharePoint CMP Export Files” from the blog “Mike Smith's Tech Training Notes”.

The article describes the process of exporting content from an unattached Sharepoint database (export is done to * .cmp files), as well as the process of extracting the necessary documents from * .cmp files. The article also includes the compiled program and the source code of the project, which automatically unpacks cmp files and then extracts documents from them. The ability to quickly recover documents that users really need right here and right now is not bad. So I thought, launching the just downloaded program and mentally giving praise to its author. But here, too, an unpleasant surprise awaited me — when trying to retrieve documents, the program ended with an error of addressing to a nonexistent memory address. One thing was pleasing - the algorithm described in the article for manually extracting documents from cmp files worked so that it was determined empirically. The process consists in the following sequence of actions:



Extracting several thousand files manually seemed to me somewhat unproductive (finding and fixing the error that caused the Mike Smith program to work incorrectly also turned out to be not a trivial task for me), so it was decided to write a small console program in C # that performs the required operations. In my case, the algorithm of actions was as follows:



The program operates according to the following algorithm:

Source: https://habr.com/ru/post/210818/


All Articles