In This blog i have explained that
how we can config multiple database with one Sitecore instance. I am using Sitecore
8.2 version and in my Sitecore i have configured 5 database
(Core,master,web,masterportal,webdbportal) . as we know that by default
sitecore provide 3 main database (Core,Master,Web).
In my case first we use sitecore 8.1
version and after few years we are creating new sitecore instance sitecore 8.2
version. we have two sitecore instance and side by side migrate all sitecore
8.1 version items to sitecore 8.2 version items. Yes its possible to upgrade sitecore but
we trying create new fresh sitecore instance.
here i have 5 database created in
Sql server.
- Core
- Master
- Web
- Master(Sitecore 8.1)
- Web(Sitecore 8.1)
A few things that you need to do,
which you wouldn’t normally, is to configure new Databases(Master,web of 8.1 version) in
Sitecore. First, open up /Website/App_Config/ConnectionStrings.config and
configure the extra database. It could look like this:
Very Easy and straight forward. Now open sitecore.config file and search <Databases> element, and find <!-- master -->, just copy entire section and paste below <!--master--> section. like this:
<!-- MasterPortal –> <database id="MasterPortal" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel"> <param desc="name">$(id)</param> <icon>People/16x16/cubes_blue.png</icon> <dataProviders hint="list:AddDataProvider"> <dataProvider ref="dataProviders/main" param1="$(id)"> <prefetch hint="raw:AddPrefetch"> <sc.include file="/App_Config/Prefetch/CommonPortal.config" /> <sc.include file="/App_Config/Prefetch/MasterPortal.config" /> </prefetch> </dataProvider> </dataProviders> <securityEnabled>true</securityEnabled> <proxiesEnabled>false</proxiesEnabled> <publishVirtualItems>true</publishVirtualItems> <proxyDataProvider ref="proxyDataProviders/main" param1="$(id)" /> <workflowProvider hint="defer" type="Sitecore.Workflows.Simple.WorkflowProvider, Sitecore.Kernel"> <param desc="database">$(id)</param> <param desc="history store" ref="workflowHistoryStores/main" param1="$(id)" /> </workflowProvider> <indexes hint="list:AddIndex"> <index path="indexes/index[@id='system']" /> </indexes> <archives hint="raw:AddArchive"> <archive name="archive" /> <archive name="recyclebin" /> </archives> <Engines.HistoryEngine.Storage> <obj type="Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel"> <param connectionStringName="$(id)" /> <EntryLifeTime>30.00:00:00</EntryLifeTime> </obj> </Engines.HistoryEngine.Storage> <Engines.HistoryEngine.SaveDotNetCallStack>false</Engines.HistoryEngine.SaveDotNetCallStack> <cacheSizes hint="setting"> <data>20MB</data> <items>10MB</items> <paths>500KB</paths> <standardValues>500KB</standardValues> </cacheSizes> </database>
Now, I made to this copy, are marked with yellow background color, the only thing changing are references to
“master” which now become “MasterPortal”. and copy master.config file and paste in prefetch folder from sitecore 8.1 instance to sitecore 8.2 instance with renamed MasterPortal.config.
Same way i have configured web database too. so now my sitecore.config file look like this:
With this change, I am now ready to
log in to Sitecore and check that everything is fine or not.
when i switch in desktop mode at bottom of right side corner, i can see my 5 database and able to switch into database.
So here, core, master,web database to point my sitecore 8.2 version and MasterPortal and WebPortal point to sitecore 8.1 instance.
So when i select MasterPortal database and go to in content editor mode and create,edit, or delete any item and publish then item should be pass in webportal database. for this changes we have to set publish target, i have done below setting when i am selecting masterportal database.
Give any significant name to
publishing target definition item. Enter database id in the Target
database Field.
In content Editor(MasterPortal) go to path /sitecore/system/Publishing
targets
Here, in Target database section given same name(webPortal) as which are mention in our connectionstring.config file.
After doing this changes any file under masterPortal are published, then publish popup give indication to you that where your item published.
Open Sitecore publishing dialog and
you can see newly created publishing target.
we can access any items from MasterPortal database in code. using below code
Item itemId = masterDbPortal.GetItem(new ID(itemId));
Known Issue :- In Custom database(MasterPortal) we are not able to see preview or edit mode open in sitecore.
Comments and suggestions are most
welcome. Happy coding!
No comments:
Post a Comment