Wednesday, October 24, 2018

SCCM Secondary Site stuck in recovering - "Recover Secondary Site" grayed (edit 2019-01: + Upgrade grayed)

[EDIT 2019-01-27 begin]
I complete my article:
It exist a stored procedure spUpdateSiteStatus permitting to un-gray by changing status.(Thanks Alban for this tip)



For this situation for example: here Upgrade stay grayed after some hours
 but prerequisite KO (moreover you can see c:\ConfigMgrSetup.log , c:\ConfigMgrSetupWizard.log and X:\SMS_BOOTSTRAP.log NOT modified since 4 months ago since last upgrade)

You must execute in SQL (with  XXX = site code)

exec dbo.spUpdateSiteStatus 'XXX', 3,2



now you can try to upgrade again













 Checking stored proc code:
 3, 2  = Install Successed
 5,2   =  Upgrade Successed
 6,2 = Recover Successed

-->
below my old article
[EDIT 2019-01-27 end]





Problem in one of secondary site stuck in recovering

 


And recovering does not seems to be cancellable and "Recover Secondary Site" grayed





















In "Show Install Status" log stay at
[Passed]:Waiting for Database Replication Link State to be active.

















but in C:\ConfigMgrSetup.log secondary site seems to be active (PRI = Primary MXX=Secondary site code, secondary computer is mysecondary.mydomain.net)

INFO: Verified that iphlpsvc is running on \\mysecondary.mydomain.net.
INFO: Setup will not check the CcmExec service .
INFO: Configuring SQL Server service broker... 
INFO: Reading Primary SQL Server certificate, Primary sitecode is PRI.
INFO: SQL Connection succeeded. Connection: SMS ACCESS, Type: Secure
INFO: Stored Parent Site [PRI] SQL Certificate to registry. 
INFO: SQL Connection succeeded. Connection: mysecondary.mydomain.net CONFIGMGRSEC\CM_MXX, Type: Secure
INFO: Service Broker configuration complete.
CPublicKeyLookup::Initialize("E:\Program Files\Microsoft Configuration Manager\inboxes\hman.box\pubkey") 
CPublicKeyLookup::Initialize()  Initializing the Public Key Store Path to E:\Program Files\Microsoft Configuration Manager\inboxes\hman.box\pubkey~ 
CPublicKeyLookup::UpdateCurrentKey("PRI", "0602000000A40XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
CPublicKeyLookup::UpdateCurrentKey() Checking E:\Program Files\Microsoft Configuration Manager\inboxes\hman.box\pubkey\PRI.pkp for Key0~ 
CPublicKeyLookup::UpdateCurrentKey() Matching Key found in iteration 0.  Updating Date.~ 
INFO: Registered type SMS_ACCESS for mysecondary.mydomain.net CONFIGMGRSEC\CM_MXX 
INFO: SQL Connection succeeded. Connection: SMS_ACCESS, Type: Secure 
INFO: SiteStatus set to 105 on mysecondary.mydomain.net 
INFO: send message 0x00030051 to parent 
INFO: SQL Connection succeeded. Connection: SMS ACCESS, Type: Secure 
INFO: wait for secondary site replication state to be active. 
INFO: send message 0x00060007 to parent 
INFO: send message 0x00060007 to parent 
INFO: send message 0x00060007 to parent 
INFO: send message 0x00060007 to parent 
INFO: send message 0x00060007 to parent 
INFO: secondary site is now active 
INFO: send message 0x00060008 to parent 
INFO: send message 0x00060004 to parent 
INFO: verifying content metadata (1 processed)...  
INFO: send message 0x00060006 to parent 
INFO: Some content does not exist on secondary site. Make call to ResetMappedPkgStatus() 
Content can be identified with SQL query on Secondary Site DB: SELECT * From  PkgStatus_G where SourceVersion = 0 AND Type=1 AND SiteCode=dbo.fnGetSiteCode()
INFO: send message 0x00060005 to parent 
INFO: send message 0x00060002 to parent 
INFO: Removing byte order marker after reading from file (E:\Program Files\Microsoft Configuration Manager\bin\X64\secondarysiteupdatepackage.xml) 
Successfully update secondary site update pacakge status from file E:\Program Files\Microsoft Configuration Manager\bin\X64\secondarysiteupdatepackage.xml 
INFO: Successfully begin Automatic Updates detection task 
Not recovery mode or not top level site. Skip restoring client piloting packages. 
~~===================== Completed Configuration Manager Server Setup ===================== 





Waiting some hours, but Secondary site was always in "recovering mode" . I find problem could be in SCCM SQL table Sites


After some internet search, I only find information about something really interesting in Release notes for System Center Configuration Manager
which give me information that table Sites AND  SC_SiteDefinition_Property  tables are important


I copy some article line in case of article deletion:

Recovery options for a secondary site are not available in the console

After recovery of a secondary site fails, the option Recover Secondary Site might no longer be available in the Configuration Manager console.
This issue affects System Center Configuration Manager version 1511 and 1602, and is expected to be resolved in a future update.
Workaround: Use one of the following methods to recover (reinstall) the secondary site:
  • Use Preinst.exe and the /delsite command to remove the secondary site, and then reinstall the secondary site. For information about preinst.exe, see Hierarchy Maintenance Tool (Preinst.exe) for System Center Configuration Manager
  • Run the following script to start the secondary site recovery. You run this script on the database at the primary parent site of the secondary site you want to recover:

    declare @SiteCode NVARCHAR(3)=N''  

    UPDATE Sites SET Status = 9 
                    , DetailedStatus = 3 
    FROM Sites WHERE SiteCode = @SiteCode 

    UPDATE SCP SET SCP.Value1 = 9 
                    , SCP.Value2 = N'3' 
    FROM SC_SiteDefinition_Property SCP INNER JOIN SC_SiteDefinition SC ON SC.SiteNumber = SCP.SiteNumber 
    WHERE SC.SiteCode = @SiteCode AND SCP.[Name] = N'Requested Status'   


I DON'T WANT delete my secondary site. Too much configuration to do, and Microsoft recommend to use another SiteCode
So I verify that using some SQL queries

SELECT * FROM Sites




We can see "Status"  and "DetailedStatus" field different in MXX from others Site codes



 SELECT * FROM SC_SiteDefinition_Property
 WHERE SiteNumber
IN (
SELECT Sitenumber FROM SC_SiteDefinition
WHERE SiteCode = 'MXX'

)
As you can see field Named "Requested Status" has Value1 corresponding to "Status" Sites table and Value2 corresponding to "DetailedStatus" Sites table


Information about theses information in SMS_Site Server WMI Class

RequestedStatus
Value indicating a request for secondary site status. Possible values are listed below. The default value is 1001.
1001 Create a secondary site; the primary site will send down the installation media.
1002 Create a secondary site using the installation media already available on the secondary site.
1003 Secondary site creation has started.
1004 Upgrade a secondary site; the primary site will send down the installation media.
1005 Upgrade a secondary site using the installation media already available on the secondary site.
1006 Secondary site upgrade has started.
1007 Deinstall a secondary site.
1008 Secondary site deinstall has started.
1009 Delete a secondary site.
1010 Secondary site deletion has started.
1011 Recover a secondary site; the primary site will send down the installation media.
1012 Recover a secondary site; the installation media is already available on the secondary site.
1013 Secondary site recovery has started.

Status
Current status of the site. Possible values are listed below. The default value is ACTIVE (1).
1 ACTIVE
2 PENDING
3 FAILED
4 DELETED
5 UPGRADE
6 Failed to delete or deinstall the secondary site.
7 Failed to upgrade the secondary site.
8 Secondary site recovery is in progress.
9 Failed to recover secondary site.

[EDIT 2019-01-27 begin]


From https://blogs.technet.microsoft.com/umairkhan/2014/02/17/configmgr-2012-data-replication-service-drs-unleashed/  which seems to complete DetailedStatus

SiteStatus
Mode
100
105
110
115
120
125
130
135
199
200
205
210
215
220
225
230
250
255

'SITE_INSTALLING'
'SITE_INSTALL_COMPLETE'
'INACTIVE'
'INITIALIZING'
'MAINTENANCE_MODE'
'ACTIVE'
'DETACHING'
'READY_TO_DETACH'
'STATUS_UNKNOWN'
'SITE_RECOVERED'
'SITE_PREPARE_FOR_RECOVERY'
'SITE_PREPARED_FOR_RECOVERY'
'REPLCONFIG_REINITIALIZING'
'REPLCONFIG_REINITIALIZED'
'RECOVERY_IN_PROGRESS'
'RECOVERING_DELTAS'
'RECOVERY_RETRY'
'RECOVERY_FAILED'
[EDIT 2019-01-27 end]


So I modify  request as


declare @SiteCode NVARCHAR(3)=N'MXX' 

UPDATE Sites SET Status = 1, DetailedStatus = 125
FROM Sites WHERE SiteCode = @SiteCode

UPDATE SCP SET SCP.Value1 = 1 , SCP.Value2 = N'125'
FROM SC_SiteDefinition_Property SCP INNER JOIN SC_SiteDefinition SC ON SC.SiteNumber = SCP.SiteNumber
WHERE SC.SiteCode = @SiteCode AND SCP.[Name] = N'Requested Status' 



WARNING: modifying database is NOT supported by Microsoft. Please use it at your own risk




now Sites and SC_SiteDefinition_Property tables are ok


SELECT * FROM Sites



 SELECT * FROM SC_SiteDefinition_Property
 WHERE SiteNumber
IN (
SELECT Sitenumber FROM SC_SiteDefinition
WHERE SiteCode = 'MXX'




 and now "Recover Secondary Site" no more grayed. I can recover secondary site if it's necessary.




No comments: