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.
using System; using System.Windows.Forms; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SertConsole { class Program { static void Main(string[] args) { try { //=========================================================== if (File.Exists("Manifest.xml")) { Console.WriteLine(" Manifest.xml "); //=========================================================== string ManifestXML = System.IO.File.ReadAllText(@"Manifest.xml"); Console.WriteLine(" Manifest.xml "); //=========================================================== DirectoryInfo dir = new DirectoryInfo(Directory.GetCurrentDirectory() + "\\"); FileInfo[] DatFiles = dir.GetFiles("*.dat"); Console.WriteLine(" dat : " + DatFiles.Length); //=========================================================== for (int i = 0; i < DatFiles.Length; i++) { if (File.Exists(GetNameFromDat(ManifestXML, DatFiles[i].Name))) { File.Move(DatFiles[i].Name, GetFreeName(GetNameFromDat(ManifestXML, DatFiles[i].Name))); } else { File.Move(DatFiles[i].Name, GetNameFromDat(ManifestXML, DatFiles[i].Name)); } File.Delete(DatFiles[i].Name); Console.WriteLine(": " + DatFiles[i].Name + " -> " + GetNameFromDat(ManifestXML, DatFiles[i].Name)); } Console.WriteLine(" , ..."); Console.ReadLine(); } } catch (Exception ex) { MessageBox.Show(" :" + "\r\n\r\n" + ex.ToString(), " ", MessageBoxButtons.OK,MessageBoxIcon.Error); } } //------------------------------------------------------------------------------------------- static string GetNameFromDat(string XMLString, string FileName) { string result = ""; int FileNamePos = XMLString.LastIndexOf(FileName); for (int i = FileNamePos-11; i > 0; i--) { if (XMLString.Substring(i, 5) == "Name=") { for (int j = i+6; j < FileNamePos-11; j++) { if (XMLString[j] == '"') { result = XMLString.Substring(i + 6, j - (i + 6)); goto to_Out; } } } } to_Out: return result; } //------------------------------------------------------------------------------------------- static string GetFreeName(string FileName) { string result = FileName; int count = 0; do { result = count.ToString() + "_" + FileName; count++; } while (File.Exists(result) == true); return result; } } }
Source: https://habr.com/ru/post/210818/
All Articles