Some time we have to restore the Content Database of a Web Application from Produciton to the same web application running on Pre_production and Vise - Versa (In order to make both the enviroments Identical).
Restoring the Content Database of a Web Application on other runnig application :
Here we will Restore the Production Content DB to Pre_production Web application ... We can do Vise versa too...
Taking the Backup of Content Database of Production Web Application:
1. Take the Backup of Content Database of web application on Pre Production server and keep it on some
safe place.
2. Log on to the Production Database server and take the Backup of the Content Database of the Web Application that you want to restore on Pre-Production web applcation. (Content DB of a web application can be found in Central Admin --> Application Management --> Contenet Database section and selecting the rigth web application)
Restoring the Backup on the Pre Productin Database server
1. Transfer this DB backup to the Pre_Production Database server.
2. Create an empty DB in Management Studio and set the location of .MDF and .LDF files of that DB as
per your environment ( C:\ or D:\ )
3. Restore from backup on this newly created DB , you should change an option in the “options” tab and
select "Overwrite DB" on the restore dialog to make it work.
Attaching the Restored DB to the Web Applicaiton
1. As the web application on Pre-Prod is already created and it has already a database attached to it. We
do not need to create a new web application. We will just detach the existing DB from this Web
application and will attach the new restored DB to it.
2. Go to Central Admin->Application Management->SharePoint Web Application Management->Content
Databases-> Remove Content Database from the web app. ( This step will remove the Previous or old
DB from the application and the application is ready to get the new restored DB attached to it)
3. Now we will associate the new DB to the application :
We will use STSADM to add restored DB to this web app
Open the command Prompt and set the path to "C:\Program files\Common files\Microsoft Shared\Web
Server Extentions\12\bin on new server is where you can find the STSADM.
run this command from there.
stsadm -o addcontentdb -url http://yourwebapp:port -databasename yourcontentdb -databaseserver
yoursqlserver
4. Run the IISRESET command.
It's DONE.....
ENJOY!!!!!!!!!!!!!!
Restoring the Content Database of a Web Application on other runnig application :
Here we will Restore the Production Content DB to Pre_production Web application ... We can do Vise versa too...
Taking the Backup of Content Database of Production Web Application:
1. Take the Backup of Content Database of web application on Pre Production server and keep it on some
safe place.
2. Log on to the Production Database server and take the Backup of the Content Database of the Web Application that you want to restore on Pre-Production web applcation. (Content DB of a web application can be found in Central Admin --> Application Management --> Contenet Database section and selecting the rigth web application)
Restoring the Backup on the Pre Productin Database server
1. Transfer this DB backup to the Pre_Production Database server.
2. Create an empty DB in Management Studio and set the location of .MDF and .LDF files of that DB as
per your environment ( C:\ or D:\ )
3. Restore from backup on this newly created DB , you should change an option in the “options” tab and
select "Overwrite DB" on the restore dialog to make it work.
Attaching the Restored DB to the Web Applicaiton
1. As the web application on Pre-Prod is already created and it has already a database attached to it. We
do not need to create a new web application. We will just detach the existing DB from this Web
application and will attach the new restored DB to it.
2. Go to Central Admin->Application Management->SharePoint Web Application Management->Content
Databases-> Remove Content Database from the web app. ( This step will remove the Previous or old
DB from the application and the application is ready to get the new restored DB attached to it)
3. Now we will associate the new DB to the application :
We will use STSADM to add restored DB to this web app
Open the command Prompt and set the path to "C:\Program files\Common files\Microsoft Shared\Web
Server Extentions\12\bin on new server is where you can find the STSADM.
run this command from there.
stsadm -o addcontentdb -url http://yourwebapp:port -databasename yourcontentdb -databaseserver
yoursqlserver
4. Run the IISRESET command.
It's DONE.....
ENJOY!!!!!!!!!!!!!!