Protect your SharePoint: Even Backups Need Backups!

Whatever type of computer platform(s) you use, backups are absolutely necessary. My advice: never put yourself in the position to learn this the hard way, because losing critical data without a backup is enough to make even John Wayne cry.

You probably already know Fpweb.net offers several backup options. We have our regular weekly server backups, and we also offer a daily item-level backup plan. These are all stored on our servers – in the cloud – so you’re data will be retained in case something goes wrong with your SharePoint environment. For business-critical farms, we also provide SharePoint Disaster Recovery services so you can get SharePoint back online as quickly as possible.

But I digress … Beyond the backup stored on our servers, what if you want to download a local copy to your own computer?

Really, storing a local copy should be part of any business continuity contingency plan… even if just for peace of mind. All of our dedicated server clients can take their own backups as well as script an FTP transfer to a location of their choosing.

Here’s what you’ll need:

1. An FTP location
2. Console access (all dedicated server plans have this)
3. 7-ZIP (a freeware command line compression utility)
Let’s look at taking a backup of a site collection, compressing the file, and then transferring the file to its destination.

First, we create a new batch file. Open a text editor and add the following lines (changing when appropriate):
stsadm -o backup -url http://mysitecollectionurl -filename
c:\backup\mysitecollectionurl.bak -overwrite
7za a c:\backup\mysitecollectionurl.bak mysitecollectionurl.bak
ftp -s:c:\backup\ftpinfo.txt
del mysitecollectionurl.bak

The first line is an stsadm to create the backup file. If you’re backing up the entire farm, use the backupmethod parameter (more info here.)

The second line calls 7-Zip to compress the file for easy transferring.

The third line calls FTP and instructs it to use a script called ftpinfo.txt. We’ll take a look at the script in a second.

Finally, the last line deletes the backup file in preparation for the next run.

Save all this as a batch file (extension .bat).

So what is ftpinfo.txt? This file is a script that FTP will run. Open your text editor and add the following lines (the bold text is there for your reference only. You should not change anything in bold):
open ftp.location.com
UserName
Password
binary
put c:\backup\mysitecollectionurl.bak
quit

Let’s break this down. First line opens the FTP location where you want the file to be saved. Type the User Name in the next line and the Password to log into the FTP site on the third line.

Be sure to add the word binary on the fourth line. If you neglect this, the transfer may occur in ASCII mode, which could cause all sorts of problems.

The put statement on the fifth line tells FTP to upload the specified file.
And finally, quit does exactly what it says.

Wanna test it? Simply run the batch file and wait. When it’s completed, verify the file is on your FTP Server. Now, if possible, ensure that the data can be successfully imported into a SharePoint environment. If so, success! To make the backup and transfer occur on a regular schedule, you can create a task in Task Scheduler that runs the batch routine.

That’s it! You now have a local copy of your data. Way to cover yourself! Please let me know if you have any questions in the comments below.

2012-09-10T05:21:16+00:00 September 10th, 2012|

Leave A Comment