Site collection in a particular content database

How can we make sure to create a site collection in a particular content database?
Arun Prakash

Hi Arun, 
There is no direct option from SharePoint UI to select content database while creating Site collection, However you can do that using power shell .. here is the code..
$url = "http://test/sites/Communities"
$ContentDatabase = "OSCommunities_Content"
$WebsiteName = "Communities"
$WebsiteDesc = "Communities site"
$Template = "STS#1"
$PrimaryLogin = "domain\abg-spprodadmin"
$PrimaryDisplay = "admin"
$PrimaryEmail = "[email protected]"
New-SPSite -Url $url –ContentDatabase $ContentDatabase -Name $WebsiteName –Description $WebsiteDesc -Template $Template -OwnerAlias $PrimaryLogin –OwnerEmail $PrimaryEmail

Similar Messages

  • Site collection movement to another content database

    HI All,
    we are using sharepoint 2010 and have 2 big production web applications. 7 content databases are attached with one web application. Out of 7 cdb's, 3 content databases are more than 200 gb. The rest 4 cdbs are small in size. I want to pick some bigger site
    collection from those 3 bigger cdbs, and move them to any of the rest 4 cdb's.
    As per my knowledge.
    1. All the 7 cdb's are attached to a single web application.
    2. CDB's are in same instance of sql server.
    My question here is, how (move-SPSITE URL DESTINATIONCONTENTDATABASE WSS_COntent_abc) works.
    Question 1.  Will this cmdlets take the backup of URL mentioned , keep it somewhere in file system, and then move it to destination. and then delete it from source.
    Question 2: Or it will only move it to destination CDB, and delete it from source. Without taking any backup.
    Please help me to understand these questions.
    Thanks

    Hi,
    According to your post, my understanding is that you wanted to move site collection to another content database.
    You can use the Windows PowerShell command Move-SPSite to move site collections between content databases. However, it cannot backup the database.
    To backup database, you can use the Windows PowerShell command:
    Backup-SPFarm -Directory   <Backup folder>  -BackupMethod {Full | Differential} -Item <Content database name> [-Verbose]
    More information:
    Move site collections between databases (SharePoint Server 2010)
    Back up a content database in SharePoint Server 2010
    Restore a content database in SharePoint Server 2010
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Example to see all site collections in a specific content DB in sharepoint 2010

    Can someone give an example to see all site collections in a specific content DB
    in SharePoint 2010.
    I've tried the below ones but it gives all content DB's with all site collections.
    Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}}
    Appreciate your help

    Use Get-SPSite cmdlet
    $spAssgn = Start-SPAssignment;
    Get-SPSite -ContentDatabase "<SPContentDBName>" -Limit ALL -AssignmentCollection $spAssgn|Select Title,Url;
    Stop-SPAssignment $spAssgn;
    Get-SPSite
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Alerts are not working for Site collections in a content database

    Hi,
    We have been into a strange issue that alerts are not working for site collections from a particular content database. When user subscribed for the alerts, they are getting mail about their subscription but not after that for any new items/documents added
    or changes happen in the list/document library.
    We have tried with Immediate as well as scheduled alerts both are not working.
    FYI, Alerts for all other site collections from different content database for the same web application are working without any issues.
    Any help would be appreciated.
    Thanks
    Ramkumar

    Looks like an Timer job Issue for your web application. Can you please check if these jobs are enabled and check error log for the alerts Timer jobs .Check whether the "Immediate Alerts" job is enabled for your web application.
    job-immediate-alerts
    job-daily-alerts
    job-weekly-alerts
    Please check this wiki -
    Troubleshooting Steps for SharePoint Alert Email Does Not Go Out
    Thanks
    Ganesh Jat [My Blog |
    LinkedIn | Twitter ]
    Please click 'Mark As Answer' if a post solves your problem or 'Vote As Helpful' if it was useful.

  • Create a new site collection in different farm and connect to different content database from decommissioned farm

    I wish to bring down a SharePoint farm1 and create a new site collection in an existing farm2 and connect the new site collection in farm2 to the content db in farm1.
    Is this possible and how should I do it?

    it is possible to copy/move a content database from one farm to another... so long as the NEW farm is at least as up-to-date (version/service packs/updates/hotfixes/etc) as the OLD farm.
    you can move a site collection into its own content database.
    hopefully that answers your question.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Existing SharePoint 2010 Content Database Attach – No Site Collections

    First, let me start off by saying that I have read every single thread I could find on this subject, such as:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/0c34ca6f-0db1-4d61-a48c-c4704dd86513/currentsitecount-is-zero-in-upgraded-site
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/502459b3-0301-4ac3-bfc4-16ea702bb5bc/empty-site-data-after-mounting-content-database?forum=sharepointadminprevious
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/ec472ed5-4cdd-45ca-a327-ccc34c29c0a4/zero-site-collections-when-restoring-sp2010-content-database?forum=sharepointgeneralprevious
    http://social.technet.microsoft.com/Forums/en-US/c8df1760-275a-43a4-b3fc-cf257c56d8e2/orphaned-entry-in-config-database
    That said, even though my situation is a bit different than those posts, I have tried all the things!
    Let me break it down:
    Our prod server is a sad Frankenstein upgrade from Project/SharePoint 2003 to 2007 to 2010. 
    The problem is not on our prod server.
    Our test server was a database attach installation.  It mostly works. 
    The problem is, we have this old content database which housed the project sites that were created on 2003, then upgraded to 2007, then upgraded to 2010 – but when it attaches to the test server, it's empty.  The "current number of site collections"
    in CA shows 0 and the CurrentSiteCount in powershell = 0.
    We have to keep these sites and their links for compliance reasons (7 year retention policy!) and we haven’t really cared that they aren’t working on the test server…except that we are going to be upgrading to 2013 this year, and that’s a database attach
    no matter what.  So I have to solve this now.
    I’ve checked the following:
    The data is there on the database.
    The database name I’m typing is correct.
    The version of the db is up to date.
    The top level site is set to Exclusion.
    Permissions.
    Here’s what I’ve tried:
    Attaching using powershell
    Attaching using Central Admin
    Detaching and reattaching
    Running psconfig
    Resetting IIS
    When the database is unattached, I have tried the “Recover data from an unattached content database” function – it recognizes the database (if I type it in wrong, it tells me I don’t have access) but then finds nothing in the site collections.
    The prod server is perfectly happy with these sites, and we copied the database from prod after the 2010 upgrade, so I don’t know what the issue is.
    I appreciate any thoughts any of you have.  I’m stumped!
    ElliJ 
    Project Solutions Specialist
    http://projectserverpants.wordpress.com/

    Holy lots of errors, batman!!
    I think it's safe to say that the 2010 upgrade didn't hit all our sites, based on the errors and this post:
    http://social.technet.microsoft.com/Forums/projectserver/en-US/c7b19345-3036-4dc1-a174-026796cdee7c/missing-server-side-dependencies-after-project-server-upgrade-from-2003-to-2010?forum=projserv2010setup
    There are serveral missing setup files and one missing assembly:
    Category        : MissingSetupFile
    Error           : True
    UpgradeBlocking : False
    Message         : File [1033\PWA\lists\wplib\dwp\Updates.dwp] is referenced [27
                      5] times in the database [STS_FSHAREPTP01_1], but is not inst
                      alled on the current farm. Please install any feature/solutio
                      n which contains this file.
    Remedy          : One or more setup files are referenced in the database [STS_F
                      SHAREPTP01_1], but are not installed on the current farm. Ple
                      ase install any feature or solution which contains these file
                      s.
    Category        : MissingAssembly
    Error           : True
    UpgradeBlocking : False
    Message         : Assembly [Microsoft.Office.Project.Server.PWA,Version=12.0.0.
                      0,Culture=neutral,PublicKeyToken=71e9bce111e9429c] is referen
                      ced in the database [STS_FSHAREPTP01_1], but is not installed
                       on the current farm. Please install any feature/solution whi
                      ch contains this assembly.
    Remedy          : One or more assemblies are referenced in the database [STS_FS
                      HAREPTP01_1], but are not installed on the current farm. Plea
                      se install any feature or solution which contains these assem
                      blies.
    I guess the question now is - how do we get it to upgrade ALL of the site collections and sites?  I'm actually pretty sure I can figure it out from here, that test was a huge help, thanks!

  • Upgrade large farm with Service Pack detaching all content databases?

    Hi,
    Whenever we upgrade one of our farms (with a Cumulative Update, Language Pack, or Service Pack), the corresponding PSConfig usually yields in error due to the huge time taken to upgrade all the content databases at the same time.
    We have heared about the possibility of detaching all content databases previous to the update (just CONTENT databases), then proceed with the installation and PSConfig, and finally a gradual upgrade by attaching one by one the content databases.
    After searching online I have not found a relevant or precise official documentation detailing whether this procedure is recommended or viable, and have some additional questions:
    - Can all he content database be disconnected (including the ones containig myprofiles, top level sites...) during the upgrade?
    Thanks in advance

    In my understanding, the patching involves (at least) two steps:
    Patching binaries on all servers of the farm
    Upgrading the database schema of Service Applications DBs, Configuration & Admin DBs, and content databases.
    If during the upgrade the database is not attached to the farm, SharePoint does not know about it, and does nothing with itm just like if it was physically detached from the SQL Server instance. But when, after patching, you reattach the database, SharePoint
    detects the difference in the schema version and the patched farm version, and upgrades the database accordingly. As far as I understand, this is automatically done by
    Mount-SPContentDatabase:
    "The Mount-SPContentDatabase cmdlet attaches an existing content database to the farm. If the database being mounted requires an upgrade, this cmdlet will cause the database to be upgraded.
    The default behavior of this cmdlet causes an upgrade of the schema of
    the database and initiates upgraded builds for all site collections within the specified content database if required. To prevent initiation of upgraded builds of site collections, use the
    NoB2BSiteUpgrade parameter. This cmdlet does not trigger version-to-version upgrade of any site collections."
    If you decide not to upgrade, you can later run Upgrade-SPContentdatabase.
    The point is, that if you keep attached all the content databases, the PSConfig needs to do a massive upgrade of all the content databases before finishing, thus considering that the farm is ok. On the detach/attach approach, the first PSConfig ends quite
    soon so your farm is up and running sooner (although, that's for sure, without the data being available until attached and upgraded - but you can gradually start giving service instead of waiting for the whole process).
    So far, so good. But what I was trying to ask in my question, is whether there is a detailed procedure to follow for this approach, or if there is any particular constraint regarding this approach (like "databases containing top level site collections
    should not be detached", or "pay attention to the my site host web application", or "that patching method is not supported").
    Thanks.

  • Workspace Project Custom Field Web Part on different Site Collection?

    Hello experts,
    I'm working on a project site template in a SharePoint 2010 environment. My client wants project custom fields to be displayed on the Project Site homepage.
    To accomplish this, I'm using the Solution Starter's Workspace Project Custom Field Web Part.
    It works fine, as long as we create the project sites under the PWA site collection.
    However, due to administrative reasons, we've decided to provision all project sites under a separate Site Collection, in a separate content database. In this case, we manage to add the webpart to the page, but as soon as we try to edit it, to configure
    the visible Custom Fields, we get this error:
    Server Error in '/' Application.
    Unhandled Communication Fault occurred
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Web.Services.Protocols.SoapException: Unhandled Communication Fault occurred
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:
    [SoapException: Unhandled Communication Fault occurred]
    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +413241
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +300
    WorkspaceProjectCFWP.WebSvcCustomFields.CustomFields.ReadCustomFieldsByEntity2(Guid entityUid) +181
    WorkspaceProjectCFWP.Services.<>c__DisplayClass12.<GetCustomFields>b__11() +158
    Microsoft.SharePoint.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() +729
    Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) +26839062
    Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) +27885657
    Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) +93
    WorkspaceProjectCFWP.Services.CustomFieldsService.GetCustomFields() +208
    WorkspaceProjectCFWP.Services.CustomFieldsService.GetAllProjectFields() +173
    WorkspaceProjectCFWP.ProjectCFEditorPart.SyncChanges() +325
    Microsoft.SharePoint.WebPartPages.ToolPane.OnSelectedWebPartChanged(Object sender, WebPartEventArgs e) +283
    System.Web.UI.WebControls.WebParts.WebPartEventHandler.Invoke(Object sender, WebPartEventArgs e) +0
    Microsoft.SharePoint.WebPartPages.SPWebPartManager.BeginWebPartEditing(WebPart webPart) +96
    Microsoft.SharePoint.WebPartPages.SPWebPartManager.ShowToolPaneIfNecessary() +579
    Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnPageInitComplete(Object sender, EventArgs e) +296
    System.EventHandler.Invoke(Object sender, EventArgs e) +0
    System.Web.UI.Page.OnInitComplete(EventArgs e) +11146206
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1674
    Version Information: Microsoft .NET Framework Version:2.0.50727.5472; ASP.NET Version:2.0.50727.5474 
    Now, I've activated every possible feature, both on the Site Collection and Site level (or SPSite, SPWeb). Alas, no succes. Which brings me to these questions:
    What might be causing this error? Can this be solved?
    Are there any cases of working webparts of this kind in site collections other than PWA?
    If this is a technical limitation, what are alternative options for me to display custom fields on a project site?
    Link to the Solution Starters: http://archive.msdn.microsoft.com/P2010SolutionStarter

    Hi
    I did not use this solution starter, but it might be that the webpart just looks for a Project Server instance in the current site collection - and there is none.
    You could use a SQL Reporting Services Report to show on the site to accomplish this. Either you would have to set the project as a parameter manually once for each site, or you could try to determine the project automatically using the URL.
    Kind regards
    Christoph
    Christoph Muelder | Senior Consultant, MCTS, MCSE, MCT | SOLVIN information management GmbH, Germany

  • Delete sitecollection with content Database programaticaly

    Hi All,
    I have created Site collection with separate content database by  programmatically.
    in the same manner
    1) I want to delete the site collection and it's Content database.
       or
    2)User wants to delete the site collection from settings , after deleted the sitecollecton from settings page then it's content db not deleted.
    how can user can delete the site collection content db from user interface(user means - admin user, have full permission)
    Please assist on this.
    Thanks in advance.

    Regarding #2, when a site collection is deleted, SharePoint will NEVER delete the content database as well... SP has no way of knowing whether the CDB will be used for other site collections in the future, and CDB maintenance is an ADMIN task, not a USER
    task.
    Delete the content database with SPSite.ContentDatabase.Delete() - more or less
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Want to restore recent production backup content db into Dev Farm but both contain the same site collections.

    Here is my scenario: 
    My current dev sharepoint 2013 environment is using a former backup of Production (which is 2010). We need to restore the latest backup from production into the dev environment. I restored the production backup to a new database under a different name. When
    I use "Mount-spContentDatabase" and point towards the latest production backup under a new name it gives me the error:
    Mount-SPContentDatabase : The attach operation cannot continue because another
    object in this farm already contains the same ID. Each object in a farm must
    have a unique ID. In order to proceed with the attach operation you must
    assign a new ID to this database. To attach this database with a new ID, use
    the Mount-SPContentDatabase command with the -AssignNewDatabaseId parameter.
    Note that if this new database and an existing database contain the same site
    collections, attaching this database will likely result in orphaned site
    collections due to conflicts between the two databases." 
    I realize mounting the same content db's in one farm leads to a duplication of database and site collection GUIDS in the sql database. I guess my question is what is the easiest way to restore a content db with the same site collections and ID. 
    Should I "disconnect" the current dev content db, take a backup of it, delete it from sql server, and then mount the newest production backup or will that still give me the same "orphaned" site issue?
    Should I do the above, delete the web application, create a new one and then try to mount latest production backup?
    If someone could give me specifics on how this can be accomplished short of installing on a new farm that would be much appreciated!

    Once you detach it from Sharepoint, so all the site information gone from Config DB. No need to delete it from SQL but you can if you need free space on the SQL.
    After detaching old DB from sharepoint and mount the new DB to web application...you will not get the ID error.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Create a site collection with dedicated content db with the help of server object model

    Hi,
     I have a requirement to implement a create a new site collection with dedicated content db. i have got 2 PowerShell scripts which does the same. first i will  create a content  db and then create the sitecollection with contentdb
    parameter with the created contentdb name.
    Now the site collection created must contain few doc libs and few splists with look up columns, people picker data type, multiline of text, single line of text,choice field. hence i am thinking the below approach:
     1) create a web template and include sp doclibs, splists , site columns in this.
     2) i am thinking of a ui design to create the below:
     These are called "projects" which is actually the site collection with the doclibs, splists and must be created by sharepoint admin on click of a link in my landing page.end users access these "projects"  aka 
    "site collections" and uploads the documents into these projects and collaborate.
    so my question is :  On click of a button can I create a site collection with a dedicated content db based on the web template created with the  hel of  server  object model?
    The other approach is on click of this button call the power shell script which accepts the sitecollection name and contentdb name as parameter. is this possible in  server obj.model ?
    passing a paramter from code behind- visual web part ui to power shell ?
    and it should create the site collec based on the web template and create the content db.
    my doubt #3 : will it not throw error "request timed out" when creating the site collec and contentdb from ui ?

    Try below:
    http://sharepoint.stackexchange.com/questions/21606/programmatically-create-a-site-collection-in-an-existing-mounted-content-databa
    PowerShell is just a wrapper for the object model. You shouldn't need to reference PowerShell in your feature, just create the new site collection with C# inside your feature. There's a blog post here that illustrates some code that may get you started.
    http://blog.mastykarz.nl/programmatically-creating-sites-site-collections-custom-web-template/
    http://blogs.msdn.com/b/vesku/archive/2014/06/09/provisioning-site-collections-using-sp-app-model-in-on-premises-with-just-csom.aspx
    # Enable the remote site collection creation for on-prem in web application level
    # If this is not done, unknon object exception is raised by the CSOM code
    $WebApplicationUrl = http://dev.contoso.com
    $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
    if ($snapin -eq $null)
    Write-Host "Loading SharePoint Powershell Snapin"
    Add-PSSnapin "Microsoft.SharePoint.Powershell"
    $webapp=Get-SPWebApplication $WebApplicationUrl
    $newProxyLibrary = New-Object "Microsoft.SharePoint.Administration.SPClientCallableProxyLibrary"
    $newProxyLibrary.AssemblyName = "Microsoft.Online.SharePoint.Dedicated.TenantAdmin.ServerStub, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
    $newProxyLibrary.SupportAppAuthentication = $true
    $webapp.ClientCallableSettings.ProxyLibraries.Add($newProxyLibrary)
    $webapp.Update()
    Write-Host "Successfully added TenantAdmin ServerStub to ClientCallableProxyLibrary."
    # Reset the memory of the web application
    Write-Host "IISReset..."
    Restart-Service W3SVC,WAS -force
    Write-Host "IISReset complete."
    If this helped you resolve your issue, please mark it Answered

  • SharePoint content database size limit

    Hi All,
    I am just verifying whether my method is a right way to do it.
    I created a site collection and I am need to clone the sites. I tried Export/Import but the permissions are not copied as I use a third party tool for column level permission.
    The work around I found is to restore the site with new content database (all permissions are copied). I need to create 100 of those same exact site collection (for different users). I am planning on creating new content database within the same web
    application and resorting the site collection to the new content DB.
    Microsoft supports content DB of 4TB size.
    But my question is if I create multiple content DB (each does not exceed 200 MB) will there be any performance issue? Is it a right way to do it?
    100*200(MB) = close to 2 GB.
    I will be having 5 web application each with the 100 site collection and a content DB for each site collection with 200 MB.
    Is there anything wrong to do it this way?

    Hi Maddy.r,
    from the article it is stated the limit that 500 content database per farm.
    Limit                      
                            Maximum value                      
                            Limit type                      
                            Notes                      
    Number of content databases
    500 per farm
    Supported
    The maximum number of content databases per farm is 500. With 500 content databases per web application, end user operations such as opening the site or site collections are not affected. But administrative operations such as creating a new site collection
    will experience decrease in performance. We recommend that you use Windows PowerShell to manage the web application when a large number of content databases are present, because the management interface might become slow and difficult to navigate.
    sharepoint 2010 and 2013, have difference, and the capability for sharepoint 2013 is better than 2010.
    addition,
    i heard there is solution to have multiple farm instead, since the limitation is by farm, then if you able to create multiple farm, it may increase the bar for your environment limitation.
    http://www.informit.com/articles/article.aspx?p=2131832&seqNum=2
    Regards,
    Aries
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Strange behavior from script when dismounting content databases via PowerShell script

    So, this is my first time posting a question here.  I have taught myself PowerShell and for the most between friends, co-workers, or internet forums, I have been able to pick through most of the issues I have seen.  This one has me stuck. 
    So, a little background, I have a script that goes through each web app in a farm, finds the database that hosts the root site, and detaches all other content databases from the farm.  It also writes a csv file so that a process can come along after the
    fact to re-attach the databases.  I use this for patching so psconfig does not take quite as long as we have more than 50 content databases.  Here is the odd part.  After the first content database is detached, the second one is skipped, but
    the remainder are detached.  So, I have two databases left per web app.  One that holds the root site and whatever the second database is after the first detach.  If I comment out the line that actually does the detach, this does not happen. 
    Now, using ISE and adding break points, what I have found is that when I initially populate the array with the content databases ($var=$webapp.contentdatabase) all databases are in there.  When I start the foreach, all databases are in there.  Right
    up to the point that I detach the first database, all databases are still in the array variable.  As soon as I detach that database, the database that I detached gets removed from the array.  It does this even if I set the variable to read only. 
    It only happens with the first database detached in each web app.  I will try to explain this again with an example.  This test farm has 4 databases.  DB1, DB2, DB3, and DB4.  DB1 holds the root site.  The logic pulls the webapp info. 
    It gets the URL of the webapp.  It takes that info and finds the site collection with that name (the root site).  Finds the database name from there.  It then gets a list of all databases in the webapp and starts to loop through.  So the
    first one in the list is DB1.  It has the root site, so logic says do not delete.  It comes back to the loop with the next database DB2.  At this point, the array still has all 4 databases in the array.  DB2 does not host the root site,
    so the logic gathers information and calls dismount-spcontentdatabase.  As soon as that is called, that database is removed from the array.  So, at this point, we have processes postion 0 and position 1 in the array.  Since the original position
    1 has been removed, DB3 is now at postion 1.  So, the loop continues.  Sine we have now skipped DB3, we find DB4 and dismount.  Now, we have in the array DB1,DB3, and DB4.  My test environment has more and all are still there except for
    the first one removed.  I have banged my head against the desk with this one.  If someone has some insight, I would appreciate it.
    Here is the code that does it.
    get-spwebapplication | foreach-object {
     $webapp=$_
     $waname=$webapp.displayname
     $waurl=$webapp.url
     $cdbs=$webapp.contentdatabases
     $rsite=get-spsite $waurl -erroraction silentlycontinue
     $rsitedb=$rsite.contentdatabase
     $rsitedbn=$rsitedb.name
     foreach ($cdb in $cdbs) {
      $cdbs=$cdbs2
      $cdbname=$cdb.name
      #Write-Host "$cdbname" -foregroundcolor red
      if ($cdbname -ne $rsitedbn) {
       $warn=$cdb.warningsitecount
       $max=$cdb.maximumsitecount
       $current=$cdb.currentsitecount
       $dbserver=$cdb.server
       Write-output "$waname,$cdbname,$dbserver,$warn,$max,$current" >> $outfile
       Write-host "dismounting $cdbname" -foregroundcolor green
       dismount-spcontentdatabase -identity $cdbname -confirm:$false
      else {
       Write-host "$cdbname holds root site. No action." -foregroundcolor yellow

    what about keeping an array of all the non-root collections (may be database name) instead of dismounting them in the foreach loop of all the databases? After we have all the databases that need to be deleted, in a for loop starting with 0 and
    counting to the number of databases, check the name of the database for each index and dismount that database
    pseudo code would be
    $dbstobedismounted = @()
    foreach($cdb in $cdbs)
    $dbstobedismounted + = $cdb.Name  //instead of actually dismounting
    for(int i=0;i<$webapp.ContentDataBases.Count;i++)
    $dabasename = $webapp.ContentDataBases[i].Name
    foreach($dbtobedismounted in $dbstobedismounted)
    if($databasename -eq $dbtobedismounted )
    dismount-spcontentdatabase -dentty $webapp.ContentDataBases[i]
    I'm sure you might have to do some modifications to make it work, but the point I'm making is instead of dismounting in the foreach loop, have a list and dismount in another for loop. Hope it helps.
    rani

  • Search content from seperate Content Database using Scope

    Hi there,
    I am asked to move all non-active old sites to a seperate Archive Content Database (ACDB). Management don't want to see any content from ACDB. If required to search content from ACDB, scope should be used anywhere in the webapplication to search only from
    ACDB.
    I am thinking to create a Archive Content DB and move all non-active site collection to it. Create a scope and make it available to all site collections.
    Is it so simple of I am missing some more steps.
    Please advise.
    Thanks
    Mickey

    Hi Mickey,
    Your direction is right.
    One point that you need to note is that you need to create the scope in SharePoint Central Administration, then configure the scope displaying in site collections.
    More information about how to configure scopes in SharePoint 2010, you can refer to:
    http://www.surfray.com/blog/2013/06/17/how-to-configure-scopes-in-sharepoint-2010/
    Best Regards,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • SharePoint PowerPivot feature failing after site collection was backed up and restored (moved to new content database)

    Hi there,
    I am having some strange issue with my PowerPivot for SharePoint but can't figure out what is causing this. Here is what happened:
    I setup PowerPivot (PP) for SharePoint and activate it on few site collections in production environment; I upload a PP workbooks in a library, manage the data refresh schedules, run the data refresh for an external SQL databases, etc. Everything works
    fine for several days.
    One day we decide the move one of the site collections (X) from its current content database to its own (new) content db. The way we did it is that we took the site collection backup in production, restored it in test environment (in its own content
    db; we deleted the old site collection in test first before restoring), checked everything including PP data refreshes etc.; all worked fine.
    Then we did the same thing in production - we deleted the old site collection X, restored the site collection from the same backup file that we used in test environment, everything works fine EXCEPT the PowerPivot refreshes!! :-(
    I am getting these errors: When I click on the workbook, it gives this error "An error occurred during an attempt to establish a connection to the external data source. The following connections failed to refresh: PowerPivot Data"
    When I click OK on error dialogbox, it opens the workbook fine but no slicers/refreshes work now. When I go back to the library and click on "Manage PowerPivot Data Refresh" to open the refresh history/schedule page, it gives this generic but scary
    error: "An unexpected error has occurred. Troubleshoot issues with Microsoft SharePoint Foundation." ULSViewer or Event viewer is not showing anything related to this error!
    Strange thing is that PP refresh works fine in Test environment, as well as on other site collections in production that we didn't touch (which tells me there is nothing wrong with my PP configuration). Did the backup/restore in prd cause anything? Did moving
    it in its own contentdb cause anything? (But then why it works in test environment?) Is there anything wrong with site collection PP feature? Can force reactivating it help??????? I am just lost and going crazy now!
    Please help.
    Asif

    I have found some entries in ULS logs seemingly relevant to this issue as below: Please help. Thanks.
    Note: I have replaced urls with <url> or <server> and username with "domain\user".
    ExternalSource.GetExternalKeyAndStateAndMarkUsed: Populating the session's credentials for external data. Index=0, Credentials=[14337250,
    domain\user]
    ConnectionRequest.ConnectionRequest: New connection request. SessionId=1.V24.1916ClMR0rOQ1F8mQPqtil0V90.5.en-US5.en-US73.-0600#0000-04-00-01T03:00:00:0000#+0000#0000-10-00-01T02:00:00:0000#-006036.7dcb49ef-0dc4-45d2-a0f8-4dc0e18a70f41.N,
    WorkbookVersion=ConnectionInfo.WorkbookVersion: Uri=http://<url>/SQL_PowerPivotTest.xlsx, Version=Monday, 09 September 2013 06:29:42
    Check whether "http://<url>/SQL_PowerPivotTest.xlsx" is in the farm.
    Connecting to "http://<server>/_vti_bin/PowerPivot/Redirector.svc/?DataSource=/team/IT/SiteCollectionDocuments/SQL_PowerPivotTest.xlsx&LocaleID=1033".
    WcfSendRequest: RemoteAddress: 'http://<server>:32843/0a4610a7f75f4ff582ca7329256f0fe3/SSASMidTierService.svc' Channel: 'Microsoft.AnalysisServices.SharePoint.Integration.IGeminiServiceApplicationClient'
    Action: 'http://tempuri.org/IGeminiServiceApplication/GetDatabase' MessageId: 'urn:uuid:44f67e36-7ec2-4fe8-bd4c-277c9d9ddde7'
    WcfReceiveRequest: LocalAddress: 'http://<server>:32843/0a4610a7f75f4ff582ca7329256f0fe3/SSASMidTierService.svc' Channel: 'System.ServiceModel.Channels.ServiceChannel'
    Action: 'http://tempuri.org/IGeminiServiceApplication/GetDatabase' MessageId: 'urn:uuid:44f67e36-7ec2-4fe8-bd4c-277c9d9ddde7'
    Entering monitored scope (ExecuteWcfServerOperation)
    Obtaining routing information for the request using <SERVER> - User:domain\user, DataSource: http://<url>/SQL_PowerPivotTest.xlsx,
    Version: 09/09/2013 06:29:42. (RequestStartTime=[<SERVER>])
    Leaving Monitored Scope (ExecuteWcfServerOperation). Execution Time=10.7664521608193
    EXCEPTION: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Unable to find the specified file. (Fault Detail
    is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.IO.FileNotFoundException: Unable to find the specified file.  
     at Microsoft.SharePoint.SPFile.EnsureUniqueId()   
     at Microsoft.SharePoint.SPFile.get_UniqueId()   
     at Microsoft.AnalysisServices.SharePoint.Integration.Redirector.BackendRedirectService.GetDatabase(String loginName,
    String dataSource, String versionLabel, DateTime fileLastModifiedTimestamp, Int32 localeId, Boolean collectHeathInfo, Boolean createLocal, String serverEndpointAddress)   
     at Microsoft.AnalysisServices.SharePoint.Integration.GeminiServiceApplication.GetDatabase(String loginName, String
    dataSource, String dataSourceVersion, DateTime fileLastModifiedTimestamp, Int32 localeId, Boolean collectHeathInfo, Boolean createLocal, String serverEndpointAddress)   
     at SyncInvokeGetDatabase(Object , Object[] , Object[] )   
     at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)   
     at Sy...).
    Proxy encountered an error while trying to get the sandbox information. This request will be terminated
    EXCEPTION: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Unable to find the specified file. (Fault Detail
    is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.IO.FileNotFoundException: Unable to find the specified file.  
     at Microsoft.SharePoint.SPFile.EnsureUniqueId()   
     at Microsoft.SharePoint.SPFile.get_UniqueId()   
     at Microsoft.AnalysisServices.SharePoint.Integration.Redirector.BackendRedirectService.GetDatabase(String loginName,
    String dataSource, String versionLabel, DateTime fileLastModifiedTimestamp, Int32 localeId, Boolean collectHeathInfo, Boolean createLocal, String serverEndpointAddress)   
     at Microsoft.AnalysisServices.SharePoint.Integration.GeminiServiceApplication.GetDatabase(String loginName, String
    dataSource, String dataSourceVersion, DateTime fileLastModifiedTimestamp, Int32 localeId, Boolean collectHeathInfo, Boolean createLocal, String serverEndpointAddress)   
     at SyncInvokeGetDatabase(Object , Object[] , Object[] )   
     at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)   
     at Sy...).
    PF_CHECK_ERROR returned 'critical hresult error' 0x80004005 ; Stack Trace:NA
    PF_CHECK_ERROR returned 'critical hresult error' 0x80004005 ; Stack Trace:NA
    PF_CHECK_ERROR returned 'hresult error' 0x80040e41 ; Stack Trace:NA
    ConnectionManager.GetConnection: Failed to create new connection, exception=Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionException:
    Exception of type 'Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionException' was thrown.   
     at Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionInterop.InitConnection()   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.<>c__DisplayClass3.<CreateConnection>b__0()   
     at Microsoft.Office.Excel.Server.Credentials.TryExecuteImpersonated(WindowsIdentity wi, ExecuteImpersonatedMethod
    method, Boolean dispose)   
     at Microsoft.Office.Excel.Server.Credentials.TryExecuteImpersonated(ExecuteImpersonatedMethod method, Boolean
    dispose)   
     at Microsoft.Office.Excel.Server.CalculationServer.CredentialsDelegation.TryExecuteImpersonated(ExecuteImpersonatedMethod
    method)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.CreateConnection(Credentials credentials,
    ConnectionInfo connectionInfo, Int32 keyLcid, Uri workbookUrl, Boolean auditConnection, SessionId sessionId), sessionId=1.V24.1916ClMR0rOQ1F8mQPqtil0V90.5.en-US5.en-US73.-0600#0000-04-00-01T03:00:00:0000#+0000#0000-10-00-01T02:00:00:0000#-006036.7dcb49ef-0dc4-45d2-a0f8-4dc0e18a70f41.N,
    connectionString=Provider=MSOLAP.4;Persist Security Info=True;Initial Catalog=Microsoft_SQLServer_AnalysisServices;Data Source=$Embedded$;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error;Optimize Response=3;Cell Error Mode=TextValue pool
    count=0
    ConnectionManager.GetConnection: Caught an exception: Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionException:
    Exception of type 'Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionException' was thrown.   
     at Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionInterop.InitConnection()   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.<>c__DisplayClass3.<CreateConnection>b__0()   
     at Microsoft.Office.Excel.Server.Credentials.TryExecuteImpersonated(WindowsIdentity wi, ExecuteImpersonatedMethod
    method, Boolean dispose)   
     at Microsoft.Office.Excel.Server.Credentials.TryExecuteImpersonated(ExecuteImpersonatedMethod method, Boolean
    dispose)   
     at Microsoft.Office.Excel.Server.CalculationServer.CredentialsDelegation.TryExecuteImpersonated(ExecuteImpersonatedMethod
    method)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.CreateConnection(Credentials credentials,
    ConnectionInfo connectionInfo, Int32 keyLcid, Uri workbookUrl, Boolean auditConnection, SessionId sessionId)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.CreateConnectionAndAddToList(ConnectionRequest
    connectionRequest, ExtendedConnectionInfo extendedConnInfo, Credentials credentials, Boolean auditConnection, Int32 keyLcid, ConnectionInfo connectionInfo, ConnectionKey connectionKey, AutoReaderWriterLock autoPoolLock, Connection& connection, ConnectionList&
    connectionList)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.GetConnection(ConnectionRequest connectionRequest,
    ExtendedConnectionInfo extendedConnInfo, Credentials credentials, Int64 privateConnectionId, Boolean auditConnection)
    Refresh failed for 'PowerPivot Data' in the workbook 'http://<url>/SQL_PowerPivotTest.xlsx'.
    [Session: 1.V24.1916ClMR0rOQ1F8mQPqtil0V90.5.en-US5.en-US73.-0600#0000-04-00-01T03:00:00:0000#+0000#0000-10-00-01T02:00:00:0000#-006036.7dcb49ef-0dc4-45d2-a0f8-4dc0e18a70f41.N User: 0#.w|domain\user]
    ExternalSource.ValidateConnection: Unable to get a connection: Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionException:
    Exception of type 'Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionException' was thrown.   
     at Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionInterop.InitConnection()   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.<>c__DisplayClass3.<CreateConnection>b__0()   
     at Microsoft.Office.Excel.Server.Credentials.TryExecuteImpersonated(WindowsIdentity wi, ExecuteImpersonatedMethod
    method, Boolean dispose)   
     at Microsoft.Office.Excel.Server.Credentials.TryExecuteImpersonated(ExecuteImpersonatedMethod method, Boolean
    dispose)   
     at Microsoft.Office.Excel.Server.CalculationServer.CredentialsDelegation.TryExecuteImpersonated(ExecuteImpersonatedMethod
    method)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.CreateConnection(Credentials credentials,
    ConnectionInfo connectionInfo, Int32 keyLcid, Uri workbookUrl, Boolean auditConnection, SessionId sessionId)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.CreateConnectionAndAddToList(ConnectionRequest
    connectionRequest, ExtendedConnectionInfo extendedConnInfo, Credentials credentials, Boolean auditConnection, Int32 keyLcid, ConnectionInfo connectionInfo, ConnectionKey connectionKey, AutoReaderWriterLock autoPoolLock, Connection& connection, ConnectionList&
    connectionList)   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionManager.GetConnection(ConnectionRequest connectionRequest,
    ExtendedConnectionInfo extendedConnInfo, Credentials credentials, Int64 privateConnectionId, Boolean auditConnection)   
     at Microsoft.Office.Excel.Server.CalculationServer.ExternalSource.TryGetValidatedConnection(Request request, Credentials
    credentials, ExtendedConnectionInfo extendedConnectionInfo, Boolean shouldReportFailure, Boolean auditConnection, Connection& connectionOut). sessionId=1.V24.1916ClMR0rOQ1F8mQPqtil0V90.5.en-US5.en-US73.-0600#0000-04-00-01T03:00:00:0000#+0000#0000-10-00-01T02:00:00:0000#-006036.7dcb49ef-0dc4-45d2-a0f8-4dc0e18a70f41.N,
    externalSource=PowerPivot Data
    ConnectionInfoManager.InitConnInfoFromOdcFile: ODC File Uri is not valid:
    ExternalSource.ExecuteOperation: We exhausted all available connection information. Exception: Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionInfoException:
    Exception of type 'Microsoft.Office.Excel.Server.CalculationServer.Interop.ConnectionInfoException' was thrown.   
     at Microsoft.Office.Excel.Server.CalculationServer.ConnectionInfoManager.GetConnectionInfo(Request request, String
    externalSourceName, Int32 externalSourceIndex, Boolean& shouldReportFailure)   
     at Microsoft.Office.Excel.Server.CalculationServer.ExternalSource.ExecuteOperation(Request request, ExternalSourceStateInfo externalSourceStateInfo,
    ExternalSourceStateInfo prevExternalSourceStateInfo, Int32 index, ConnectionInfoManager connectionInfoManager, ExternalDataScenario scenario, DataOperation dataOperation, Boolean verifyPreOperationConnection), Data Connection Name:
    PowerPivot Data, SessionId: 1.V24.1916ClMR0rOQ1F8mQPqtil0V90.5.en-US5.en-US73.-0600#0000-04-00-01T03:00:00:0000#+0000#0000-10-00-01T02:00:00:0000#-006036.7dcb49ef-0dc4-45d2-a0f8-4dc0e18a70f41.N, UserId: 0#.w|domain\user

Maybe you are looking for