Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

SharePoint Applied—Stsadm Is Your Friend

I am a self-confessed command line junkie. Sure, I see value in GUIs—and they're great for getting accustomed to a tool—but after crawling, the command line lets you walk, run, and then fly!


advertisement
n this article, I'll introduce you to my best friend in SharePoint land, Stsadm.exe. No, this article is not a reference on Stsadm, neither is it an introduction to SharePoint. Instead, I introduce you to a few neat tricks using Stsadm that I like to keep in my back pocket.

Managing Sites and Site Collections
SharePoint organizes its data in sites and site collections. When you design a site for a client, you must evaluate a number of pros and cons as you choose between a site and a site collection for a particular set of data. Irrespective of what you picked, you'll encounter times where you wished you had picked the other. Or sometimes, you just need to shuffle or move things around because the requirements changed, the databases grew, or any other reason. Stsadm is incredibly helpful in such scenarios.

You may backup a site collection using the following command:

stsadm -o backup -url -filename

Similarly, you may restore a site collection using the following command:

stsadm -o restore -url -filename

When you import and export single sites, you need to pay extra attention to site GUID identifiers and versions of items/documents in the site.
Now note that I mentioned "site collection" and not site. In order to backup a site, you may use the following command:



stsadm -o export -url -filename

Similarly, in order to import a site you may use the following command:

stsadm -o export -url -filename

To import and export single sites need you to pay extra attention to site GUID identifiers, and the versions of items/documents in the site.

Now, this brings up some interesting permutations and combinations. Using the preceding commmands, you could:

  • Move site collections to/from servers, or within the same website.
  • Move sites up or down in the hierarchy of a site collection.
  • Convert a site into a site collection.
Now, why would you ever want to convert a site into a site collection? Because, you cannot split a site collection between multiple content databases, and sometimes content databases get too huge to manage. As it turns out, Stsadm can also help you manage your content databases.

Managing Content Databases
Sometimes you might land in a project where you have a content database that is bursting its seams. Usually, when a content database grows to over 50GB, a SharePoint architect's warning lights should turn yellow. If it crosses 200GB for high I/O sites, or 500GB for read-only sites, the warning lights should glow red. Note that you can tweak these soft limits beyond the numbers I mentioned, but—sooner or later—you'll have to face the problem of taking an existing website with numerous sites or site collections, and splitting them up into manageable chunks containing separate content databases.

To do so, use the following command to force the creation of a new site collection in a new content database:

stsadm -o createsiteinnewdb -url -owneremail -ownerlogin -databasename

After running the preceding command successfully, you may verify under Central Administration → Application Management → Content Databases that a new content database has indeed been added, and that the single site collection specified in the preceding code was created.

You can use the following sequence of commands to move a site collection from <oldUrl> to <newUrl>:

stsadm -o backup -url -filename stsadm -o deletesite -url stsadm -o restore -url -filename -overwrite

As you can see, the commands back up the site from the old URL, delete it, and then restore it at the new URL, which exists in a new content database. You accomplished all this with only a few lines using Stsadm, which supports a number of other commands that let you work with content databases. I recommend that you read the MOSS SDK to get more detail about the various possibilities.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap