Hosting FAQ

How to back up and restore an SQL-based website?

Answer:

An SQL-based C1 website uses a database on Microsoft SQL Server as its data store. That is why along with backing up the entire website folder, you should also back up the database. Restoring an SQL-based website will also take these two major steps: restoring the website files and restoring the database.

Before you back up a website, make sure your website is SQL-based:

  1. Open /App_Data/Composite/Composite.config.
  2. Locate configuration/Composite.Data.Plugins.DataProviderConfiguration.
  3. Make sure that defaultDynamicTypeDataProviderName="DynamicSqlDataProvider".

(If the site is XML-based, the value will be "DynamicXMlDataProvider".)

Backing Up an SQL-Based Website

To back up an SQL-based website:

  1. Log off from the C1 Administrative console.
  2. Make a zip archive of the folder where the website files are located.
  3. In Microsoft SQL Server Management Studio, make a backup of the database used for the website: (database) | Tasks | Backup. (Notice where the backup file is saved.)

If it is not critical in your environment, you may want to stop the website when archiving its files because some of the files (normally, log files) might be locked and thus not be added to the archive.

It is highly recommended keeping both the website backup archive and the database backup file together, especially if you are going to use the backup on other servers. You may choose to keep them in a single archive. For example, you can add the database file to the website backup archive.

On Microsoft SQL Server 2008 R2 (Express), the database backup file is saved at c:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Backup\. It is named after the database name and has *.bak extension (e.g. CompositeC1.bak)

Restoring an SQL-Based Website

To restore an SQL-based website:

First of all, restore the database on the SQL server:

  1. Make the database backup file available on the local machine. If it was zipped, archived, etc, extract it.
  2. In Microsoft SQL Server Management Studio, create a new database.
  3. Right-click the database, then click Tasks | Restore | Database.
  4. In the "Restore Database" window, switch to "From device", click "...", browse to, add and select the database backup file as the source of backup sets.
  5. In the "Restore Database" window, switch to "Options" and check the option “Overwrite the existing database (WITH REPLACE)”.
  6. Click OK to restore the database from the backup.

(If you are going to replace an existing database from the backup, stop the website in IIS Manager.)

Next, restore the website:

  1. Unpack the website backup archive to a folder.
  2. In IIS Manager, stop the website you are about to replace from the backup.
  3. Rename the physical folder the website maps to on IIS (e.g. "CompositeC1" > "CompositeC1.old").
  4. In the same parent folder, create the folder with the original name (e.g. "CompositeC1").
  5. Move all the unzipped files to this folder.

Then, make sure that the connection string is correct:

  1. Open /App_Data/Composite/Composite.config.
  2. Locate configuration/Composite.Data.Plugins.DataProviderConfiguration/DataProviderPlugins/add[@connectionString=”...”].
  3. Make sure that the value of the connectionString attribute is correct (server, database, credentials). (If you have restored the database to a new one, make sure to change the database name here accordingly.)

Finally, start the website:

  1. In IIS Manager, start the website.
  2. Open the website in your web browser.