常用Stsadm 操作,网站备份与还原

1. 升级,回收Solution,以及Feature常用操作

@setlocal
@pushd.

@set SiteUrl=http://richsharepoint:86

@set FeatureName=ePAN.Proxy
@set path=%path%;%programfiles%\common files\microsoft shared\web server extensions\12\bin
@cd /d %~dp0

rem ** upgrade the solution **
stsadm -o upgradesolution -name %FeatureName%.wsp -filename %FeatureName%.wsp -immediate -allowgacdeployment

stsadm -o execadmsvcjobs

stsadm -o installfeature -name %FeatureName%\feature.xml 
stsadm -o deactivatefeature -filename %FeatureName%\feature.xml -force -url %SiteUrl%
stsadm -o activatefeature -filename %FeatureName%\feature.xml -force -url %SiteUrl%
stsadm -o uninstallfeature -name %FeatureName%\feature.xml 
rem ** delete solution **
stsadm -o retractsolution -name %FeatureName%.wsp -immediate

iisreset
net stop SPTimerV3
net start SPTimerV3
@popd
@endlocal
@pause

2. 备份与还原网站集

To backup a site collection, use the following command line:

stsadm -o backup -url <URL of the site collection> -filename <name of the backup file>


To backup an individual database, web application, or entire farm, use the following command line:

stsadm -o backup -directory <UNC path or local drive> -backupmethod <full or differential>


Now that you backed up your farm, it's time to restore it. Use the following command lines to accomplish this:

To restore a site collection, use the following command line:

stsadm -o restore -url <URL of site collection> -filename <name of backup file>


To restore an entire farm, use the following command line:

stsadm -o restore -directory <UNC path or local drive> -restoremethod <overwrite or new>


So let's say now you want to migrate data from one SharePoint Server to another. You always have the option of using Export and Import, which I always like to use. Note that this tool will only migrate sites.

To export your sites, use the following command line:

stsadm -o export -url <URL> -filename <FileName>.cmp


To import your site, use the following command line:

stsadm -o import -url <URL> -filename <FileName>.cmp

3. 部署及调试常用操作

copy dll到bin目录: 

xcopy /s /Y /C /R "bin\debug\*" "C:\Inetpub\wwwroot\wss\VirtualDirectories\81\bin\"

修改81为实际的文件夹。

注册或更新GAC:

"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if bin\Debug\CodeArt.SharePoint.dll

修改CodeArt.SharePoint.dll为实际的dll名

重启IIS--IIS重启操作太慢了,我们可以采用重启应用程序池的方法:

将以上命令进行组合,保存到一个文本文件中,改名为XXX.cmd,将这个cmd文件放到VS解决方案的跟目录下,每次需要部署到moss的时候双击一下cmd即可。

iisapp /a "SharePoint - 81" /r

修改SharePoint - 81为实际应用程序池的名称

4. Solution的常用操作


A.打开“命令提示符”窗口,输入:
    cd   C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN  

B.安装solution
stsadm -o addsolution -filename c:"MeetingTemplate.wsp

C.部署deploysolution,这个可能会有问题,暂时没有试过
stsadm -o deploysolution -name MeetingTemplate.wsp -allowgacdeployment -immediate
 
   如果部署的是aspx页面,DLL会自动部到GAC里,aspx页面也会自动部到Layouts下

D.删除
   1.retractsolution
    stsadm.exe -o retractsolution -name MeetingTemplate.wsp -immediate

   2.deletesolution
    stsadm.exe -o deletesolution -name MeetingTemplate.wsp
     也可以强制删除 [-override]

原文地址:https://www.cnblogs.com/gzh4455/p/2289552.html