How to move a content db from a SharePoint Dev farm to a SharePoint test farm.
step 1. backup the dev farm content db
step 2. go to your test farm, copy the backup to the SQL Server backup location
If you don’t know the default SQL server backup location, start SQL Server Management Studio (SSMS), right click on the SQL Server Instance (in my case :CONTOSOSERVE\SHAREPOINT); and select “Default Settings” as illustrated below:
step 3.Restore the db by using the sql server restore tool (in SSM)
Click Devices, select your backup file.
Go to Options
- select “overwrite the existing database”
- unselect “take tail-log backup before restore”
- select “close existing connection to destination database”
Click ok to start the restore.
When the restore is done, make sure the db shows up in SSMS (refresh the window).
Step 4 Fix the security
Now if you take a look at the restored db, you will quickly notice that the security associated with the previous farm is still there :
the dev farm domain is DC07, the users DC07\SPFarm (in this case the developer uses the farm admin account for the application pool account, which is of course not recommended in production)
So we need to fix that AND we also need to associate this database with a clean web application (let’s say that you just created a new clean web application , then use Central Admin-Application Management-Manage Content Database, select you web application, click on you content database name, select remove the db and click ok ).
the powershell commandlet Mount-SPContentDatabase is supposed to do that :
in the SharePoint PowerShell command line, type
[For your info, if the database is already mounted, you will get en error message, use Dismount-SPContentDatabase before using Mout-SPContentDatabase ]
Now the interesting step is to take a look at the database security folder : the web application pool service account CONTOSO\sp-d-content AND the farm account CONTOSO\sp-d-farm are now authorized in the db.
CONTOSO\sp-d-content has the SPDataAccess role membreship and
CONTOSO\sp-d-farm has dbowner and SPDataAccess role memberships
To make sure that your content db is logically associated with the web application, go to Central Admininistration and as we dit before select the Manage Content Databases menu item in Application Management-Databases.
In order to use the site collection(s) in the new content database, you still have to go to Central Administration and specify the site collection administrators.
Step 5. It can happen that some list items are not visible in the new farm even if you are site collection administrator : in this case, make sure that the option Manage files which have no checked in version in your document library settings :
This option is tricky because it doesn’t show just the checked out documents, but it shows the document that haven’t been checked in yet ( like versions O.1).