Wednesday, September 12, 2012

How to Correctly Backup and Restore Term Store DB, Content Type Hub and Content Database

I have run across this scenario a few times so I thought I would write a guide for others to follow. The need for this comes up when companies have multiple environments such as Prod, Staging, Test, Dev etc. Almost invariably, I have seen that the Prod environments are the most up to date, not only in terms of content but also in terms of configuration of the SharePoint farm.

So lets assume that your organization is using the Content Type Hub to syndicate and push content types to the different subscribing site collections. This involves the use of the Managed Metadata Service which directs the publishing of the content types and also allows for the term sets to be used in the various SharePoint web sites. Lets also assume that your sites use Managed Metadata columns that are mapped to the term sets in the term store. Every once in a while, you want to pull data back to your other environments for periodic refreshes and testing. I have been asked how to do this by a few clients so I will lay it out here.

To do this correctly, you will need to back up at least 3 databases from your production farm, depends on how many databases your hub and content sites are using. I am assuming 1 per web application here. So, backup the Hub database, the content database or databases which you want to bring back, and the managed metadata database that contains all the term sets and terms. What is the managed metadata database, you ask. To find that out, you have to go to Service Applications, highlight the Managed Metadata Service application and then click properties. You will see the name of the database on this screen.

Bring those backed up databases to the target environment SQL Server, ready to be restored. As a best practice first I make backups of all three or more databases in the target environment that I am about to replace. Then I turn of the SP Timer service to make sure the timer jobs don't try to push stuff while I am restoring term sets and the Hub. Then I override the MMS destination database with the MMS database I just backup from Prod. This brings back all the term sets and terms. I also disconnect the Hub and the target web application content databases using CA or stsadm or powershell.

Note: To view this go back to the properties screen we were just on for the Managed Metadata Service Application. This brings back the connection to the content type hub in production, which is what we don't want. We want this URL to point to our target environment (Staging, Test etc). It is not possible to change this URL from the UI, we have to change it using powershell.

Once the managed metadata service looks good and all the term sets and terms have come through, then we can move on to the hub and content databases. Restore the hub and content databases as different names on the target farm so they dont override. Make sure that the permissions match on the newly restored database and the old database that we just disconnected. This is just a practice I follow. Then attach the hub web application to the newly restored hub database from prod. You might have to redo permissions on the newly restored site collections through CA so you can access them.

Finally, restore and attach all the content databases that you need to. After all this is done, do an IISReset and start the timer service. This will start the two timer jobs that push and subscribe to the content types from the new hub.

There you go, all done! Verify to make sure that your MMS columns work correctly in your web applications and that your content types are being pushed down correctly from your local hub.

Nice work, Faraz. However, different farms have different contents not just by accident. The QA farm is configured heavily for QA activities. Once you swap the content database of the QA farm by that of the production, QA team will hate your guts. Same applies to a shared dev environment that is used by more than one dev team.

Your solution has merits though. With the inexpensive virtualized environments, you can always back up any production site collection and restore it on a new virtualized environment for testing. A good and disciplined QA team can write scripts to create their ideal configuration in minutes. So you put some times on setup and configuration, but you don't throw away other people's sites, lists, metadata etc.

However, a better solution could be configuring a single content hub for all of your environments. But I am not sure if SharePoint allows that.

We backup site collection via stsadm\powershell and restore it in other farm. But the term store service values are missing after the restore. How can we backup & restore the site collection with the service data as well? This site helps me to write my essay on this theme.

Hi,Thank you for this information. Please take my suggestion to also re-publish the content types located in the hub. Do this before running the timer jobs to propagate them. If you do not republish them, they may end up as editable on the consumer sites, or not propagate at all.

Utilizing essay writing service is an alternative for those who want to finish their writing assignment in a short time. Writing an essay can be, somewhat, very tiring. An essay does not merely a matter of a basic structure consisting introduction, main body, and conclusion. There can be more than that. Sometimes, you are wondering why your friends can be very addicted into writing. They can be very excited when it comes a time to finish their writing assignment.

Most students in schools and tertiary educational background position organizations would commonly want essay help online with regards to their essay jobs would regularly examine internet expert services whereby those people students could purchase them.

I sometimes struggle with deadlines. With tons of reading assignments and papers to finish, I sometimes feel like it is impossible to accomplish them all. Luckily, there are great online services that help me write an essay for free.

Hi! My brother is soft developer.I think, your article would very please him. And I am working sa essay writer. I earn money by writing essays - welcome to our professional essay writing service and order essays online!

Hello, you are right! I think it is very good information! Relax and everything will be good! I belive in it and you must try to be the happy! By the way guys, I want to advice a good tip, how to be relax in education! It is very easy and very comfatable! It is a professional http://custom-writing.net

Nice!I am always searching onlina for information that can be useful for me.I think you made some good points in Features also.Keep working,great job! http://www.advanced-writer.com and please welcome to my website!

Hi to all! Very nice stuff! I get to see more informative post from you in future! And I know, that from most student it is difficult to write a quality essay! Thats way, this site can be the best solution http://www.essay-mania.com.

I don't understand anything what you're speaking about. I'm a real newby in the computer scinces.. Thanks for sharing and write more info with http://www.papers-writings.com last year I became convinced that it is the most reliable online writing service.

I find the information extremely useful for students and teachers. Very often they do not have access to needed sources. Great post, keep on writing and always feel free to visit www.academic-writings.com to obtain professional writing assistance on any topic.

Every one of us dreams the writing the perfect essay. However, this is easier said than done! This can be so exhausting! This why i order a lot of my assignments on professional writing service, for example http://essay-professors.com