Wednesday, June 25, 2014

Procedure to refresh SharePoint 2013 site collections with Access Apps and other SharePoint Apps to a different farm



The procedure to refresh all the site content along with SharePoint Apps, Access Apps, Security token, and Managed metadata from one SharePoint farm to a different one is almost identical to backup and restore on the same farm as we discussed in previous blogs

However, since the services should be already running on the target SharePoint farm, we could simplify the service refresh process by pointing the destination services to restored source databases instead of the original ones. In additional, since the destination SharePoint farm database might have different owner, you should modify the database owner to the destination owner after restore the databases.

 Here are the high level steps that is similar to previous blog.
  1. Refresh App Management Service
    •  Backup SharePoint 2013 App Management Service database in source SQL server
    •  Restore the backed up SharePoint 2013 App Management Service database in destination SQL server
    •  Change the database owner to the correct destination SQL server owner
    •  Recreate App Management Service with the restored database in in destination SharePoint farm (Point the DB to restored DB does not seem to work like App Management Service)
  2. Refresh App Catalog site
    •  Backup SharePoint 2013 App Catalog site database in source SQL server
    •  Mount App Catalog site to the correct WebApp in destination SQL server
    •  Register the App Catalog site with App Management Service in destination SharePoint farm
  3. Refresh Security Store Service - you do not need this is security store not used on the site
    •  Backup SharePoint 2013 Security Store Service database in source SQL server
    •  Restore SharePoint 2013 Security Store Service database in destination SQL server
    •  Change the database owner to the correct destination SQL server owner
    •  Point Security Store Service to the restored service database
  4.  Refresh Management Metadata Service
    •  Backup SharePoint 2013 Management Metadata Service database in source SQL server
    •  Restore SharePoint 2013 Management Metadata Service database in destination SQL server
    •  Change the database owner to the correct destination SQL server owner
    •  Recreate Management Metadata Service with the restored service database (Point the DB to restored DB does not seem to work like App Management Service)
  5. Restore Site collections
    •  Backup SharePoint 2013 site collection content database in source SQL server
    •  Restore SharePoint 2013 site collection content database in destination SQL server
    •  Change the database owner to the correct destination SQL server owner
    •  Add the new app to the restored site collection when adding the Access app
  6. Restore Access Apps



You can use sp_changedbowner or alternaltely use ALTER AUTHORIZATION statement. Please not sp_changedbowner is deprecated from SQL Server 2012.


 
Exec sb_changeowner ‘NewOwner’
 
ALTER AUTHORIZATION ON DATABASE::MyDatabaseName TO NewOwner;
GO
 
Now the key is to identify where are all the Access Apps so we could package from the source SharePoint farm. I've publish the database query to identify on each content DB.


SELECT DISTINCT TOP 1000
      AIP.[Value]
      ,(SELECT [WSS_Content_P2].[dbo].[AppInstallationProperty].[Value]
        FROM [WSS_Content_P2].[dbo].[AppInstallationProperty]
        WHERE  [WSS_Content_P2].[dbo].[AppInstallationProperty].[ValueKey] = 'DbName'
        and [WSS_Content_P2].[dbo].[AppInstallationProperty].[InstallationId] = AIP.[InstallationId] ) as DbName
      ,AP.[LaunchUrl]
      ,AIP.[SiteId]
      ,AIP.[InstallationId]
        
  FROM [WSS_Content_P2].[dbo].[AppInstallationProperty] as AIP 
  INNER JOIN [WSS_Content_P2].[dbo].[AppInstallations] as AP
  on AIP.[InstallationId] = AP.[Id]
  and AIP.[ValueKey] = 'containerWebName'

 You could check other detailed steps and screenshot in previous blog.

No comments:

Post a Comment