Saturday, January 31, 2015

Sitecore move items from web to master

Sitecore move items from web to master?



How to Move Sitecore item from Web to master database?

what to do? If we accidentally delete an item from master database that exists on web database.

Many times we face the situation where we need to transfer the item from web to master database due to any reason, below are the approaches to recover an item in the master database from the web database.

1. Sitecore Packages:

  • Simply create a package of desired items that need to be moved by selecting web database, from the right side below corner of site core desktop.
  •  Install the package by selecting master database, from the right side below corner of site core desktop.
  •  Now items are available in master database.

2. Transfer the item from one database to another:

Sitecore provides item and subitems transfer functionality, through which we can move any item from one database to another like web to master.

We can do this by 2 ways in sitecore:
First, ItemTransfer function that can we access from item level itself.
You can access it from item> Right Click> Copying> Transfer

Sitecore move items from web to master






Secondly,you can use the "Transfer Item to Another Database" feature, which you can find in the "Control Panel" > "Database" menu.

Sitecore move items from web to master






Sitecore move items from web to master






Sitecore move items from web to master





Sitecore move items from web to master





So by Follow the above step we can move items from web to master database

Thanks For Giving your Time.

Do you know other better solution? is this helped? Feel free to share your views with us!

Happy Sitecoring...



Sitecore Mongo db Setup

Sitecore Mongo DB Capability, Sitecore-Mongo DB solved the Big Data Challenges.


First we need to understand what is BIG DATA?

Big data is an all-encompassing term for any collection of data sets so large or complex that it becomes difficult to process them using traditional data processing applications.
The challenges include analysis, capture, duration, search, sharing, storage, transfer, visualization, and privacy violations. The trend to larger data sets is due to the additional information derivable from analysis of a single large set of related data, as compared to separate smaller sets with the same total amount of data, allowing correlations to be found to "spot business trends, prevent diseases, combat crime and so on.
It's not all about Data but below,







 


 


 





Velocity – It moves extremely fast through various sources such as online systems, sensors, social media, web click stream capture, and other channels.
Variety – It’s made of many types of data from many sources – structured and semi-structured, as well as unstructured (think emails, text messages, documents and the like).
Volume – It may (but not always) involve terabytes to petabytes (and beyond) of data.
Complexity – It must be able to traverse multiple data centers, the cloud and geographical zones.

Now we have understand what is big data,now question arise what sitecore face challenges without big data capability.


So below are the challenges that sitecore faced prior to 7.5x version.










 








 







Performance.
In an online world where nanosecond delays can cost you sales, big data must move at extremely high velocities no matter how much you scale or what workloads your database must perform. The data handling hoops of RDBMS and most NoSQL solutions put a serious drag on performance.

Continuous availability.
When you rely on big data to feed your essential, revenue-generating 24/7 business applications, even high availability is not high enough. Your data can never go down. A certain amount of downtime is built-in to RDBMS and other NoSQL systems.

Scale:
With big data you want to be able to scale very rapidly and elastically. Whenever and wherever you want. Across multiple data centers and the cloud if need be. You can scale up to the heavens or shard till the cows come home with your father’s relational database systems and never get there. And most NoSQL solutions like MongoDB or HBase have their own scaling limitations.

Manageability.
Staying ahead of big data using RDBMS technology is a costly, time-consuming and often futile endeavor. And most NoSQL solutions are plagued by operational complexity and arcane configurations.
Data security.

Big data carries some big risks when it contains credit card data, personal ID information and other sensitive assets. Most NoSQL big data platforms have few if any security mechanisms in place to safeguard your big data.

So above is the capacity of big data that we have incorporated in sitecore with the help of Mongo-DB integration, Mongodb integration is available in sitecore7.5.
In my next post you can find more about mongodb implementation with sitecore.











Sunday, January 25, 2015

Sitecore: Tips & Techniques on Data Migration into sitecore cms



Sitecore: Tips & Techniques on Data Migration into sitecore cms

Now it’s common to migrate data from existing database to sitecore Items.

We had a same requirement, one of my client wanted to migrate their old web site(that was in SQl server database) to Sitecore 7.0.

The challenge was to migrate around 20k events items, 30k news,40k publications etc along with media items like PDFS,Audio,Videos,Images etc into sitecore.

So after giving many efforts/time, getting help from sitecore, re-coding the utility, we found some take away points, from this data migration utility.

So here I want to share my experience that may be useful to you and save your time,below are the key points that should be take care at the time of creation the data migration utility.


  • Disable all indexes during the migration
  • Wrap the your custom logic into: SecurityDisabler(), EventDisabler(), ProxyDisabler()
  • Create store procedure in Sql server instead of direct query.
  • Create web API( controllers) to run the utility instead of separate page or any other technology(get rid of the time out problem)
  • Divide the data into parameter functions, instead to run utility as whole divide it into chunks that would call through controller.
  • Logging the utility, log record and exception so that it would be traced if needed.
  • Write the utility in such a way that would easily updated instead of deleting all item and re-run(it’s really very time consuming).
  • Use proper check like DBNULL and not null condition in code.
  • Assign item id for reference field include media items.
  • Use ProposeValidItemName function while creating item,More Detail
  • Proper handling for date field. I am enclosing the code below.
  • Use optimize way to create media items like image,pdf,videos,More detail
  • Skip the item that create error and log properly instead of application crash.
  • Effectively handle folder creation, don’t create more than 100 items under one folder, create the folder on basis of some logic like Year,Month,date or Bucketable folder etc.


Below are the some code snippets:

Get data from Store procedure in c#:

public DataTable GetSPData(string spName, string parentFolder, string childFolder)
        {
            string connString =” your connection string ";
            string sql = spName;
            SqlConnection conn = new SqlConnection(connString);
            try
            {
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = new SqlCommand(sql, conn);

                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                if (string.IsNullOrEmpty(parentFolder) == false && string.IsNullOrEmpty(childFolder) == false)
                {
                    da.SelectCommand.Parameters.Add(new SqlParameter("@parameter name", parentFolder));
                    da.SelectCommand.Parameters.Add(new SqlParameter("@parameter name, childFolder));
                }

                DataSet ds = new DataSet();
                da.Fill(ds, "result_name");
                DataTable dt = ds.Tables["result_name"];
                return dt;
                //foreach (DataRow row in dt.Rows)
                //{
                //    //manipulate your data
                //}

            }
            catch (Exception ex)
            {
                            }
            finally
            {
                conn.Close();
            }


            return null;

        }



Get and create sitecore Item C#

  public Item GetAndCreateItem(string ItemName, TemplateItem currentTemplate, Item parentItem)
        {
            try
            {
                                if (parentItem != null)
                {
                    Item childItem = parentItem.Axes.GetDescendant(Sitecore.Data.Items.ItemUtil.ProposeValidItemName(ItemName));
                    if (childItem != null)
                    {
                        return childItem;
                    }
                    else
                    {
                        using (new SecurityDisabler())
                        {
                            childItem = parentItem.Add(Sitecore.Data.Items.ItemUtil.ProposeValidItemName(ItemName), currentTemplate);
                            return childItem;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
               

            return null;
        }



Custom Loggingin sitecore

System.IO.File.AppendAllText(“file path”,Error);

I hope this post would useful to you regrading data migration into sitecore.

Happy Coding !!