February 15th, 2015
  • DTAP
  • Database rollback
  • EPiServer 7.5

Production database rollback through DTAP

Since users would like to test on the acceptance environment with the same content and setup as production, and we would like to fix issues on our development machine using the same content and setup as production it is sometimes very handy to roll back the production database through the DTAP street.

When you only have one site, you can stop reading here, but if you have multiple sites, or like in our case way more than 30 sites, you got quiet a challenge!

The problem is with the main URL of Sitesettings every site. Since this is an production URL you cannot simply switch from site to site in the EPiServer backend. When you click on another homepage in EPiServer, you’ll be redirected to the production environment of that site and if the user isn’t aware of this he’ll start changing production… Changing these URLs is very time consuming and error prone. We have one convention for all URLs for every environment. Of course production is free to use other kind of urls, but acceptance starts with acceptance.*, testing with testing.* and local ends with *.localhost.local.

We’ve come up with a very good solution for this. On the production environment we’ve added every hostheader from every DTAP environment. Example:

In this example the production environment has multiple hostheaders: www.demosite.com, demosite.com, www.ds.com and ds.com
We’ve also added the other environment hostheaders; the cms url, the acceptance url, the testing url and the local url.
Since we always rollback to a ‘lower’ environment which has only one url (hostheader) it doesn’t matter that production has multiple.

When we backup the production database and restore it on lets say aceptance the url of the demosite site need to be changed to acceptance.demosite.com. To do this for every site in the EPiServer database you can run the following SQL script after the restore of the database, but before the site is started:

DECLARE @environment VARCHAR(250)

--SELECT @environment = '%.localhost.local'
--SELECT @environment = 'testing.%'
SELECT @environment = 'acceptance.%'
--SELECT @environment = '%.hiddencmsurl.com'


SET @getid = CURSOR
FOR SELECT Substring([SysTable].[string03], 0, Charindex('/',
           + '//' + [Table].[string02] + '/',
    FROM   [dbo].[tblbigtable] AS [Table]
           JOIN [dbo].[tblbigtablereference] AS [Reference]
             ON ( [Table].[pkid] = [Reference].[refidvalue] )
           JOIN [dbo].[tblsystembigtable] AS [SysTable]
             ON ( [Reference].[pkid] = [SysTable].[pkid] )
    WHERE  [Table].[storename] = 'EPiServer.Web.HostDefinition'
           AND [Table].[string02] LIKE @environment

OPEN @getid

FETCH next FROM @getid INTO @newUrl, @id

      UPDATE [dbo].[tblsystembigtable]
      SET    [string03] = @newUrl
      WHERE  [pkid] = @id

      FETCH next FROM @getid INTO @newUrl, @id

CLOSE @getid


SELECT [string01] AS [SiteName],
       [string03] AS [Url]
FROM   [dbo].[tblsystembigtable]
WHERE  [storename] = 'EPiServer.Web.SiteDefinition'
< Previous post Overview posts Next post >
Uxwgro viagra sildenafil tabletas https://newfasttadalafil.com/ - Cialis cialis with melons contraindications Fypffd Aeemtf The focal length of the lens is again obtained from Eq. <a href=https://newfasttadalafil.com/>Cialis</a> Propecia Wikipedia https://newfasttadalafil.com/ - Cialis cialis en tenerife Dbnucm
entesty, May 9th, 2022
https://bestadalafil.com/ - buy cialis online with a prescription Nwzxvx The shaft or middle region of a long bone is called the diaphysis se puede tomar viagra con alcohol <a href="https://bestadalafil.com/">cheap cialis</a> https://bestadalafil.com/ - cialis buy online Emhncg
iNpuddiff, April 18th, 2022
<a href=https://cialiswwshop.com/>cialis prescription online</a>
maywows, August 14th, 2021
<a href=http://cialiswwshop.com/>order cialis</a>
maywows, July 26th, 2021

Leave a comment

= Thanks for your comment =