Tuesday, January 13, 2009

Backing up a single web application and a farm

Having a backup and restore plan seems to be the most critical piece of any MOSS implementation that is often overlooked. I can not stress how important it is to figure out a plan before doing any major changes in your farm. While, there is ample amount of documentation on doing this - Nothing goes and puts it in direct terms which can be used. For eg, why is the syntax to backup a web-application and a farm are the same or what do all those spbr folders mean.

First of all, the stsadm.exe operation has the same capability as your sharepoint UI tool. In fact, the ability to use scheduling with stsadm makes me rate it above everything else. First lets talk about backing up from the UI. Here you go in Central administration, browse to operations and then click "Perform a backup". You then select the components that you want to backup and proceed. You will be asked a directory name which you provide. The size that you see that will be needed for the backup is worst case scenario. You almost always will end up with a lesser size backup(I was shown a size of 171 Gb, but my full back up was done in 60 GB). After clicking on finish this will create a backup of the farm for you. (Given that you chose the entire farm earlier).

Lets go inside the backup directory. Here you will see directories named spbr0001, spbr0002 (if you have more than one) and so on. Each directory represents one backup\restore component that can be acted upon. If you go inside the spbr0001 directory you will see a number of *.bak files and an xml file. The bak files are backups of different components within the farm that you backed up. The xml file actually will contain a listing of the nodes that have been backed up and the corresponding nodes. For eg, the web app 1 was backed up as 00000006.bak and its content db was backed up as 000000007.bak. Each of the nodes also contain some tags - such as and . This has a value of true/false. False means that these items were not marked for backup and can not be restored as well from this particular spbr folder. True means that those particular nodes can be restored. For a full farm back up you will see true's. Whereas, if you selected only one webapplication for backup, you will see true against only that webapp and content DB node.

Ok. So how do you restore this farm/webapplication? Pretty simple actually, you just go to back up to Operations and select "restore from backup". Here you provide the directory name where you backed up your content. This for some reason lets you select only the last backup you took. If there is a way to workaround this, I would be interested to know.

So lets get to the stsadm piece. I feel we have more control over how this works and therefore prefer it. The first step is of course to decide what you want to back up. Imagine the tree structure in UI and the selectable nodes. If you can not then fire the command
stsadm -o backup -showtree
This will show you the tree structure on your stsadm console and mark the ones that can not be selected inside []. To execute a full back up of the farm you just execute this -
stsadm -o backup -directory -backupmethod full
To backup a single web application execute this script -
stsadm -o backup -directory -backupmethod full -item eg "sharepoint - 21897"
This will create a similar directory with an xml file. Only the nodes corresponding to the item mentioned will have true against SPCanBackUp and SPCanRestore.

This actually helps while restoring. So if you have a farm level backup done and you want a farm restore, you can do it using this -
stsadm -o restore -directory -restoremethod overwrite
If you have farm level back up and you want to restore only a particular item -
stsadm -o restore -directory -restoremethod overwrite -item
So you really can restore a single web-app from a farm level backup if you want.
But if you back up only a single web-app, you can restore only a single webapp even if you don't give the -item option to stsadm. All attributed to SPCanBackUp and SPCanRestore. While using restore, if you are scripting this for a batch job, dont forget to mention the -suppressprompt -username -password attributes to the restore cmd. Refer here if you want more details. And lest I forget, if your backup operation gets hung at about 50% of your search index while backing up your farm, go to Operations - Timer Job Definitions and kill that Search Back up and Restore item or try to find a permanent fix
here

Friday, August 22, 2008

Export to Spreadsheet error

Have you ever seen the error "Cannot get the list schema column property from the Sharepoint List" when you try to export the list to a spreadsheet? Here are the possible resolutions-

One, Upgrade to office 2007. Office 2007 has a closer integration with MOSS 2007 and this error is fixed.

Two, remove the date fields from your list. The schema property that is having conflicts are the date fields. Once you remove them, you will be able to export the spreadsheet.

Three, use the option edit in datasheet to see the data in datasheet view. Then copy and paste the entire data in a new excel workbook.

And yes, if you intend to use this worksheet offline and for reporting, then it will be wise to unlink the list from the Data > List menu.

Wednesday, August 20, 2008

Order of [Me] and [Today] in filters


We had a strange problem today. A task list view had a filter with due date < [Today] and Assigned to = [Me]. Now when I go to set up an alert for this as shown below, which results in an error. The error is - Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) It seemed a pretty strange behavior. I played around a bit and figured out that if you switch the order of the conditions for [Me] and [Today], it will no longer throw the error. Very quirky!

Wednesday, August 6, 2008

Search results are blank

The search works perfect in the farm. But one user reported that they need a "better" search functionality than what is provided. I didnt think of it much earlier, but then I came to know that there is no search happening at all on the site. Well.. interesting.

I went and saw all the settings in the central admin, crawl settings, rules to make sure that the site is included to crawl. Site level settings also indicated that the site is visible to the crawler. But then I noticed the aspx page settings right below it. I changed it to always crawl, ran an incremental crawl and voila!

Sharepoint by default will not crawl content on aspx pages, if the permissions are broken down to granular level. This is to provide security to the content. So, if you need to enable search for such content, select this setting and it will crawl happily everafter!

Thursday, June 5, 2008

Add to my Links issue

An interesting issue came up some days back. Whenever we would try to add any list or doc lib to my links webpart on my site using the Add to my links function, it redirects to a page which populates the wrong list/doc lib URL in the textbox which is uneditable. The link that so gets created is wrong and is invalid. To give an idea, we have multiple webapplications as xyz, xyz-div1, xyz-div2........ Now whenever I try to add a list of xyz-div2 to my links using "Add to my Links" it stripped off the -div2 from the url. The url seemed something like - http://xyz/sites/team1/xyz/lists/emp/allitems.aspx instead of http://xyz-div2/sites/team1/xyz/lists/emp/allitems.aspx

On closer analysis of the url box of the internet explorer I found out that there is an intermediate portal api which sharepoint before going to the next page. When I googled that api with that particular command parameter I got a hit to msdn here http://msdn.microsoft.com/en-us/library/ms868609.aspx

I then took a look at the portal connection of the site collection and there it was. As part of the site provisioning process in the organization, a site is always connected to a portal site as http://xyz to act as a common home for all employees. We will see how we work this out so that add to my links work, but at least its good to know why it was happening.

Friday, April 18, 2008

Enabling wildcard search in MOSS 2007

MOSS 2007 for some peculiar reason does not support wild card search. There are some solutions out there are which might be of use and I will try to list them here -
  1. Using specific metadata - While this may not suit your purpose, but you can search for somebody's firstname by, Firstname:Rob, this will give you all the people whose names are Rob, Robe, Robbie Robbin etc. (You get the idea) Similarly you can search for lastname too. Please note that if you try searching for Robbie using FirstName:bbie, you will NOT get the result.
  2. Customizing the search result web part - Mario Hadiwinata lists down a method of doing it. I have not tried it myself, but it looks pretty sleek. [Edit - this works for sps 2003 only and not for MOSS. Thanks sdec for pointing that out]
  3. Using a CEWP webpart - Ramon Scott lists down the code to use it on your homepage. This creates a new webpart with two text boxes, where you can do a wildcard search on people by lastname or firstname.
  4. Use Ontolica Wildcard Search - This is a free download provided by Ontolica here.

Other than these, there must be various solutions out there, but on the similar lines.

Wednesday, April 16, 2008

MOSS 2007 User Administration

Well, This was worth writing about. Having worked on 2003 before, the user administration for MOSS 2007 seems confusing to me. I spent the last 60 minutes trying to figure out, how can I see a group's permission and how to edit that. And also I remembered that I can see detailed permission list for a particular permission from 2003(For eg. Full Control). And found that out too. Not at all intuitive.

First of all in MOSS 2007, all users are added at Site Collection level and then reused for all the other sites. So Do not try to find out how to do all this at a subsite level. A good place to begin is http://office.microsoft.com/en-us/sharepointserver/HA101172091033.aspx

Now - To view what permissions a group has and how to edit those permissions.
1. Browse to your Site Collection
2. Click on Site Settings > People and Groups
3. Click on Groups on the Left side navigation.
4. Click on the Edit icon that appears between the group name and description.

You will now see the permissions as well as you can edit them here.

Second - You want to see a detailed permission map as well as maybe create a custom permission
1. Browse to your Site Collection
2. Click on Site Settings > People and Groups
3. Click on Site Permissions in the left side navigation.
4. Click on Settings>Permission Levels

From here you can see the existing site permission details as well as create a new site permission level.