How to create a backup of DNN and the database 

Another very common question that I see regarding DotNetNuke is when and how should I backup my DotNetNuke site. This topic is VERY important and requires a bit of planning, especially if you do not have direct access to your database server to perform your own backups. In the following sections I will first talk about what you must backup and why some of those items are very important. I will then discuss how to perform a DNN backup and SQL Server backup, both for SQL 2000 and 2005.  Finally I will discuss options available for third party modules for performing backups for individuals that do not have direct access to their servers.

What to Backup?

Simply put, it is a best practice to backup your ENTIRE DotNetNuke directory on the web server as well as a full backup of the database. Some people will say that you can get by with only backing up the "portals" folder, this is NOT correct! To successfully restore a DotNetNuke installation you must ensure that you have all module .dll and other code files you also must have the same validation and decryption keys.  I have found that the only real method to keep your data safe is to create a backup with all files.  Given the limited file size of the core DNN installation I have not found this to be a hinderance, especially since the additional files that exist in my website are all related to the content available within and is something I must have a backup.

Performing the Backup

Performing a backup of DotNetNuke is a fairly easy two step process. First I will discuss backing up the DNN installation directory, then I will discuss options available for backing up the database.

Backing up the DotNetNuke Directory

You have two options when backing up the DotNetNuke directory. If you have direct access to the server, you can simply right click on the DotNetNuke directory and select "Send To:" -> "Compressed (Zipped) Folder". This applies for most versions of the windows operating system. You will then have a file named dnn441.zip where dnn441 was your directory name. This zip file will contain all needed backup files, you will want to store this in a safe location.

If you do not have direct access to the server and can only access it via FTP you will have an additional step to obtain a zip file for your site. You will want to connect to your FTP site and COPY all files to a temporary location on your local computer. Once all files have been copied you will want to create a zip file including ALL files and folders that were just downloaded.

NOTE: if using a program such as WinZip for zipping, ensure that the "Use Folder Names" option is enabled so that the folder structure is preserved within your zip archive.

Backing up the DotNetNuke Database

To backup the database you must have access to the database server and the file system of the database server. If you are in a hosted environment you will need to rely on your hosting provider to obtain a backup, or you will need to look into a potential third party solution to backup the database from within DotNetNuke. If you have full access to the server please use one of the below sets of instructions to backup your database..

Backing up a Database with SQL Server 2000 and Enterprise Manager

Follow the below steps if you wish to create a databse backup file from Enterprise Manager for SQL Server 2000 using Enterprise Manager.

  • Navigate to your specific database in Enterprise Manager
  • Right click on the database and select "All Tasks" -> "Backup Database.."
  • Ensure that "Complete" is selected for the backup type
  • Click the "Add" button in the "Destination" section
  • In this section provide a full file path to the desired backup file, typically named DATABASENAME.bak where DATABASENAME is your database name
  • Click "Ok" to generate your backup, you will receive a success notice upon completion

You will now have a full backup file containing all tables and data for your database.

I believe the functionality is fairly similar using SQL Server Management Studio Express with SQL Server 2005

Backing up a Database with T-SQL Commands (2000 and 2005)

The fastest method to backup your database is to use T-SQL commands.  You simply need to create a backup device which specifies where your backup file should go, then you simply perform a 'BACKUP DATABASE' call to perform the database backup.  The following scripts show you how to create a backup file called MyBackup.bak in your C drive which will contain the entire dnn441 database.  You will need to adapt this script to fit your configuration.

--Create Device!
EXEC sp_addumpdevice 'disk''MyBackupDevice''C:\MyBackup.bak'

--Now backup the db
BACKUP DATABASE dnn441
    
TO MyBackupDevice

Regardless if you used one of my methods above or had your hosting provider create a backup for you once you have obtained .bak file you have everything you should need to restore your site to its current state. How often you perform this type of backup really depends on the amount of activity, the frequency of actual changes, and the amount of loss you are willing to accept. A full backup plan is something that needs to be considered on an individual implementation basis and includes many factors.

Third Party Modules

Some third party backup modules exist on the market that will allow users to generate SQL Server backups without direct access to the database server. Below are a few links to these utilities. I have NOT used any of these utilities and do not recommend one over the other, I am simply providing these links as a starting point for your research into a solution.

I hope this tutorial/post has provided you the needed information to prepare a successful DotNetNuke backup. Please let me know if you have any questions or comments!

Posted by Mitchel on Thursday, March 08, 2007
 

Comments

Great description - just one detail: the backup is stored on the server of the hosting provider (and not my remote computer running SQL Server Management Studio Express), so I still cannot get to the backup file!

Could the backup path somehow be written to an FTP site to do the backup there? (is there a syntax for giving both FTP, username and password as a URL?)

By the way, fantastic good and relevant blogs you have - you seam to be a much better source of information than most other places I have searched.

By Allan K. on Friday, October 12, 2007 at 10:29 AM

Allan,

In your case you will need to ask your hosting provider to provide you with the file. With native SQL Server backups you are unable to backup directly to an FTP location.

By mitchel.sellers@gmail.com on Friday, October 12, 2007 at 6:26 PM

We have an environment with multiple portals with each portal consisting of multiple “sites.” Obviously, it’s easy to back up an entire portal. Our problem is doing a partial restore. In other words, is there a way to back up a portal (consisting of multiple sites) and later restore a single site instead of the entire portal?

By Tanzil Malek on Tuesday, February 19, 2008 at 5:46 AM

If you have multiple portals in 1 DNN installation it is typically a all or nothing restore process.

There MIGHT be a case where you could restore just one, but it is not an automated process, and honestly it is a very tedious and risky operation to perform.

If you need to be able to backup/restore/isolate one site from another, you mgiht consider using separate DNN installations for each.

By mitchel.sellers@gmail.com on Tuesday, February 19, 2008 at 5:50 AM

Yes this is very very tedious.
I have asked somethyng like:
http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/118/threadid/223563/scope/posts/Default.aspx

But ll be not a solution????
Very strange approach?

DNN can create a lot of portale with one "istance" but if I nedd to work on the database for modify something It's very hard?
thank
Rmartin

By rmartin on Thursday, May 15, 2008 at 3:49 AM

From the database you can isolate data simply by the "PortalId" which you can obtain from the portals table.

However with DNN when working with almost anything there are complications with multiple portals on the same installation. As I mentioned in that thread on the DNN forums, I stay away from that except for my sites.

If you have more questions, please feel free to post to my forum.

By mitchel.sellers@gmail.com on Thursday, May 15, 2008 at 4:53 AM

What can i do if the database does not appear on Microsoft SQL Server Management Studio Express?

By Angel Alamos on Wednesday, May 28, 2008 at 12:08 PM

In this case I would guess you used the dynamic attachment method for your database. You will need to attach it to SQL Server or simply backup the .mdf file to backup.

By mitchel.sellers@gmail.com on Wednesday, May 28, 2008 at 12:16 PM

hello,
I am stuck at upgrading process, when i click "click to access portal" getting repeatedly to last page "Click to Access Portal"??
what should i do..

By vinod on Wednesday, October 07, 2009 at 2:11 AM
Click here to post a comment

Disclaimer