Showing posts with label viral shah. Show all posts
Showing posts with label viral shah. Show all posts

Wednesday, November 23, 2016

Create Site collection with New Content database in SharePoint

In many scenarios you will be required to create a site collection with new Database to satisfy database growth/flexible site collection, which can later move to different web application.

Let’s see step by step how to create a SharePoint site collection with a separate content database using Powershell for SharePoint.

Step:1

Create a managed path under web application : 
Go To Central Admin >> Application Management >> Create Site Collection



Select Defined managed Paths



Enter Site collection name and Type "Explicit Inclusion"



Click on "Add Path".

Step:2

Now we need to create Content Database to host the site collection. Remember we only have Defined managed path and not created Site Collection Yet.

Run below command under Powershell window:

New-SPContentDatabase -Name "WSS_Content_test" -DatabaseServer "Servername"  -WebApplication "http://xyz:6001/test"

$ContentDatabase = Get-SPContentDatabase "WSS_Content_test"

Above command will create Content Database on SQL server.

Step:3

In Final step we need to create site collection with new content database we just created.

Define all parameters:

$url = "http://xyz:6001/test"
$ContentDatabase = "WSS_Content_test"
$WebsiteName = "Test"
$WebsiteDesc = "Site test portal"
$Template = "STS#1"
$PrimaryLogin = "domain\adminuser"
$PrimaryDisplay = "Admin"
$PrimaryEmail = "xyz@domain.com"

Execute the command:


New-SPSite -Url $url –ContentDatabase $ContentDatabase -Name $WebsiteName –Description $WebsiteDesc  -Template $Template -OwnerAlias $PrimaryLogin –OwnerEmail $PrimaryEmail

Site template we selected STS#1 is for blank website. Incase you need to explore more template types, please refer this wonderful article.

Taaada!! Site collection is created with new content database in just three steps.

Thursday, April 2, 2015

Move-SPUser Failed with error "The site with the id "GUID" could not be found.

Scenario

Think about this scenario,  you are trying to run the migrate user command to migrate the user from one ID to new id in he certain situation.
  1. User ID get deleted from AD and recreated but with new SID
  2. User id change from One Domain to other domain
  3. User ID got changed after her last name changed.
You run the following command:
PS C:\temp>$user = Get-SPUser -web https://webapplication url-Identity "domain\username"
PS C:\temp>Move-SPUser -Identity $user -NewAlias "domain\testuser" –IgnoreSID -Confirm:$false
Move-SPUser : The site with the id ebaf8908-78B9-4BAF-9845-56556B2BE628 could not be found.
At line:1 char:12
+ Move-SPUser <<<<  -Identity $user -NewAlias "domain\testuser" -IgnoreSID
    + CategoryInfo          : InvalidData: (Microsoft.Share...PCmdletMoveUser:
   SPCmdletMoveUser) [Move-SPUser], FileNotFoundException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletMoveUser
 

Even with Stsadm command:

stsadm.exe -o migrateuser -oldlogin "domain\user" -newlogin "domain\testuser" -ignoresidhistory
The site with the id ebaf8908-78B9-4BAF-9845-56556B2BE628 could not be found.
Now if you trying to get the details about the Site ID & run the below command:
 PS C:\temp>get-spsite  -identity "ebaf8908-78B9-4BAF-9845-56556B2BE628"
Get-SPSite : Cannot find an SPSite object with Id or Url: ebaf8908-78B9-4BAF-9845-56556B2BE628.
At line:1 char:11
+ get-spsite <<<<  ebaf8908-78B9-4BAF-9845-56556B2BE628
    + CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletGetSite:
   SPCmdletGetSite) [Get-SPSite], SPCmdletPipeBindException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
 

Reason:

Migrate / Move user go through all sites in the content databases & User Profile. If there is any orphan sites in the content database then this issue occurred.

Identify:

If you have only few content databases in your farm then run the below mentioned script against each content DB and see if its worked.
Select * from userinfo with (nolock) where tp_siteid like '%ebaf234348-78B9-4VAF-9845-56556B2BE628%'
If you have many databases across on couple of servers then run this
EXEC sp_MsForEachDb 'use [?]; SELECT "?" AS [databasename], ID FROM [?].dbo.AllSites with (Nolock) WHERE ID = "ebaf234348-78B9-4VAF-9845-56556B2BE628"'
You will get the Database name and ID.
Server NamedatabasenameID
Database ServerContentDatabaseebaf234348-78B9-4VAF-9845-56556B2BE628

Resolution:

Method # 1

You need to detach the content Databse and re attach it back to Web app will clear the orphan.
To detach a content database by using Central Administration
  1. Verify that the user account that is performing this procedure is a member of the Farm Administrators SharePoint group.
  2. On the SharePoint Central Administration website, click Application Management.
  3. On the Application Management page, in the Databases section, click Manage content databases.
  4. Select the web application for which you want to detach a content database.
  5. Click the content database that you want to detach.
  6. On the Manage Content Database Settings page, select the Remove content database check box.
If the content database contains data, you will receive a warning. Click OK to continue with the operation.
  1. Click OK to confirm the detachment, or click Cancel to stop the operation without detaching the database.
After detaching the content database in Central Administration, the content database still exists in SQL Server.
To attach a content database by using Central Administration
  1. Verify that the user account that is being used to perform this operation is a member of the Farm Administrators SharePoint group.
  2. Start SharePoint 2010 Central Administration.
  3. On the SharePoint Central Administration website, click Application Management.
  4. On the Application Management page, in the Databases section, click Manage content databases.
  5. On the Manage Content Databases page, click Add a content database.
  6. On the Add Content Database page:
    1. Use the web Application drop-down menu to select the web application to which you want to attach a content database.
    2. Specify the database server that hosts the database.
    3. Specify the database name. If the database does not already exist, it will be created.
    4. Specify the authentication method for the database, and supply an account name and password if you are using SQL authentication.
    5. Click OK.

Method # 2

If above method failed, then you have to create a new content Database and move all working sites except orphan to the newly created Database.

Tuesday, May 28, 2013

System.InvalidOperationException: Namespace prefix 'xsd' is not defined

Its bit strange error for me when i installed IE 10. After bit research i found this error can occur if you try to edit and save a list item entry in SharePoint. On non-development environments you see only this error message dialog (debug mode disabled):


 To solve this problem switch your browser to IE8 mode within the Internet Explorer Developer Tools: 



Now you should be able to edit and save the changes.

Wednesday, October 10, 2012

Use Visio Service in SharePoint 2010

Visio service in sharepoint is useful to see visio drawing and graphs in your browser only. But unless you have gone through the steps, it might not be all that obvious.

The requirements for this is that you must have both SharePoint 2010 Enterprise and Visio 2010.

Step 1 - Turn on Visio Services

Go to --> Site Actions --> Site Settings.
Then click "Manage site features".

visio feature in sharepoint 2010

















If your SharePoint Server Enterprise Site features are not activated, click the Activate button.
Activate Visio in central admin of sharepoint 2010







Here is what it should look like:

 

 

 

  

 

 

Step 2 - Configuring the document library.

Now, navigate to a document library where you would like to publish the Visio for users to view in a web browser. Go to the List settings and click Advanced Settings.

my visio library settings

Set the Opening Documents in the Browser option to Open in the browser.
open visio files in browser

Step 3 - Publishing a Visio 2010 document

After creating your Visio document, select Save As from the File menu.


save visio document












 

In the File name box, paste the URL of the site where you library is.






Navigate to the library (double click).














Give your file the desired name.
IMPORTANT: From the Save as type: dropdown, choose Web Drawing. Then press Enter or click Save.


save visio in web drwaing format

 





















Here's what the Visio looks like in a web browser.

visio 2010 open in web browser

 And Done..!! you have successfully configured Visio service in SharePoint 2010

Contact me

Name

Email *

Message *

Total Pageviews