Home > SharePoint Administration > Using STSADM (Backup)

Using STSADM (Backup)

To perform a full backup of Sharepoint and its sites using the stsadm command.
 
1.  Remote into the SharePoint Server.
2.  Do a Start -> Run -> Cmd to bring up a command prompt.
3.  Browse to cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin
3.  Type stsadm -o backup -url <url of the site collection> -filename <name of backup file> and hit the <enter> key
4.  To perform a backup of an already existing backup.  Type stsadm -o backup – url <url of the site collection> -filename <name of the backupfile> – overwrite
5.  This will run the stsadm command to backup the portal.  Depending on the size of your collection this can take some time.
 
To do a scheduled backup using script.

Open up notpad and either type or paste this code, and change the highlighed areas.
 
@echo off
@echo——————————————————–
@echo This script will backup your site: [Your Site Name Here]
@echo——————————————————–
cd \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo locking site collection before the backup process starts
@echo off
stsadm -o getsitelock -url <url of the site collection>
stsadm -o setsitelock -url <url of the site collection>  -lock readonly
@echo site collection is now locked

@Echo Logic to create a new file name daily 
@For /F “tokens=1,2,3 delims=/ ” %%A in (‘Date /t’) do @(
Set Day=%%A
Set Month=%%B
Set Year=%%C
Set All=%%C%%B%%A
)

@echo off

stsadm -o backup -url <url of the site collection>  -filename <name of backup file> -overwrite
@echo backup completed
@echo off
stsadm -o setsitelock -url <url of the site collection>  -lock none
@echo Site lock removed

Once done save the file as a .bat file.

To automatically do backups set up Windows Sheduled Tasks to perform the backup.

1.  Create a new Windows Scheduled Task by going to Start–> Control Panel –> Scheduled Tasks –> Add Scheduled Task

2.  Follow the wizard and schedule the .bat file created above to run at a frequency of your own choosing

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: