Archive for the ‘WSS 3.0 e MOSS 2007’ Category

SharePoint Backup Restore, High Availability, and Disaster Recovery

April 4, 2011

What to Backup

1. All Servers and all drives in the farm including system state: includes metabase, system state, home directories, web.config, install path, custom assemblies, binaries and code, customizations, site defs, list defs, IIS logs, evt logs, etc… (Doesn’t even need to be daily if this concerns you…)

2. Databases – All your data and 99.97% of config is stored in SQL

3. Index – The index will be propagated to the query servers, but you can’t recover it from there if you have system failure, drive, sector, or file corruption.  The two ways to backup your index is via Stsadm –o backup and with the central admin.  The two can be used interchangeably.

Tools and APIs 

  • · Native SQL Server Backup & Restore – Native SQL backup can be used to backup all databases (Note: Does not include index (even though you’ll see it can backup the search and SSP database.)  You can even use the jobs to schedule or create some interesting scripts to do multi threaded backups.
  • · SQL 2005 Database Mirroring – mirrors of your data in another location for location, data, and hardware fault tolerance.  See the White paper: Using database mirroring for details. 
  • · SQL Log Shipping to a Standby farm or server – pretty much the same as with SPS 2003.  You can use this with SQL 2000 or SQL 2005 to a read only SQL box connected to a stand-by farm and fail back or read/write and log ship back. 
  • · SharePoint Backup and Restore (Central Admin) – UI based backup for farm including services like Index… includes full and differential backup. (Requires a full first, to perform any diffs.) 
  • · Stsadm Utility – stsadm –o backup/restore, stsadm –o export/import, the stsadm command is pretty powerful.  You can schedule this with a scheduled task to run nightly, failures will result in an error in the error log which you can capture in MOM or your monitoring environment…  Includes full, differential, partial backups of services or individual web apps, site collections, sites 
  • · VSS Writer – Snapshots can be completed to capture point in time backups of the databases.  (See note in gotchas below.) 
  • · Web delete event— The events are in the system and can be captured.  MS IT has a working prototype of a site and site collection archive on delete solution deployment they plan to share after they “bake it in”. 
  • · SharePoint Designer—you can use SharePoint designer as an end user means of backing up a site or site collection. 
  • · Recycle Bin – one of the best new features of the product.  Right out of the box when a web app is created, files, lists, and list items are retained for 30 days (configurable) before deletion.  The second stage, the site collection admin stage allows you to recover documents deleted by users (even the site admin him or herself) 
  • · Migration API (Prime)  – This API is a powerful way to copy (import/export) data with SharePoint Products & Technologies. (see the SDK for more info) 
  • · DPM 2.0 (beta) – Data Protection Manager 2.0 is being designed to backup SharePoint Farms and is early in the beta cycle.  This disk based backup solution is designed for consolidated backup solutions and differencing.  Look for more on this in the future.  (This is a separate Microsoft product, but plans to have a SharePoint solution)

 High Availability

  • · Web Front End: Web front ends can be easily made redundant via load balancing solutions, software, hardware… either work.  Be sure to use sticky sessions and be sure to test forms deployments with your load balancing solutions.  NLB is the most commonly used intranet solution, Cisco Local Director, F5 Big IP, etc… are common hardware load balancers 
  • · Query: Query aka Search Servers are easily redundant through the services built into the product.  All web servers need to communicate to all query servers even if there is a query service local to the box.   
  • · Index: This is a single point of failure as a service, but if the index box goes down, the users won’t be impacted.  If the index box goes down and you bring it back up service will not be interrupted.  Exceptions to be aware of are if the query box was in the middle of propagation and then the service were to go down.  The query box needs to think it is up to date and has the correct catalogs.  If the query ever thinks it is out of date and is unable to contact the Index box, you will get errors on search requests.  The most creative but ugly scenario for making your index redundant is to create an additional farm that is a single box that has indexing services on it.  That single box farm would have a copy of the index or have it’s own indexing schedule.  Thus if a failure were to happen you could update the connection of the SSP to the other farm.  Not sure who’d do this, but it’s possible. 
  • · SQL – SQL Clustering provides for a high available SQL platform.  Bascially it’s shared disks with failover between systems ensuring fault tolerance to hardware issues.  You can do clusters in either SQL 2000 or SQL 2005.  You can do SQL Log shipping on top of clustering or without it for further fault tolerance and high availability.  SQL Mirroring is another option is you are using SQL 2005 more detail above.

Gotchas: (Snipped from Using Backup and Restore (Office SharePoint Server 2007) TechNet article)

STSADM Backup and restore will not backup and *restore* the following:

  • · The configuration database

o Any Custom solutions deployed (be sure to keep the solutions so they can be easily re-deployed)

o Alternate access mappings

o The Central Administrator Web Application

o The Central Administrator content database

o The Internet Information Services metabase

Additional Data on VSS

  • · The VSS Writer service needs to be registered using the “stsadm –o registerwssservice” command.
  • · The SQL Server VSS Writer service, which is available with SQL Server 2005, needs to be started for the Windows SharePoint Services Writer to work properly. By default this service does not start automatically. For more information about Volume Shadow Copy service (VSS), see Volume Shadow Copy Service Technical Reference and for more information about the SQL Server VSS Writer, see SQL Writer in SQL Server 2005.

Additional Resources:

Some Third Party Vendors:

AvePoint: Farm and Granular Backup and recovery (see DocAve 4.1 for MOSS 2007 and WSS 3.0)

Commvault: SharePoint Farm backup and granular recovery

Neverfail: High Availability and DR solutions

Quest: Compressed database backup with Litespeed and Recovery Manager (SPS 2003 and MOSS 2007)

Advertisements

How to do a Sharepoint site export and import

February 14, 2011

How to do a Sharepoint site export:

stsadm -o export -url http://sharepointsite -filename c:\backup\sharepointsite.bak -includeusersecurity -versions 4 -nofilecompression

Hot to do a Sharepoint site import:

stsadm –o import –url http://sharepointsite -filename c:\backup\sharepointsite.bak –includeusersecurity

More information to stsadm:

C:\>stsadm -help export

stsadm.exe -o export
           -url <URL to be exported>
           -filename <export file name>
               [-overwrite]
           [-includeusersecurity]
           [-haltonwarning]
           [-haltonfatalerror]
           [-nologfile]
           [-versions <1-4>
               1 – Last major version for files and list items (default)
               2 – The current version, either the last major or the last minor
               3 – Last major and last minor version for files and list items
               4 – All versions for files and list items]
           [-cabsize <integer from 1-1024 megabytes> (default: 25)]
           [-nofilecompression]
           [-quiet]

C:\>stsadm -help import

stsadm.exe -o import
           -url <URL to import to>
           -filename <import file name>
           [-includeusersecurity]
           [-haltonwarning]
           [-haltonfatalerror]
           [-nologfile]
           [-updateversions <1-3>
               1 – Add new versions to the current file (default)
               2 – Overwrite the file and all its versions (delete then insert)
               3 – Ignore the file if it exists on the destination]
           [-nofilecompression]
           [-quiet]

Sharepoint Hotfix 936867 renders Sharepoint unuseable

February 9, 2011

After requesting an and applying Windows Sharepoint Services 3.0 hotfix 936867 our Sharepoint stopped working completely.

I’ve found the following error messages in the application log:

Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Topology
Event ID: 5617
Date: 31.12.2010
Time: 17:17:17
User: N/A
Computer: SERVERWEB
Description:
The schema version (3.0.149.0) of the database SharePoint_AdminContent_f80b1f17-ff1d-4df2-93d3-66bbbaf5790f on x64a is not consistent with the expected database schema version (3.0.150.0) on SERVERWEB.  Connections to this database from this server have been blocked to avoid data loss.  Upgrade the web front end or the content database to ensure that these versions match.

Solution: called “stsadm -o upgrade -inplace -url http://{central_admin_url}”

That seemed to have solved the problem.

Upgrade the web front end or the content database to ensure that these versions match

February 7, 2011

After requesting an and applying Windows Sharepoint Services 3.0 hotfix 936867 our Sharepoint stopped working completely.

I’ve found the following error messages in the application log:

Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Topology
Event ID: 5617
Date: 31.12.2010
Time: 17:17:17
User: N/A
Computer: SERVER
Description:
The schema version (3.0.149.0) of the database SharePoint_AdminContent_f80b1f17-ff1d-4df2-93d3-66bbbaf5790f on x64a is not consistent with the expected database schema version (3.0.150.0) on SERVER. Connections to this database from this server have been blocked to avoid data loss. Upgrade the web front end or the content database to ensure that these versions match

Option # 1

Start the Windows SharePoint Services Administration service using the Services applet (Start, Run, Services.msc) and run SharePoint Products and Technologies Configuration Wizard.

Option # 2

Start the SPAdmin service under the context of a local administrator on the server where the SPAdmin service failed to start when running the SharePoint Products and Technologies Configuration Wizard (psconfig.exe) and run SharePoint Products and Technologies Configuration Wizard.
net start spadmin

Option # 3

Download wssv3-kb934525-fullfile-x86-glb.exe from http://www.microsoft.com/downloads/details.aspx?familyid=76FC2225-2802-46E5-A294-A842E3841877&displaylang=en.
Extract wssv3-kb934525-fullfile-x86-glb.exe and run the installation by executing C:\temp\STS.msp (see below).

:\wssv3-kb934525-fullfile-x86-glb.exe /extract:c:\temp.

Option # 4

On the machine where psconfig failed to start the SPAdmin service run:
%commonprogramfiles%\Microsoft Shared\Web Server Extensions\12\BIN\psconfig -cmd upgrade -inplace b2b -wait -force
Modify the service timeout values in the Registry:

HKLM\SYSTEM\CurrentControlSet\Control add/modify DWORD value ServicesPipeTimeout to 60000 (60 seconds)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control add/modify STRING value WaitToKillServiceTimeout to 120000 (120 seconds)
Restart the server machine.

A solution is available to administrators of SharePoint Products and Technologies deployments experiencing the following application event after introducing WSS October public update KB934525.

Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Topology
Event ID: 6800
Date: 31/12/2010
Time: 10:10:10 PM
User: NA
Computer: SERVER
Description: The database WSS_Content on HOME\Microsoft##SSEE is not accessible to missing Windows Internal Database signatures.

1. Run the following STSADM operations to stop and start the SPWebService:

stsadm -o provisionservice -action stop -servicetype spwebservice -servicename “”

stsadm -o provisionservice -action start -servicetype spwebservice -servicename “”
2. Instantiate the upgrade by executing psconfig.exe or psconfigui.exe.

The cause of this issue is the SPWebService instance failed to finish provisioning. The status of that service is marked as provisioning. However, it has done enough provisioning work so that the user sites are working and/or during upgrade, the upgrade code skipped any web service instances that are not online, upgrading the administration sites; however, skipping the user sites.

A good artice about STSADM:http://www.microsoft.com/technet/technetmag/issues/2007/01/CommandPrompt/

How to open a closed Web Part in SharePoint

December 15, 2010

When you click on the edit dropdown on a Web Part you are presented with a few options including Close and Delete. It seems that most users are scared by what would happen if they delete the web part, so they close it.  It doesn’t show on the page so it must be gone!

But have you ever wondered what the difference is between closing a Web Part and deleting it? When you close a Web Part although it doesn’t show up, it is still on the page and does whatever it is supposed to do.  For example, if you had a Content Query Web Part and closed it – everytime the page was opened it wouldn’t display but it would still run its query.
It is a small hit, but I’ve seen on more than one occasion users who close Web Parts instead of deleting them and end up with 10+ closed Web Parts on the page.
 
The million dollar question is, how do you open Web Part once it has been closed?  You can try appending ?contents=1 and get to the Web Part Maintenance screen, but that doesn’t help. 
 
To open a closed Web Part:
  1. Place the page into edit mode
  2. Click Add a Web Part at the top of a Web Part Zone
  3. In the lower right hand corner of Add Web Parts window, click on Advanced Web Part Gallery and options.
  4. In the top section of the Advanced Web Part Gallery, there is a link called Closed Web Parts. Click on this to display all of your closed Web Parts.
  5. To add them back to the page simply drag them back onto the page in your favorite Web Part Zone.

I can’t really think of many good situations where it is a good idea to close Web Parts on the page. If you want to save them, it is better to export them and save them off. They can always be added back later if needed.  The best plan is that if you don’t want a Web Part to show on the page – delete it! If it is a pain to set up and you want to make sure you don’t have to go through a bunch of trouble next time then export it and save it off.

SharePoint – Open documents in new window

December 9, 2010

Let’s take one scenario where your client does not have office installed and you also want to deal with document library.

Now we know that there is a settings in document library settings that if client do not have office installed at machine, then MOSS will automatically open document in the browser window. it automatically check for the availability of office at client side and if not found then opens it in same browser.

The settings for this is as follows :

(1) Go to your document library.
(2) Click on Settings-> document library settings
(3) Click on advanced settings
(4) Check for “Browser-enabled Documents” section and select Display as a Web page.
(5) Press OK.

Now you have set this option and if your client does not have office installed then MOSS will automatically open document in browser.

but but but…..notice that it opens in same browser…So if you want that document opens in new windows, not in the same browser then…..???

so Here is a trick to go for it :

But remember that this change will apply to all document libraries of all web applications. Because we are going to change the Global onet.xml. So be aware..

Here we go..

(1) Open C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML

(2)Open ONET.XML

(3)Search for this line <Else><HTML><![CDATA[<A onfocus=”OnLink(this)” HREF=”]]></HTML>

(4)Change it to <Else><HTML><![CDATA[<A onfocus=”OnLink(this)” target=”_new” HREF=”]]></HTML>

(5)Find one more line : <Else><HTML><![CDATA[<A TABINDEX=-1 HREF=”]]></HTML>

(6)Change it to <Else><HTML><![CDATA[<A TABINDEX=-1 target=”_new” HREF=”]]></HTML>

(7)Rest the IIS and just check…..

now all documents will open in new window..

How to make MOSS 2007 search results open in new window

December 7, 2010

The tip about opening links in new windows instead of the same window was a great idea but I couldn’t use the same tips since it was for SPS 2003. I wanted to be able to open links in new windows since I noticed a lot of users often times were searching for say PDF’s and then they would accidentally close the browser instead of hitting the back button. Big annoyance for them.
So I was snooping around the Search Core Results Web Part’s XSL Editor to see if I could edit the XSL to open links in new windows instead. It’s actually pretty easy, here are the steps:

1. Go to http://portal/searchcenter/pages/results.aspx

2. Modify Shared Web Part for the Search Core Results WebPart

3. Click on the XSL Editor Button

4. I’d suggest copying the contents of the pop up into notepad/wordpad to do your editing.

5. Search for the following lines:

<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}”>

______________________________________________

<span class=”srch-Title”>
<a href=”{$url}” id=”{concat(‘CSR_’,$id)}” title=”{$url}”>

____________________________________________________

<xsl:choose>
<xsl:when test=”$IsThisListScope = ‘True’ and contentclass[. = ‘STS_ListItem_PictureLibrary’] and picturethumbnailurl[. != ”]“>
<div style=”padding-top: 2px; padding-bottom: 2px;”>
<a href=”{$url}” id=”{concat(‘CSR_P’,$id)}” title=”{title}”>

__________________________________________

<span class=”srch-URL”>
<a href=”{$url}” id=”{concat(‘CSR_U_’,$id)}” title=”{$url}” dir=”ltr”>

____________________________________________

6. At the ends of each of the <a href= > tags, you’ll want to add on target=”_blank”

For example to make the link attached to the document icon open in a new window, the full tag would be like this:

<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}” target=”_blank”>

Using the same XSL Editor you can also manipulate how your search results are displayed and even include custom content types if you wanted to!

How to programmatically set the audience targeting on a web part (WSS 3.0)

December 1, 2010

SPWebPartCollection and IsIncludedFilter are both obsolete in V3, so I will use other new methods and properties to set the audience targeting property to a SharePoint Site Group which is part of “All Site Users” audience by default.

            SPWeb web = new SPSite(“http://server/mysite&#8221;).OpenWeb();
            SPLimitedWebPartManager wm = web.GetLimitedWebPartManager(“default.aspx”, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
           

            foreach (WebPart wp in webParts)
            {
                SiteUserManager sum = wp as SiteUserManager;
                if (sum != null && string.CompareOrdinal(sum.Title, wp.Title) == 0)
                {

                     sum.AuthorizationFilter = “;;;;” + web.AssociatedOwnerGroup.Name ;                    
                    wm.SaveChanges(sum);
                    break;
                }
              
            }

AuthorizationFilter is an arbitrary string to determine whether a WebPart control is authorized to be added to a page or not. You either have to give it a valid GUID of your audience or like what I did above provide the name of the group prefixed by “;;;;”.

Creating a A-Z filter for a list

September 17, 2010

My customer wanted to have a library list, for adding books.

We had a title field for the book and some other meta data for each book.

He wanted to have a page where users could filter the list to view all books starting with A,B,C…Z

Something that will look like:
A,B,C,D,E,F,G,H,…Z

And a list grid below that will filter all books starting with the selected letter.

I found a rather easy solution for that that needed no code at all – only customization!

Basically what I did was:
1 – Add a calculated column that will hold only the first letter of the Title field.
(fomula for this: =LEFT(Title,1) )
2 – Then I added the list grid web part.
3 – To add filter support I added above a rich text web part and added the HTML for A,B,C…Z and made each letter a hyperlink to the same page with adding “?FilterBook=A”.
4 – Now, all i had to do is to add a query string filter web part (comes with SharePoint) and configure it to take the filter value from “FilterBook” query string and send it to filter the list grid web part below.

Done!

No code solution that took no more than 10 minutes!

Adding the quick launch to team site pages

September 16, 2010

Ever tried to add a new page in a WSS or SharePoint Team Site ?

Well, after you create a new page, using the “Create web part page” wizard:

you probably noticed the following issues:

1. You have to create a document library to store them (unless you save them in “Shared Documents” library, but we wouldn’t want to mix documents and site pages, would we?)

2. They look different from the team site’s home page – where did the quick launch go ?

The solution is quite simple, and there are 2 cases here:

1. If you have MOSS 2007 – All you have to do is to activate the “Office SharePoint Server Publishing” feature for your team site. Once you activate this feature, the team site will have some publising site features: a new “pages” library will be created, and all new created pages will be automatically stored in this library. In addition all pages will display the same “envelope” – including the missing quick launch on the left side of each page.

The only problem with this solution is that now every change you make requires publishing, and this is certainly NOT a natural part of team-site working flow.

2. If you only have WSS installed – in this case you don’t have the “Office SharePoint Server Publishing” feature installed. however, you can change the team site page templates, and have them display the quick launch. This is quite easy to implement, so here it goes:

  • Browse the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS” folder on the SharePoint server.
    This folder contains all templates that you see in the “New Web Part Page” wizard:
  • Every page inherits the same team site’s master page, and all of them override this master page’s placeholder tags. This is why the quick launch is not displayed in new pages created in a team site
  • Simply delete the “PlaceHolderLeftNavBar” content tag in the required templates and save the file/s