Category Archives: Rittman Mead
Real World OBIEE: Demystification of Variables Pt. 1
OBIEE has some very powerful features and capabilities when it comes to how we visualize and present our data. There are some features which almost everyone uses (filters, prompts, rename columns ect.) and then some that are less common. In part, I think there is a lot of "noise" that surrounds the explanation of some of these features. Another reason, and probably the most likely, is that a lot of report developers may just don't know that they exist. I can't tell you how many times in one of our training courses here at Rittman Mead that someone says "wow, I didn't know I could do that!" or that I get asked, "could you explain how Presentation Variables work?". Now, I am not saying that there is anything wrong with not knowing or being confused when it comes to some of the features in OBIEE. In fact, it's my main purpose in writing this blog series! I want to demystify and show you some of the features and techniques I have used with almost every client I have worked with. Even if you are a seasoned veteran, my goal is to present something in a way that you haven't heard before and spark some ideas in your day-to-day development. So with all of that said, let's dive into part one of the Demystification of Variables.
For the first part of this series, I want to talk about using Bins and Presentation Variables together at a report level and also in dashboard prompts. Before we dive into an example, let me talk a little bit about bins and presentation variables.
Bins
Sometimes we need to group values differently than what we have available from our column selection. Common examples could be when we need to group products differently than product category, when we need to create a group for items on sale or, maybe the most common I've seen, when we need to create custom groups for certain values and then have a group for the "others". Creating custom groups can be accomplished in a few different ways (selection steps, add new group from the Results tab), but the way I'm going to show you involves using the Bins tab under Edit formula within a column. I'll go over this process shortly when we dive into the example.
Presentation Variables
These are one of the most powerful features in Answers. They are also one of the things that trip people up the most. Think of presentation variables like placeholders and these placeholders are waiting for a value or a group of values to be passed into them. There are really only three parts to the presentation variables we will look at in this example: First you assign the presentation variable (give it a name) in a prompt to pass the value or group of values selected into the second part. The second part is where the placeholder (presentation variable with the same name) is put in a column formula, column heading, text object etc. The third part is called formatting. Formatting is used when you need to apply a certain format to the values coming into the presentation variable placeholder. There are a massive amount of use cases for presentation variables but I am going to cover only a couple of the ones that I've used the most.
Make sense? If you're still a little confused or hearing about this for the first time, don't worry. We are going to go through an example that I hope will explain the uses of Bins and Presentation Variables in a way that is concise and clear.
Now, lets dive into the example.
The Scenario
In this example, I am going to work through a hypothetical situation where I am the front-end developer for a coffee shop and I've been asked to create a report for an executive dashboard. The report needs to include Gross Revenue, Net Revenue and # of Orders for the current date for six groups of products (Breakfast Foods, Coffee, Coffee Beans, Tea, Tea Bags and Other) and five location groups which contain all the stores located in four states (California, Massachusetts, District of Columbia, New York and Others). The report needs to be in a table view and the person that requested this report also wants the ability to switch between the two columns for product groups and location groups. They also want a dashboard prompt for selecting from one or more groups for each column.
The Example
Let's start by tackling the custom groups. Since both groups are going to be created from the lowest level of detail for both products and locations, we need to bring in both Product Name and Shop Name columns and also our measures.
Note: For all of the examples in this blog series I am using OBIEE 12.2.1.2
I can click on column properties > Edit Formula then click on the Bins tab to start creating my groups.
In the Bins tab, I can click on Add Bin to start creating my first group.
Once I click on Add Bin, I am presented with a New Filter window. The process of creating a new group (or bin) is exactly the same as creating a column filter. I can type the values individually, separated by ; or I can click on the search icon to add values manually. In this case, I am going to add them manually.
Once in the Select Values window, I am going to select all of the products that belong in the first group (Breakfast Foods).
Note: In this scenario, the person has given me a list of all the products and stores that they want in each group
Once I'm done adding all the items, clicking OK will take me to the Edit Bin Name window where I can give my new group (or Bin) a custom name.
Since the person who requested the report probably wants the Others group to be last, I am going to add numerical values to each group. This will give me the flexibility to order columns any way that I choose. After I’m done creating all my Bins, there is a checkbox at the bottom of the Bins window where I can create a custom bin for all other values.
Clicking OK will return me to the Criteria where I can view the formula that OBIEE generated for all of my selections.
When using Bins, OBIEE generates a custom Case statement for us. At a high level, a Case statement takes a set of conditions and executes a corresponding statement. In other words, when the Product Name column has these values, put them all together an call them THIS.
If I go to Results, I can see the Bins I just created.
Now I can return to the Criteria to create the groups for the stores. Upon completion, here is the formula for the Locations:
And the result:
Now I need to come up with a way to be able to switch between the Product and Location columns I just created. There are a couple of options. Since i'm using OBIEE 12c, I can save both the Products and Locations columns to the web catalog and simply create a column selector just like I would do for any of the columns within a subject area.
There are two problems with this method. One is that the Save Column As feature is only available from OBIEE 11.1.1.9 forward so, if you are still on 11.1.1.7 or earlier, this method won't work. The second problem is that the request is not just for swapping the Product and Location columns with a prompt but also being able to select individual values for each column with a prompt. To avoid confusion, we probably want the prompt values for each column to change dynamically depending on which column is selected. To accomplish this I am going to use a second method which requires me to do the following:
Combine the case statements for both Products and Locations column formulas
Insert two additional case statements along with presentation variables to allow me to switch between the two.
Create a filter for the combined column with a presentation variable to allow me to use prompted values.
Create a variable type dashboard prompt to select between the Product and Locations independently.
Create a dashboard prompt that dynamically changes between the value selections for the Products and Locations.
I'm going to start with the first two steps since they require editing the same column formula.
I am going to create a new column and copy both my Products and Locations column formulas into the new column's edit formula window and, to make it easier to edit and insert the two additional case statements, I am going to put a blank line between them.
Now I need to put in my two additional case statements with presentation variables so that I can switch between the two. The syntax and naming convention I am going to use is as follows:
CASE WHEN @{pv_select}['@']{'Products'} = 'Products' THEN [Products Case Statment]
CASE WHEN @{pv_select}['@']{'Products'} = 'Location' THEN [Locations Case Statment]
Let me take a moment to examine and explain the presentation variable I'm using.
The syntax for putting a presentation variable in a column formula, column heading or text object is as follows:
@{presentation_variable_name}[formatting]{default_value}
Note: I am going to use the presentation variable name (pv_select) in my variable prompt later in this example
The default value I have defined (Products) is an optional step that is primarily used for when I want to view my report without any values being passed into the presentation variable. The default value is used when no value has been passed into the presentation variable.
Notice that I have also included formatting between the presentation variable name and the default value (['@']). The reason for this is because the prompt values (which will be defined as Products and Locations in the variable prompt I will create) are a string (text) datatype and I have to explicitly define the format I need for the presentation variable value or I will get an error. You have to define formatting using single brackets [] and then encapsulate the @ character with the formatting you need applied to the presentation variable value. Think of the @ character as a sort of shorthand or an abbreviation for the presentation variable itself.
Note: I could enclose my presentation variable in single quotes to achieve the same results in this senario ('@{pv_select}{Products}').
So, to explain the entire statement another way:
CASE WHEN the value of the presentation variable coming from the prompt is equal to 'Products', THEN then use the CASE statment for the product groups
CASE WHEN the value of the presentation variable coming from the prompt is equal to 'Location', THEN then use the CASE statment for the location groups
My new column formula is as follows:
CASE WHEN @{pv_select}['@']{Products} = 'Products' THEN
CASE WHEN "Sales - Fact Sales"."Products"."Product Name" IN ('All Butter Croissant','Almond Croissant','Banana and Walnut Muffin','Blueberry Muffin','Caramel Shortbread','Chocolate Chip Muffin','Lemon Drizzle Muffin','Maple Pecan Danish') THEN '1. Breakfast Foods' WHEN "Sales - Fact Sales"."Products"."Product Name" IN ('Americano','Caramel Hot Cocoa','Classic Hot Cocoa','Dark Hot Cocoa','Expresso','Filter Coffee','Iced Caramel Latte','Iced Cocoa','Iced Latte','Iced Mocha','Latte','Macchiato','Mocha','Pain Au Chocolat','Vanilla Hot Cocoa','White Hot Cocoa') THEN '2. Coffee' WHEN "Sales - Fact Sales"."Products"."Product Name" IN ('Arabica Beans','Arabica Ground','Robustica Beans','Robustica Ground','GCBC Special Blend Instant') THEN '3. Coffee Beans' WHEN "Sales - Fact Sales"."Products"."Product Name" IN ('Chai Tea','Chamomile Tea','Earl Grey Tea','Fresh Mint Tea','Jasmine Tea','Spearmint Tea') THEN '4. Tea' WHEN "Sales - Fact Sales"."Products"."Product Name" IN ('Chamomile Tea Bags','Chai Tea Bags','Earl Grey Tea Bags','English Breakfast Tea Bags','Fresh Mint Tea Bags','Jasmine Tea Bags','Spearmint Tea Bags') THEN '5. Tea Bags' ELSE '6. Other' END
WHEN @{pv_select}['@']{'Products'} = 'Location' THEN
CASE WHEN "Shops"."Shop Name" IN ('SF1 - Fisherman''s Wharf', 'SF2 - South Beach', 'SJ1 - First Street Corridor', 'SV1 - Mountain View') THEN '1. California' WHEN "Shops"."Shop Name" IN ('BO1 - Financial District', 'BO2 - Atlantic Wharf', 'BO3 - Back Bay', 'CA2 - Harvard Square') THEN '2. Massachusetts' WHEN "Shops"."Shop Name" IN ('DC1 - Central Business District', 'DC2 - Dupont Circle') THEN '3. District of Columbia' WHEN "Shops"."Shop Name" IN ('NY1 - Times Square', 'NY2 - Fifth Avenue') THEN '4. New York' ELSE '5. Others' END
ELSE 'Other' END*
I am also going to use the presentation variable in the column heading so that when I make my selection in the prompt, the column heading will reflect the selection as well.
If I go to my results, notice how only the Products column is showing due to the default value I set when defining my presentation variable.
If I go back to my column formula and change the default value to be Location instead of Products, the column values will change to the ones defined in my Locations case statment.
In order for the report to be filtered for individual values, I need to create a filter using a presentation variable. To do this I am going to create a filter for the column I used to define all of my groups and, instead of selecting a value, I am going to put in a new presentation variable which I will define later when I create the dashboard prompt for the values.
I am going to name my new presentation variable pv_select_value.
When a Presentation Variable is added to the filter, two new text boxes appear. The Variable Expr box is where you define the variable to be used and the (default) box is used to add a default value. Notice how I am not using the syntax @{presentation_variable_name}. When defining a presentation variable using the presentation variable option in a filter or in a prompt, you only have to define the name. Once I click ok, OBIEE will insert the proper syntax for me. The default value is optional but, when defining a Presentation Variable within a filter, you have to specify a default value in order to get any results within the analysis. If I run the report with just a presentation variable defined with no default value, I will get the error shown below:
This is because, when the report is run, the query issued is trying to use the value of the presentation variable. Since there is no default value specified, it is trying to use the presentation variable name itself as a value. If I specify a default value or a list of default values, the report will use those values in the absence of a value or values in the presentation variable. Because I want all of the values to be shown initially on the dashboard, I am going to use the Convert this filter to SQL option and input all of the values for the product group manually for the list of default values.
If I run the report with the default values specified, I get the results back for the product group.
In order for the filter to work with the column prompt I will create later in this example, it requires the [formatting] syntax to be used (@{pv_select_value}['@']{'1. Breakfast Foods', '2. Coffee', '3. Coffee Beans', '4. Tea', '5. Tea Bags', '6. Other'}) for example). This will encapsulate each value passed into the pv_select_value presentation variable with single quotes.
Now I need to add an additional filter on the same column using the same pv_select_value presentation variable. The reason for this is because I need to define each default value for the location group as well so that all of the values for location will be shown on the dashboard. To do this, I am going use the same process that I used for the product group filter.
There is one additional step that I need to do in order to make the filter work for both products and locations. When you initially create report filters, OBIEE assumes that you want to use all filters together at the same time therefore it uses 'AND' for each filter created after the initial filter.
If I run the report, I will get an error because the filter is being applied for both the products and location values. Because the case statment is defined for products and locations independently, I can not use all values in a filter at the same time.
To fix this, I need to change the operator for the location filter from 'AND' to 'OR'. I can do this by simply clicking on the 'AND' icon.
Now the report will run because only the first set of conditions for the product group filter is applied.
Now I need to create my two dashboard prompts: One for the initial selection between my two case statements for Products and Locations and one for the values.
I start by creating a new dashboard prompt and create a new Variable Prompt.
Because this is a variable prompt, I have to manually specify the values I want the user to be able to select from as well as define the presentation variable. Since I am creating the prompt for switching between the two case statements for Products and Locations, I am going to make the following selections and input the following values.
Prompt for: Presentation Variable > pv_select
User Input: Choice List
Choice List Values: Custom Values
Values: Products and Location
Default Selection: Specific Custom Value > Products
As you can see, I have defined the variable that we used in the column formula for the case statements. By defining the two custom values (Products and Location), I can select between the two case statements at will and, as far as the user is concerned, it will be just like using a column prompt within a report. Also, the default value needs to be specified for reasons I will explain when creating the next prompt for the values.
Now I am going to create a column prompt for the values.
First, I need to create a new column prompt and put in the same column formula that I used earlier in my report. I can do that by clicking on the fx icon and pasting in the column formula.
Essentially what I am doing is making the column values populate for the prompt by using the same case statement definitions and they will also change depending on the value selected in the prompt we created previously.
For the choice list of values, I can simply leave the default of All Column Values. Since the values will dynamically change depending on the initial prompt value in the variable prompt, it will only show values corresponding to each selection.
I do not need to define a default selection because I set the default values in the two filters I created in my report.
Finally, all that is left to do is define the pv_select_value presentation variable I defined for the filter of the case statement column in the report. This is how I will get all of the values to be shown for each initial prompt selection and also how I will select individual values. The default values will be passed into the filter via the pv_select_value presentation variable initially which will prompt all the values to be shown and then individual selections will be passed in the same way.
Here are the results when placed on the dashboard.
So that concludes part 1 of Demystification of Variables. Please feel free to ask questions or leave me a comment! In part 2, I am going to talk about using Repository, System and Presentation Variables to make reports dynamic for any series of time. Until next time.
New Performance Analytics Release
Poor performance is one of the most common complaints we hear upon arrival to customer sites, and often for good reason. When users have time to “make the rounds” before the system returns a result (if it returns a result at all), they have the right to be frustrated.
Unfortunately, tracking down the origins of performance issues can be extremely difficult, as the root cause could be one or more problems across several distinct systems. Without a comprehensive view of the complete technology stack, an administrator will effectively be guessing.
But we are all in the business of analytics. We should be taking an analytical approach to drive our decisions, and provide evidence to support them. Performance data should be collected, investigated, and then acted upon. But an analytical approach raises two distinct questions, “What data can we collect that will help us identify performance issues, and once found, what actions can we take”?
Enter Performance Analytics
Performance Analytics is an application that collects data from all layers of the stack in your environment, and makes it readily available for study and investigation. By collecting data from OBIEE Usage Tracking, operating system metrics, database sessions, and a myriad of other sources, our application provides administrators with an all-encompassing view of their system. It has never been easier to identify the causes of poor performance.
However, simply identifying a cause of poor performance isn’t all that’s required. In fact, it’s almost useless without knowing how to resolve the issue. Rittman Mead has expertise ranging from databases and data warehouses to front end browser applications, and everything in between. Our team will help you understand the problems discovered by Performance Analytics and show you how to fix them.
With the newest release of Performance Analytics, improving the performance of your BI ecosystem is easier than ever. No longer will your users sit around waiting for reports, no longer will you need to guess at configuration settings, and no longer will you be left with no leads to investigate when users desire a better experience.
New Features
Simple and Lightweight Installation
Performance Analytics is now deployed using Docker, requiring absolutely no software installation on any machine other than the monitoring server.
Upgraded and enhanced software.
The open source technologies included in Performance Analytics have come a long way since its inception, and this release provides their latest and greatest versions, as well as our own improvements that increase performance and reliability.
Alerts and Notifications.
Receive notifications based on failed OBIEE system components, a violated performance threshold, or any other identifiable condition found in your data. Be made aware of adverse performance conditions the instant they occur.
And many more...
Learn More
We will be releasing more exciting news about Performance Analytics over the following weeks, so be sure to subscribe to our blog and newsletter to stay up to date!
Visit our Performance Analytics page here.
To request a demo or ask any questions about Performance Analytics, call or email us:
P (US): (888) 631-1410
E (US): info@rittmanmead.com
|
P (UK): +44 (0) 1273 911 268
E (UK): info@rittmanmead.com
|
OBIEE 11.1.1.7: Is It Still Supported?
Last week, during a quiet working morning, my colleague Robin Moffatt sent me a link that changed my working focus for few hours.
The link was to "OBIEE 11g: Required and Recommended Bundle Patches and Patch Sets (Doc ID 1488475.1)", a document containing the latest bundle patch (patch set) available for every major OBIEE release.
He spotted that for the first time, the new bundle patch released on 17 Jan 2017 was for OBIEE 11.1.1.9 only, with the latest patch for 11.1.1.7 being the one previously released on 18 Oct 2016.
Moreover there is a clear statement in the document saying that is necessary to be at least on the 11.1.1.7.151020 patch-set or upgrade to 11.1.1.9 (or 12c) in order to receive continued Error Correction Support.
Questions became then naturally:
- Is OBIEE 11.1.1.7 still fully supported?
- What is Error Correction Support?
- How does Oracle Support Work?
- How can I verify if my software is supported and when the support ends?
With those questions in mind, I started my wonderful journey in understanding the Oracle support, if you want be my guests then sit down, take a coffee (espresso please) and enjoy the trip.
Understanding OBIEE Oracle Support
Disclaimer: All the information and date mentioned in the post reflect the situation as of the post publication date, Oracle may change them in future. Oracle support documents mentioned in this post should be directly taken as reference. The documents linked below are mostly regarding OBIEE, for other products please visit Oracle's support website.
Understanding Oracle's support requires patience and the right set of documents, with the main two being:
- Lifetime Support Policy: provides the announcements, dates and exceptions for the end of Premier, Extended and Sustaining Support. The detail of the Lifetime Support Policy is by product e.g OBIEE 11.1.1.*.
- Error Correction Support Policy: provides details regarding the end of bug correction support per single release (e.g. 11.1.1.7). For OBIEE 12c the Error Correction Support document is merged in the Fusion Middleware document.
The combined information contained in these two sources should be used to determine the status of a specific Oracle's software version.
Oracle's Support Phases
The two documents listed above provide a good starting point, but what do "Premier", "Extended", "Sustaining" and "Error Correction" Support mean?
Doc ID 1664916.1 and Lifetime Support Policy page provide a detailed explanation.
The "Lifetime Support Policy" defines the three main phases for each product (e.g. OBI 11g):
- Premier Support: is in the first 5 years (however this timeframe could be changed) from General Availability of a product, during this period bundle patches are released providing error correction and new features with certification for most Oracle or third party support.
- Extended Support: almost all the benefits of Premier Support can be extended by another three years after its end with an additional fee.
- Sustaining Support: after the end of Premier Support, this option (requiring an additional fee) provides a limited support on existing product bugs but no new developments (e.g. a certified mechanism of connecting OBIEE 10g to Impala); can be extended for an unlimited amount of time.
The first two phases are also considered Error Correction Support since are the only two where new bug/security related patches are provided. After the end of Error Correction Phase no more patches will be released for a certain product.
Applying the Lifetime Support Policy to OBIEE 11.1.1.* based on Oracle's documentation the following is obtained.
As mentioned before, this is a guideline for the whole OBIEE 11.1.1.* set of products, so how can I determine the end of support for a certain release?
Usually the answer to this question is defined by
- The end of the Premier/Extended Support if the release you're checking is the latest available of a product
- The end of the release's Grace period: if a newer release is available. The grace period, mentioned in Doc ID 944866.1 is the period of time (usually one year) following the release of a patch set in which Oracle provides fixes for both the new and previous patch set. The grace period is calculated based on the availability of the following release. E.g. since OBIEE 11.1.1.1.9 was released in May 2015, the grace period for 11.1.1.7 should be ended in May 2016. There are however exceptions where the grace period and related error correction support is extented, like for the 11.1.1.7 which now is extended until December 2018 as per OBIEE Error Correction Support document.
The following graph shows the error correction support phases for OBIEE 11.1.1.7.
What Does This Mean For OBIEE 11.1.1.7?
As stated above OBIEE 11.1.1.7 is still in its grace period meaning that bundle patches and security fixes will still be released when needed until Dec-2018.
Is OBIEE 11.1.1.7 Still The Right Choice?
If all you need is support for your existing and working environment having the latest bundle patch, then yes, you're fine and you'll be until December 2018.
But we all know how long an upgrade takes from planning to the actual execution and testing. Probably you don't want to wait until the end of next year having to rush for the upgrade because your system is getting out of support.
We at Rittman Mead are in favour of a smart upgrade planning and with our fixed cost upgrade process can take care of it while you keep focusing on what matters in your company.
Upgrading
As suggested by Oracle's document there are two options: migrate to the latest 11g release (11.1.1.9) or 12c. Both are valid options - 11.1.1.9 has another few years of premier support, with end of error correction support targeted for Dec-2021 as stated in Oracle's Doc 1664916.1.
If you are opting for the migration, choosing the target release should be based on the features you aim to get and the version stability plan: some options like Visual Analyzer, Advanced Analytics, and Data Mashups are only available on 12c which is the version currently developed, while 11g is on its way out. These points are discussed in more detail below.
Upgrading to OBIEE 11.1.1.9
The migration to 11.1.1.9 might seem easier and it could be done in-place. However it still requires database schema changes, moreover an in-place upgrade has associated risk of having unavailable live environments until all issues are fixed; risk that can be mitigated with an out-of-place upgrade.
You can find a list of 11.1.1.9 new features for end users and system admins in our blog.
Finally, if you migrate to 11.1.1.9, the end of its error correction support in Dec-2021 forces the next milestone in your upgrade path.
Upgrading to OBIEE 12c
On the other hand the migration to OBIEE 12c (with the 12.2.1.2.0 being the latest available as of now) is completely an out-of-place process. There is a requirement on the source 11g version meaning that if you are currently on a pre-11.1.1.7 version, you'll first need to perform a migration to 11.1.1.7 or 11.1.1.9 and then to 12c.
The upgrade process is smooth, with a dedicated upgrade tool taking care of moving the catalog, RPD and part of the security and a Baseline Validation Tool helping in automating the testing.
OBIEE 12c includes several new features with new connectors to big data world that will increase over time and the new options like Visual Analyzer and Data Mashup providing great functionalities directly in the hands of end users.
Check out our 12c migration case study presented at UKOUG!
Rittman Mead Can Help!
Unsure about the support status of your current system and the risks related? With our experience we can help you plan a migration roadmap!
A migration is not a quick process, it needs to be understood and planned correctly, the following are just some examples of our pre-migration activities with clients.
Worried about migrating?
We can advice about best installation/migration processes and the benefits of such upgrades. We can also help you implementing the processes during the migration phase.
Unsure about server capacity?
We can help estimating server sizing based on the number of active users and the enabled features. Our Performance Analytics Service can help understanding and solving bottlenecks.
Unsure about impact on BAU activities?
Our migration approach reduces the Code Freeze time to a minimum; the time to swap between versions in the production environment can also be minimised.
Uncertain about timings?
We can help you estimating effort and plans for a successful upgrade based on our experience.
Once the migration in planned, we can implement it for you or assist and support your team! Let us help you!
Getting Apex 4.2 Up and Running on Oracle 12c Using PL/SQL Gateway
Recently I was asked to create a simple Master-Detail Apex form on top of some metadata tables stored within Oracle 12c. Apex version 4.2 is already pre-installed in 12c but it needs configuring to be able to use. This is where I hit some trouble which stems from a conflict of information across a number of different sources.
I was following the Oracle certified documentation on 4.2 and how to get it running on 12c specifically but it wouldn't work. Time after time I kept getting 'Error 404' messages whenever I tried accessing Apex through the browser. I gave up on the Oracle documentation and decided to scout out some blogs but they were virtually copy and paste and resulted in the same error messages. I asked colleagues at work and also joined the Apex slack domain but nobody quite understood why it wasn't working.
It seemed like a lost cause, until I decided to check the later versions of the Oracle documentation and came across an extra piece of information from an Apex 5.0 document:
Procedures CREATE_ACL, ASSIGN_ACL, ADD_PRIVILEGE and CHECK_PRIVILEGE in DBMS_NETWORK_ACL_ADMIN are deprecated in Oracle Database 12c. Oracle recommends using APPEND_HOST_ACE instead.
Given that 12c comes with Apex 4.2, I was surprised to find it not mentioned anywhere else but in the Apex 5.0 documentation.
So the intention for this blog entry, is to bring together all the information that is needed to get Apex 4.2 using PL/SQL Gateway on Oracle 12c so you're able to take a quick and easy look at what it can offer.
Steps to configure the PL/SQL Gateway on Oracle 12c
Change your working directory where Apex is installed:
cd $ORACLE_HOME/apex
Connect to SQL*Plus with a user with SYS privileges:
sqlplus / as sysdba
Switch containers to the pluggable database container:
ALTER SESSION SET CONTAINER = <PDB_NAME>;
Run the
apex_epg_config.sql
script along with the$ORACLE_HOME
:@apex_epg_config.sql /u01/app/oracle/product/12.1.0/dbhome_1/
Log back into SQL*Plus from the Apex directory if you get logged out
Then unlock the ANONYMOUS user within the Root Container:
ALTER SESSION SET CONTAINER = CDB$ROOT; ALTER USER ANONYMOUS ACCOUNT UNLOCK;
Switch to the pluggable database container and run
apxconf.sql
:ALTER SESSION SET CONTAINER = <PDB_NAME>; @apxconf.sql;
When prompted change the ADMIN password and assign a port for APEX to connect to - Default is 8080.
Verify the Oracle XDB Protocol Server Port that was set after running the apxconf.sql script:
ALTER SESSION SET CONTAINER = <PDB_NAME>; SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;
If it returns with [0] then enable the XDB Server
EXEC DBMS_XDB.SETHTTPPORT(port); COMMIT;
Enable the Network Services in Oracle Database 12c - This will be disabled by default. This following will give access to all hosts:
BEGIN DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE (host => '*', ace => xs$ace_type(privilege_list => xs$name_list('connect'), principal_name => 'apex_040200', principal_type => xs_acl.ptype_db)); END; /
NOTE: If you require stricter security add the host name after the host parameter e.g.
host => 'localhost'
Open your browser and connect to Apex:
http://hostname:8080/apex
Summary
This blog has given you the guidelines for getting Apex 4.2, that comes pre-installed on Oracle 12c, up and running.
Note that 4.2 is now quite dated and it is recommended to upgrade to Apex 5. This ensures continued support from Oracle, and access to newer and more efficient features.
Data Preparation for “Analyse Elections with Oracle Data Visualisation Desktop”
In the previous post I wrote about some interesting insights we can get from the elections data. And this post concentrates on the data preparation for it. As the first one, it doesn't work as a guide and aimed to show some data manipulation things end-user can do without IT department and coding. As data preparation is not absolutely needed for the understanding of the visual part but still a piece of the story it was extracted as a separate post.
The Data
From the logical point of view I have two datasets.
- Voting results by election commissions: number of votes for every political party and a lot of technical measures like number of registered voters, number of good and damaged voting ballots and so on.
- Turnout figures at given times throughout the day.
From the physical point of view, both datasets are big files (about 500 Mb combined) each line of which is a single record. These records represent information at various levels of aggregation. I will use this fact to show some of Data flows features (great introduction from Francesco Tisiot).
Generally, each record is a JSON which looks like this:
{
[...]
"Data":{
"1 | Number of voters included in the voters list at the time of the end of voting":"102",
"2 | The number of ballots received by the precinct election commission":"102",
"3 | The number of ballots issued to voters who voted early":"0",
[...]
"19 | 1 Russian political party 'Rodina'":"0",
"20 | 2 Political party 'COMMUNISTS COMMUNIST PARTY OF RUSSIA'":"3",
"21 | 3 Political party 'Russian Party of Pensioners for Justice'":"0",
[...]
},
"Loc":[
"Nizhny Novgorod Region",
"129 Nizhny Novgorod Region - Nizhny Novgorod",
"28 Krasnooktyabrskaya",
"PEC #1148"
]
}
You can find a full sample of the JSON here.
Data
part is a set of 32 measures and Loc
is an array of one to four elements. The more detailed the record, the more elements in Loc
array.
The whole votes dataset is slightly smaller than 100'000 of records. As I said, records have various levels of aggregation, and this sample shows the most detailed data (its Loc
has four elements). Nizhny Novgorod Region
is obviously the region, 129 Nizhny Novgorod Oblast - Nizhny Novgorod
is a concatenation of district electoral commission number (129
), region name (Nizhny Novgorod Region
) and district electoral commission name (Nizhny Novgorod
). 28 Krasnooktyabrskaya
is number and name of a territorial election commission, and PEC #1148
is precinct electoral commission. For the most aggregated records Loc
looks like:
"Loc":[
"DEC #129"
]
This is an aggregated data for a district election commission #129.
Unfortunately, DVD doesn't work with JSON
format directly. As one of the possibilities, we can use Apache Drill (for more information see previous posts by Francesco Tisiot and Robin Moffatt). Apache Drill is a supported option for Oracle DV, but it isn't an end-user tool and the story is not about building a complete and reusable system. It is about the storytelling. So I did a one-time manual conversion using Excel magic and got a plain table.
The second part of the data is turnout. In JSON
form it's basically the same: one record per line, Data
part with four values and Loc
part based on the same principles. Data
is significantly smaller and has only four values - turnout
at four fixed moments. But here I need it in a more dimesional form. I want time as a dimension rather than pivoted.
In my opinion, pivot/unpivot is one more highly desired feature DVD needs. We can live without it in tools like OBIEE because its models aren't built on rapidly changing user-generated data structures, but for desktop data exploration tools like DVD powerful data transformation capabilities are crucial.
But while it isn't implemented, I made unpivot in Excel and got this.
It wasn't obvious that I need in in this particular form in the beginning of data preparation stage, but the good news is both visualisation and data manipulation live in one product, and in reality I was able to build charts, understand that I need more data/attributes/etc, add them and go back to analysis. Very smooth and clean.
I Thought We Weren’t Supposed to Use Excel?
While Data flows DVD feature is powerful and very useful there are some data manipulation tasks that Excel can do just easier or better than DVD. I hope that Oracle will improve Data flows over time but right now it’s not perfect.
I used Excel for the following:
- Splitting of long strings into fields. I could do it using
locate
+substring
+left
+right
functions in DVD. But that would produce unreadable code. ExcelText to columns
tool is a weapon of choice so far. UNION
. When I need to combine two datasets into one, Excel’s copy and paste are beyond competition. Adding set operations (not onlyunion
) will greatly improve Oracle’s tool.- A few technical tasks like translating the data. Initially, the data was not in English and I had to translate it. I could use both Excel and DVD for this task but chose Excel in order to simplify the post. But if I did it in DVD, it would be just a few more joins. Can't say what is simpler, so no clear winner here.
Note: I'm talking about static data sets. In case of a changing data that may be not true.
Data Transformations in DVD
While I was able to (had to) make some of the data preparation in Excel, it's better and easier to do some tasks in DVD using relatively new Data flows
feature. I will start with building a clean dictionary of electoral commissions.
When I finished my Excel part, I got this:
It isn't so bad, but I can make it better in a few minutes. I want to rename Location1
into Subject
, split Location2
into DEC #129
and Nizhny Novgorod
, remove leading digits from Location3
and rename it to TEC name
, and also rename Location4
into PEC #
.
Here is the data flow which does it. It may not look like the simplest thing in the world, but I spent about the same time building it as you spent reading what it does.
The second thing I want to do is to split my wide file with 32 measures into two. One for party results and another one for other let's say "technical" measures like number of voters, ballots and so on. It's not absolutely necessary but will please me and anyone else who will see it. Both data flows for this task use Commissions dictionary I made earlier and the same source file. I filter the source to get only the most detailed data, join with commissions, select only interesting columns and save the result. Simple and straightforward. The only difference is sets of selected columns.
I could start building visualisations with this data, but I'd prefer to calculate some relative measures. Absolute numbers won't help me because every commission has its own number of voters. We can't compare them directly but relative measures will do the trick.
Data flow for these calculations is the simplest of all.
The only not immediately obvious part is why I placed two consequential Add columns
steps. The first one calculates Total votes
column as a sum of votes for all parties and the second one uses this column for calculation of a percentage.
And it is really cool how we can use results of different flows. I took Protocols, made Commisions, joined Protocols and Commisions and got Votes data and later made calculations based on Votes data. That was very cool.
And here I want to show how the autocomplete feature in formulas editor works (because I really like it). I hope to see it on OBIEE one day.
I have one more data flow for the turnout data, but it simply joins source file with the dictionary of commissions.
Summary
I believe Oracle DVD is a very powerful tool for a data analyst. While many users prefer to stick with Excel exclusively, DVD can significantly increase their data preparation and transformation capabilities. Even now at the very beginning of its journey DVD allows making many data manipulation operations fast and easy. It obviously worth give it a try and include into a data analysis process. Look how the data from this post may be used for analysis and making interesting conclusions: Analyse Elections with Oracle Data Visualisation Desktop.