This is what I have learned about deleting a site collection. You can use stsadm command to delete a site collection (stsadm -o deletesite). If the site collection resides in the same content database as other site collections, access to other site collections will be affected (the site collection deletion seems use a lot of I/O).
If the site collection being deleted is in a separate content database, this does not affect the other site collections. One way to minimze deleting the site collection contents when it is sharing the same content database with other site collections is to use the "stsadm -o deleteweb" operation. This command deletes a site. But this site should not have any sub sites.
You can generate a script to delete all the sites, starting from the innermost, all the way to the top. To minimize the IO impact, you can put a "sleep" command in between the site deletion.
I used 2 bat files for the deletion 1) delete_web_sub.bat and 2)delete_web_main.bat
---------------------------------------
-- delete_web_sub.bat
---------------------------------------
@echo off
c:
cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\bin
echo %DATE% %TIME%
echo Deleting %1 now
stsadm.exe -o deleteweb -url %1
echo %1 deleted - sleep 10 count
sleep 10
---------------------------------------
-- delete_web_main.bat
---------------------------------------
@echo off
d:
cd D:\
call D:\delete_web_sub.bat "http://servername/sites/AVI/site1/subsite1"
call D:\delete_web_sub.bat "http://servername/sites/AVI/site1/subsite2"
call D:\delete_web_sub.bat "http://servername/sites/AVI/site1"
...
The following query can be run to generate content for delete_web_main.bat:
select 'call D:\delete_web_sub.bat "http://servername/'+ FullUrl +'"'
from webs
where fullurl like 'sites/AVI/%'
order by FullUrl desc
Tuesday, June 22, 2010
On exporting SharePoint site contents
I tried exporting SharePoint site contents one day, as I wanted to move the site from existing site collection into a new site collection. I thought using read-only lock for the current site collection before the export, to prevent anyone making chnages while export is running. The site collection top-level site URL is "http://servername". The URL for the site that I'm exporting is a sub site in this site collection is "http://servername/AVI". I wanted to move this to "http://servername/sites/AVI"
I found that this has created a problem for me. The site import did not work as expected. After I created a blank site collection "http://servername/sites/AVI", when I import the sites into this new site collection, it gave me this error message: "The target site http://servername/sites/AVI/AVI does not exist"
This did not happen if I had done my export without locking it first.
I found that this has created a problem for me. The site import did not work as expected. After I created a blank site collection "http://servername/sites/AVI", when I import the sites into this new site collection, it gave me this error message: "The target site http://servername/sites/AVI/AVI does not exist"
This did not happen if I had done my export without locking it first.
SharePoint Site Usage Report
The server only maintains the last 30 days access history. If there is no data for the past 30 days, you will see the message you saw yesterday ("Usage report is not available for this site. Usage processing may be disabled on this server or the usage data for this site has not been processed yet."). We will only see yesterday's access in today's report.
Tuesday, June 8, 2010
How to export SharePoint documents
Ever wonder how to export all documents from a SharePoint site? Yes, you can use the menu option "Actions" > "Open with Windows Explorer" and start copying the documents, but this method does not always work 100%, especially if there are many document libraries, many sub sites, and if the document sizes are very big.
The method I would recommend is to use SPIEFolder utility. This can be downloaded from http://spiefolder.codeplex.com
Install (extract) SPIEFolder utilities files in a directory on the SharePoint server. Once that is done, you can use the followign query to generate a DOS script to export documents from each list inside a SharePoint site.
select 'SPIEFolder.exe "http://sharepoint.ctl.creaf.com/' + w.fullURL + '" "' + l.tp_Title + '" "D:\Backup\SharePoint\' + replace(w.fullURL,'/','\') +'"'
from lists l, webs w
where l.tp_WebId=w.Id
and w.fullURL like 'sites/myDepartment%'
An example of the script output:
SPIEFolder.exe "http://sharepoint.mycompany.com/sites/myDepartment" "Shared Documents" "D:\Backup\SharePoint\sites\myDepartment"
SPIEFolder.exe "http://sharepoint.mycompany.com/sites/myDepartment" "Policies and Procedures" "D:\Backup\SharePoint\sites\myDepartment"
Here I'm exporting all contents from "Shared Documents" and "Policies and Procedures" libraries. Folders with the same name as the library names will be created in "D:\Backup\SharePoint\sites\myDepartment" on the SharePoint server.
The method I would recommend is to use SPIEFolder utility. This can be downloaded from http://spiefolder.codeplex.com
Install (extract) SPIEFolder utilities files in a directory on the SharePoint server. Once that is done, you can use the followign query to generate a DOS script to export documents from each list inside a SharePoint site.
select 'SPIEFolder.exe "http://sharepoint.ctl.creaf.com/' + w.fullURL + '" "' + l.tp_Title + '" "D:\Backup\SharePoint\' + replace(w.fullURL,'/','\') +'"'
from lists l, webs w
where l.tp_WebId=w.Id
and w.fullURL like 'sites/myDepartment%'
An example of the script output:
SPIEFolder.exe "http://sharepoint.mycompany.com/sites/myDepartment" "Shared Documents" "D:\Backup\SharePoint\sites\myDepartment"
SPIEFolder.exe "http://sharepoint.mycompany.com/sites/myDepartment" "Policies and Procedures" "D:\Backup\SharePoint\sites\myDepartment"
Here I'm exporting all contents from "Shared Documents" and "Policies and Procedures" libraries. Folders with the same name as the library names will be created in "D:\Backup\SharePoint\sites\myDepartment" on the SharePoint server.
Friday, June 4, 2010
Missing document libraries after stsadm import
Once upon a time, I was tasked to move a big SharePoint site (a site with lots of sub sites, with a total size of 9 GB) into a site collection. I did this by exporting the top-level site in our production server using "stsadm -o export" and importing it back with "stsadm -o import" into an empty site collection. After I imported the sites into the new site collection, I found document libraries were missing in many of the sites, and not all sites were created successfully in the new site collection. This puzzled me because the same export and import worked in our test environment.
After a few more tries, I found that the problem was with the export itself. If users are still making updates in the source site when the export is running, the sites will not be imported successfully later. Sometimes, the export itself will fail in the middle, as stsadm cannot find certain files that is being uploaded/deleted by users.
After a few more tries, I found that the problem was with the export itself. If users are still making updates in the source site when the export is running, the sites will not be imported successfully later. Sometimes, the export itself will fail in the middle, as stsadm cannot find certain files that is being uploaded/deleted by users.
Thursday, June 3, 2010
Stsadm export completed with FatalError: There is no row at position 0
I performed export of a SharePoint site (running on WSS 3.0) using "stsadm -o export" today and the export stopped half way with these errors when trying to export documents from a doc library:
1) FatalError: There is no row at position 0
2) The system cannot find the file specified
I went in to check the document library, and found that a user has uploaded some new documents while the export is running. I re-ran the export in the evening when no users are using the site and the export completed successfully.
1) FatalError: There is no row at position 0
2) The system cannot find the file specified
I went in to check the document library, and found that a user has uploaded some new documents while the export is running. I re-ran the export in the evening when no users are using the site and the export completed successfully.
Subscribe to:
Comments (Atom)