Scheduling data refresh

As we learned before, cubes are a big cache in the Intelligence Server memory. Their data is static. We need to update them when new data is available, typically after an ETL job is run.

Refreshing a cube's data involves connecting to the data warehouse and re-executing the underlying SQL statements. Normally, the best time to do it is during off-peak hours, and since BI developers like to sleep at night, there must be a way to automate that.

MicroStrategy offers a scheduling mechanism to automate cube updates very similar to cron on *nix or the Task Scheduler on Windows.

In order to automate a cube refresh, we need two objects: a schedule and a subscription.

A schedule is just a recurring timer, like every day at 3 A.M., or every Monday; it does not perform any action. A subscription is an object that binds a report, document, or cube to a schedule and a delivery type. There are several delivery types in MicroStrategy, such as e-mail and printer; in our case we will use a special delivery type called Cube Refresh.

Subscription can be used to automatically mail data to users on a schedule basis; or execute long running reports before working hours (so that they are already cached); or—like in our case—to execute and publish cubes after a data load. Let's see how to do it.

Getting ready

You need to have completed the previous recipe to continue.

How to do it...

Imagine that our ETL jobs run from 1 A.M. until 2:30 A.M. daily. We need to create a subscription to refresh the cube 54 at 3 A.M. every day:

  1. In the Desktop application, navigate to the Administration | Configuration Managers | Schedules folder.
  2. Right-click on an empty area on the right and select New | Schedule from the context menu.
  3. On the welcome screen, click on Next.
  4. In the Name textbox, type Every day at 3AM and hit Next.
  5. Leave Time-triggered selected and click on Next.
  6. Leave the default validity range, click on Next.
  7. In the Recurrence Pattern window, in the Time to trigger group, modify Execute at to 3AM and click on Next.
  8. You will be presented with a list of next occurrences. Click on Next and again on Finish.
  9. Now that we have a schedule we move to the Administration | Configuration Managers | Subscriptions folder.
  10. Right-click on the empty area and select Subscription Creation Wizard from the context menu.
  11. Click on Next on the welcome page.
  12. On the Specify Characteristics page the first combobox already has the COOKBOOK project selected, open the second one labeled Choose a delivery type and pick Cube Refresh. Hit Next.
  13. On the Choose Reports/Documents page, browse to My Personal Objects | My Reports and move 54 ResellerSales Cube to the right of the shopping cart, and click on Next.
  14. The Schedule combobox should already be set to Every day at 3AM, Next.
  15. Hit Next again and click on Finish, the subscription is ready to trigger; every morning at 3 A.M. the cube 54 will be refreshed.

How it works...

The time—trigger works with the system clock of the Intelligence Server. In case you work for an international company across several time zones, plan your schedules carefully to make sure the cubes are refreshed at times when no one is using them.

It has happened to me more than once that the data got refreshed one hour later due to daylight saving time in summer; I discovered the hard way how to explain to an Oracle server that in most European countries we move the clock one hour ahead from spring to autumn in order to save energy and bring misery to ETL jobs.

There's more...

Cubes can be published based on a schedule or manually. The amount of memory needed to publish a cube is approximately double the size of the cube itself. This is another good reason for updating them when the load on the Intelligence Server is very low.

Note

You can watch a screencast of this operation at:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset