Create a test copy of a live website with database back-end

This guide describes the process followed to create a copy of a logging system called TalkBox, however the steps should be similar for any database system with a web front-end. Obviously you shouldn’t make any changes to a live system.

The steps for the database restore are related to SQL Server Enterprise Manager on SQL Server 2000, newer versions of SQL Server follow similar procedures but the terminology may be slightly different.

There are 2 main steps required to complete this process: 1. Making a copy of the database, and 2. Replicating the website.

To make a copy of the database:

1. Connect to database server.

2. Locate backup file (or backup the database if no file exists), make note of the backup file size. Ensure disk you plan to create database on has enough free space for the restore.

3. Open SQL Server Enterprise Manager and authenticate.

4. Navigate to Microsoft SQL Servers > SQL Server Group > (Local) Windows NT and Right-click on Databases, select All Tasks and then Restore Database.

5. Select From Device, Select devices and then Add and input the filename of the most recent database backup. Press OK, OK and then change the Restore as Database field to the name of the new database (in my example it was talkBox_test).

6. Press OK to restore database to new location.

To make a copy of the web front-end:

1. Connect to web server.

2. Open IIS and browse to ComputerName > Web Sites

3. Right-click on the Web Site you wish to copy and go to Properties > Home Directory. Make a note of the local path.

4. Right-click again and go to All Tasks > Save Configuration to a File.

5. Browse to the path obtained in Step 3. Check the properties of the folder and make a note of the size, ensure the disk has enough space for another copy of this folder.

6. Create a new directory with the name of the website you are creating. Copy contents of old directory into this folder (in my example the contents of D:\inetpub\TalkBox were copied to D:\inetpub\TalkBoxTest).

7. Check NTFS permissions of the new folder and change them to ensure they match those of the old folder.

8. Update the 3rd line of file SERVERNAME\WebSiteFolderLocation\ConfigXML\Config.xml (in my example this file is \\Server01\D$\inetpub\TalkBoxTest\ConfigXML\Config.xml) so the parameter appdb label=”Database” matches the name specified in the Restore as Database field in Step 5 of the database restore above (in my example this line now reads talkbox_test).

9. Go back into IIS, right-click on ComputerName > Web Sites and select New > Web Site (from File). Choose the file you saved in Step 4. Read file and then press OK and then Create a new site. The website will appear as a website with the same name and will be stopped.

10. Right-click on the new website you have created and go to Properties.

11. Under the Web Site tab, update Description so it relects the name of the new site, then click Advanced and change the host header values so they reflect the new name of the website

12. Under the Home Directory tab, change the local path to that of the path from Step 6. Press Apply and then OK.

13. Right-click and Start the website.

Finally create a new CNAME record in the Forward Lookup Zone in DNS to map the name of the website to the FQDN of the server.

Posted in Guides Tagged with: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*