Copying content allows the replication of production data in another environment. The result will be identical environments, which provides the ideal testing environment.
Prerequisites
In order to successfully restore your data, make sure you fulfil the following requirements:- Your account is in the local admin group of the production environment
- Your account is in the local admin group of the target environment
- The production environment should have the same or a lesser patch version than the target environment.
- Both environments should have the same solutions deployed for the source and target web applications.
- Your target site collection should not exist to avoid conflicts.
Database restore
Ask the SQL team nicely to restore a copy of the production content database of your source web application where the site collection resides, to the target SQL instance.Note: Make sure the dbo of the target database is the web application service account of your target farm.
When the target database is restored, it’s time to bring it into SharePoint. Here a first decision has to be made:
- Is the source managed path different from the target managed path? For example is your source website called http://sharepoint/ and your target is called http://sharepoint/targetmanagedpath ?
- Are the managed paths the same?
Scenario 1: Different managed paths
In the case of different source and target managed paths, it’s impossible to directly attach the content database to the target web application.- In order to successfully attach the content database, create a new –empty- web application. Empty means that there are no site collections created in the attached content databases of the web application.
- Attach the restored contentdatabase using the following command:
1
- If your source farm has a different version than the target farm,
you have to run an extra command to upgrade your contentdatabase to the
right version:
12
$db
=
Get-SPContentDatabase
| ?{
$_
.Name –eq
"RestoredDatabase"
}
Upgrade-SPContentDatabase
$db
- Now that your content database is attached it’s time to move the site to the correct web application and managed path.
11
- Make sure that you clean up after your restore was successful.
- Delete the temporary bak file
- Delete the restored content database
- Delete the temporary web application
- Delete the temporary web application’s content database
Scenario 2: Same managed paths
When the source and target web application’s site collection have the same managed path, it’s possible to directly attach the restored database to the target web application. You do this with the following steps:- Attach the restored contentdatabase using the following command:
1
- If your source farm has a different version than the target farm,
you have to run an extra command to upgrade your contentdatabase to the
right version:
12
$db
=
Get-SPContentDatabase
| ?{
$_
.Name –eq
"RestoredDatabase"
}
Upgrade-SPContentDatabase
$db
Result
When a site is moved from production to another environment, all it’s content is moved. Take into account that data might also reside in other places like the managed metadata term store.Reference:
http://bramnuyts.be/2012/01/12/copy-site-collection-from-source-farm-to-target-farm/
This comment has been removed by the author.
ReplyDeleteYour services are really impressive. Thanks for sharing this post. Digital Transformation Saudi Arabia
ReplyDelete