I am new to SharePoint, I recently added a content db to a web app. The db was a backup from another server. On adding the content db, a site was automatically added, although i still had to deploy the solution. I am trying to understand how add a content db, automatically added a site. Any inputs would be appreciated.
Not sure if I understood your question. When you add a content db SharePoint created the web application and sites automatically, that is by design. The content db should be from a farm of similar patch level. Here is more information on this: technet.microsoft.com/en-us/library/…
Jan 23 ’15 at 12:22
All content inserted in the original web application will go to at least one content database. So all your items, and everything included in the site collection will be stored in that Database. Once you take one of these content databases as a backup and restore it somewhere else, it will restore that content with it, and notice it’s only the content. If you have custom solutions created and depend on wsp files and dlls, they have to be deployed to the new environment as well in order for them to work. So if you have a page with a web part inside it that depends on a wsp file. The page will be restored, but the web part won’t work until you deploy the wsp file to the new environment & make sure the dlls are available for it.
For that you need to understand what is Content Database and role of content database in SharePoint.
Content databases store all content for a site collection. This includes site documents or files in document libraries, list data, Web Part properties, audit logs, and sandboxed solutions, in addition to user names and rights.
All of the files that are stored for a specific site collection are located in one content database on only one server. A content database can be associated with more than one site collection.
Below are some of the basic tables within a content database and a very high level diagram on some of the relationships between them.
Table that holds information about all the activated features for each site collection or site.
Table that holds information about all the site collections for this content database.
Table that holds information about all the specific sites (webs) in each site collection.
Table that holds information about all the users for each site collection.
Table that holds information about all the SharePoint groups in each site collection.
Table that holds information about all the SharePoint roles (permission levels) for each site.
Table that holds information about lists for each site.
Table that holds information about all the SharePoint group members.
Table that holds information about all the list items for each list.
Table that holds information about all the documents (and all list items) for each document library and list.
Table that holds information about all the users or SharePoint groups that are assigned to roles.
Table that holds information about all the scheduled subscriptions (alerts) for each user.
Table that holds information about all the immediate subscriptions (alerts) for each user.
Hence, when you restore a content DB, it pulls data from related table and created site structure accordingly.
In SharePoint, everything store in the Content DB. If you move a Content DB from One server to other or one farm to other, It will move everything( all site collections in that db) which is in that db.
Now issue, On old farm, all sharepoint Site collections(in a given web app where this db attached) are in that DB or only few site collections in it. So whatever in that db will move to new locations.
You should take the backup of DB from Old server
Restore the DB to new Server
Now attach the Restored DB to the Web Application in SharePoint( Central admin or Powershell).
Now you will see all the sites in that web application
For solution deployment, You can deploy it before or after DB attachment.