How to move a site collection from one web application to another (Or change it’s port)

In some cases you may require to

  • Move a site collection from one web application to another.
  • Or Change a web application port number.
  • Or Change a site collection path.

In my scenario I have two web applications and I wanna move a site collection from http://mcit-test web application to http://mcit-test:7000 web application for test purpose.

Method 1 using Central Administration.

You can extend your web application and set the desired port by following the mentioned steps below:

  • Open Central administration –> Application Management –Manage web applications.

managewebapplication

  • Select the source web application and from the ribbon click on Extend.

extend web application

  • The following dialog should be shown to type the new port for new web application.

extend web application 1

Method 2 using SharePoint Management Shell.

  • Take a backup of site collection from old web application.
  • Restore backup in new web application.
  • Export & Import.
  • Remove site collection from old web application.
  • Delete backup file.

Take backup of site collection 

Take a backup of site from source web application (i.e http://mcit-test).
Backup-SPSite -Identity http://mcit-test -Path "C:\\MoveSiteCollection.bak"
or
Backup-SPSite -Identity http://mcit-test -Path "C:\\MoveSiteCollection.bak" -force

This cmdlet will create .bak file in  “C:\\” path with the given name in cmdlet.

Note: -force is switch parameter and it is used to create/overwrite if .bak file already exist.

Restore backup file to new web application :

Here assuming that http://mcit-test:7000 web application created and root site collection not created yet.

Restore-SPSite -Identity http://mcit-test:7000 -Path "C:\\MoveSiteCollection.bak"

or

Restore-SPSite -Identity http://mcit-test:7000 -Path "C:\\MoveSiteCollection.bak"  -Confirm:$false

If you use -Confirm:$false parameter then it won’t ask for a confirmation for restore of site collection.

This cmdlet will create root site collection in http://mcit-test:7000 from the backup.

Export Site

Export-SPWeb -Identity http://mcit-test -Path c:\\backup\Exportback.cmp

Import Site

Import-SPWeb -Identity http://mcit-test:7000 -Path c:\\backup\Exportback.cmp -Force

Remove site collection

Remove site collection from old web application.

Remove-SPSite -Identity http://mcit-test -Confirm:$false

Remove backup file

Remove the backup file from the path where we given path for backup.

Remove-Item "C:\\MoveSiteCollection.bak"

Enjoy 🙂

Advertisements

8 thoughts on “How to move a site collection from one web application to another (Or change it’s port)

  1. Hi! I could have sworn I’ve been to this website before but
    after looking at many of the posts I realized it’s new to me.
    Anyways, I’m certainly happy I found it and I’ll be bookmarking it and checking back often!

    Like

  2. Pingback: reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s