OBI Workshop 1

  • Upload
    svenom

  • View
    281

  • Download
    0

Embed Size (px)

Citation preview

ORACLE BUSINESS INTELLIGENCE WORKSHOP Prerequisites for Oracle BI Workshop

Introduction....................................................................................................................2 Hardware Requirements.................................................................................................2 Minimum Hardware configuration: ...........................................................................2 Software Requirements..................................................................................................2 Virtual Machine: Runtime .........................................................................................2 Virtual Machine: Content ..........................................................................................3 Client Software ..........................................................................................................3 Oracle BI Client Tools:..........................................................................................3 Freeware local Mail server: ...................................................................................3 Java SDK ...............................................................................................................3 Oracle ODBC Driver .............................................................................................3 Installation steps for the Client Software.......................................................................6 Installation of BI EE Client software.........................................................................6 Installation Oracle ODBC Driver ............................................................................11 Installation of ArGoSoft Mail Server ......................................................................12

1

IntroductionThis document describes all necessary prerequisites for the attendees of the Oracle BI Hands-On workshops, held across Europe in June 2007. Please read all steps carefully and follow the instructions.

Hardware RequirementsDuring the Workshop you will copy a virtual Machine with installed Servers (Oracle Database, Oracle BI in an Linux Operating System) on your Machine. The virtual Machines require a lot of disk space and RAM in order to perform accurately. Additionally you will install Client software on your local Machine that will consume some disk space and RAM as well. Minimum Hardware configuration: Min. 1.5 GHz CPU, preferably 2 GHz + Min. 2 GB RAM Min. 25 GB free Disk space DVD Drive Browser: Internet Explorer 5.5 or above Mozilla Firefox Swap Space: 1535 MB minimum Monitor: Configured to display at least 256 colors Use of a Mouse as pointing device is highly recommended (for lab work) Warning: if your machine wont fulfil these requirements, either the system wont run at all or incredible slow. It may not be possible to follow the Hands-On sessions.

Software RequirementsAs stated above, a VMWare virtual Machine and Client software will be used during the Workshop. The vmware image will be provided during the event; however you are required to install the emulation software in advance of arriving for the course. Virtual Machine: Runtime In order to run a virtual Machine, a runtime environment for VMWare has to be installed on your machine. Several options are possible: 1. VMWare Player (no Licence key, no purchasing required, just run preconfigured VMWare images) Youll find VMWare Player at http://www.vmware.com/products/player/ 2. VMWare Server (Registration required, Serial Key for free, create and run VMWare images) Youll find VMWare Server at http://www.vmware.com/products/server/ (please dont forget to register and remember your Licence Key) Please download one option and install it, following the instructions of the product.

2

Virtual Machine: Content The content of the virtual machine is provided by Oracle. Youll get the content when attending the training on a DVD. Please ensure enough space on your HDD to copy and unpack the DVD contents (4.5 GB packed, 15 GB unzipped). No other requirements apply in this section.

Client Software The Windows client software has to be installed prior the event. It is not necessary to configure all parts of all programs, but it will save a lot of time, if you download and install the software prior the event. Software needed: Oracle BI Client Tools: The Client Tools are not available as Stand-Alone versions, so please download the complete set of software from http://download.oracle.com/otn/nt/ias/101321/biee_windows_x86_101321_disk1.zip Freeware local Mail server: The workshops suggest a simple mail server called ArGoSoft to test email delivery and also in case a live email delivery is called for during a demo. This can be downloaded in advance of the course from: http://www.argosoft.com/rootpages/Download.aspx Java SDK If you havent got Java SDK installed, download JDK 6u1 from http://java.sun.com/javase/downloads/index.jsp Oracle ODBC Driver If you already have a local Oracle Client installed on your machine you skip this topic because you should already have an Oracle ODBC Driver on your Host machine However, if you need an Oracle ODBC Driver, you can obtain this in one of several ways. In this tutorial the Instant Client has been used. 1. Downloading Instant Client a. For installing ODBC, you need to files from OTN: the basic instant client and the ODBC libraries b. Go to the Oracle Technology Network Instant Client Homepage: http://otn.oracle.com/tech/oci/instantclient/instantclient.html

3

c. Click on Downloads:

d. Select Windows:

4

Accept the Licensing Questions and Download the Basic and ODBC package:

5

Installation steps for the Client SoftwarePlease install the Software on the Client in the following order: Installation of BI EE Client software o If necessary: install Java JDK before Installation / Configuration of an ODBC connection the database located on the VMWare

Configuration will be done after copying the VMWare image as first step during the Hands-On sessions. Installation of BI EE Client software 1. Check if you have a proper installation of Java JDK (1.5 or greater) on your machine. Look for a Java\jdk. Directory:

a. If you havent, install Java JDK from the path mentioned before. 2. Change to the directory where you have downloaded the Oracle BI software and extract it into a single directory. 3. change directory to the BI EE installation files (typically ..\Windows\Server\Oracle_Business_Intelligence):

4. Start the installation by double-clicking setup.exe. The Installation Wizard will start-up:

6

5. Click Next, if you are sure to meet the requirements. 6. Specify your installation paths and check Basic:

7. Click Next

7

8. Select Oracle Business Intelligence Client Tools

9. Click Next 10. Specify a valid Java JDK installation directory:

11. Click Next

8

12. Select a Language:

13. Click Next 14. Review the Settings:

15. Click Next. The Installation will take a few minutes

9

16. The installation is complete

17. Click Next 18. Another Summary Page appears:

19. Click Next for the last page

10

20. Click Finish and restart you computer

The Installation of BI EE is now complete.

Installation Oracle ODBC Driver This section describes how to install the local ODBC Driver: 1. Extract both downloaded files to the same local directory

11

2. Run odbc_install.exe 3. Add this directory (e.g. C:\Oracle\Client) to the local Windows PATH variable 4. Add a new System Variable TNS_ADMIN and set the value to the same directory path 5. Create a new local file called tnsnames.ora in the same directory. This file will contain the connection information to the Oracle database in the VMWare.ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST= oracle2go.us.oracle.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.us.oracle.com) ) )

Your Oracle ODBC connection is now ready to be configured, as it is described in the OBE tutorial.

Installation of ArGoSoft Mail Server This section describes how to install the freeware mail server which can optionally be used to test email delivery by the BI Scheduler: Have the correct privileges to configure and install a mail server on your machine. The workshop uses a simple mail server, ArGoSoft Mail Server Freeware, for demonstration purposes only. If you do not have a mail server, follow these steps: A. You can download this freeware mail server here. B. Select the Mail Server Freeware agsmail.exe link. C. Click Save to download the module onto your local machine. D. Click Start > All Programs > Administrative Tools > Services and stop the Simple Mail Transfer Protocol Service (SMTP). Close Services. E. Navigate to the directory where you stored the downloaded freeware module and double-click the agsmail.exe icon. Follow the vendor instructions for installation. This should not take much longer than one minute as it is a very light install. F. Start the ArGoSoft Mail Server service by double-clicking the ArGOSoft Mail Server Freeware icon stored on your desktop.

12

G. Click Tools > Users on the menu bar. When the User Setup window appears, click icon. the New User H. The Add New User window appears. 1) Enter user in the User Name text box. 2) Enter Delivers User in the Real Name text box. 3) Enter user in the Password and Confirm Password text boxes. 4) Enter user@ in the Return Address text box, where is the name of your machine domain configuration.

5) Click OK. 6) Click Close. I. Click Tools > Option on the menu bar. The Options window appears. 1) On the General tab, enter in the Local Host text box.

13

2) On the Local Domains tab, enter in the available text box and click Add.

3) On the Ports tab, ensure that SMTP is set to 25 and POP3 is set to 110, both defaults. 4) Click OK. J. Launch your email client. This OBE uses MS Outlook Express. Ensure that all user properties correspond to the information annotated above. To do so, perform the 14

following steps: 1) Select Tools > Accounts on the menu bar. The Internet Accounts window appears. 2) Click Add > Mail and enter user into the Display Name text box. 3) Click Next. 4) Enter the same email address that you used above, user@, and click Next. 5) Enter the email server names, , for both Incoming and Outgoing servers, POP3 and SMTP respectively. click Next. 6) Enter user into both Account Name and Password text boxes and click Next. 7) Click Finish. Your account is setup. 8) To check the properties for user, click Tools > Accounts, select user and click Properties. The General and Servers tabs should look like the image below:

15

ORACLE BUSINESS INTELLIGENCE WORKSHOPCreating a Repository Using the Oracle Business Intelligence Administration Tool

Purpose This tutorial shows you how to use the Oracle BI EE Administration Tool to build, modify, enhance, and manage an Oracle BI repository on the BIC2G:EE 10.1.3.2 VMWare image (Linux Edition v1.0). Time to Complete: Approximately 3 hours Topics This tutorial covers the following topics: Page Prerequisites .....................................................................................................2 Building the Physical Layer of a Repository ......................................................3 Building the Business Model and Mapping Layer of a Repository...................16 Building the Presentation Layer of a Repository..............................................44 Testing and Validating a Repository................................................................46 Creating Calculation Measures .......................................................................57 Organizing the Presentation Layer ..................................................................87 Using Initialization Blocks and Variables .........................................................93 Adding Multiple Sources................................................................................110 Executing Direct Database Requests............................................................125 Using Aggregates..........................................................................................129 Creating Time Series Measures ....................................................................137 Summary .......................................................................................................147

1

OVERVIEW This tutorial shows you how to build an Oracle BI metadata repository. You learn how to import metadata from databases and other data sources, simplify and reorganize the imported metadata into a business model, and then structure the business model for presentation to users who request business intelligence information via Oracle BI user interfaces, such as Oracle BI Answers and Oracle BI Interactive Dashboards.

PrerequisitesThis tutorial is for a Windows client environment connecting to the Linux BIC2G image as a server. Instructions for installing VMWare software and client BI tools and data source drivers are found in the file Prerequisites for Oracle BI Workshop After installing VMWare and opening the BIC2G Linux image, follow these instructions to map a network drive on local client to the Linux Server: Go to http://192.168.209.134/go/setup.html and click on the Map button.

Execute the downloaded file to map the chosen drive letter (G:) to the Linux Server. Open up the mapped drive and rename the existing SH.rpd repository: Open up G:\biee\10.1.3.2\OracleBI\server\Repository in windows explorer Rename the existing SH.rpd to SH_backup.rpd

2

Building the Physical Layer of a RepositoryIn this topic you use the Oracle BI Administration Tool to build the Physical layer of a repository. The Physical layer defines the data sources to which Oracle BI Server submits queries and the relationships between physical databases and other data sources that are used to process multiple data source queries. The recommended way to populate the Physical layer is by importing metadata from databases and other data sources. The data sources can be of the same or different varieties. You can import schemas or portions of schemas from existing data sources. Additionally, you can create objects in the Physical layer manually. When you import metadata, many of the properties of the data sources are configured automatically based on the information gathered during the import process. After import, you can also define other attributes of the physical data sources, such as join relationships, that might not exist in the data source metadata. There can be one or more data sources in the Physical layer, including databases, spreadsheets, and XML documents. In this example, you import and configure tables from the sample SH schema included with the Oracle 10g database. To build the Physical layer, you perform the following steps: Create a New Repository Create an ODBC Data Source Import SH Schema Create Physical Joins

3

Create a New Repository To create a new repository, perform the following steps: 1. Open the BIC2G Process Control for Services, http://oracle2go.us.oracle.com/go/process_control/pc.html Select the checkbox next to BI Server, click on STOP.

2. Wait for the flag to turn RED. 3. Click Start > Programs > Oracle Business Intelligence > Administration to open the Oracle BI Administration Tool. 4. Click File > New to open the New Repository dialog box.

5. In the New Repository dialog box, the local Repository folder is selected by default. Browse to the Linux server repository folder in the drive mapped during the pre-requisite steps to this section: Browse to G:\biee\10.1.3.2\OracleBI\server\Repository Name the file SH.rpd.

4

6. Click Save. The new repository opens in the Administration Tool and displays three empty layers: Presentation, Business Model and Mapping, and Physical. If necessary, select Tools > Options > Show toolbar to display the toolbar.

The Physical layer is where information on physical data sources is stored. The Business Model and Mapping layer is where measurements and terms used in business are mapped to the physical data sources. The Presentation layer is where the business model is customized for presentation to the user. You can work on each layer at any stage in creating a repository, but the typical order is to create the Physical layer first, then the Business Model and Mapping layer, and then the Presentation layer. Leave the Administration Tool open.

5

Create an ODBC Data Source An ODBC data source is needed to import schema information about a data source into an Oracle BI Server repository. To create an ODBC data source for importing the SH schema information, perform the following steps: 1. Click Start > Programs > Administrative Tools > Data Sources (ODBC) to open the ODBC Data Source Administrator.

2. Click the System DSN tab and click Add.

The Create New Data Source dialog box opens.

6

3. In the Create New Data Source dialog box, select the Oracle driver.

4. Click Finish to open the Oracle ODBC Driver Configuration dialog box. 5. In the Oracle ODBC Driver Configuration dialog box, enter a Data Source Name (this can be any name), select the appropriate TNS Service Name from the drop down list (ORCL in this example), and enter SH as the User ID for the SH schema.

6. Click Test Connection to open the Oracle ODBC Driver Connect dialog box.

7

7. In the Oracle ODBC Driver Connect dialog box, enter the password SH for the SH schema and click OK.

8. You should see a "Testing Connection" message indicating the connection is successful.

9. Click OK to close the Testing Connection message. 10. Click OK to close the Oracle ODBC Driver Configuration dialog box. 11. Verify that the SH system data source is added in the ODBC Data Source Administrator and click OK to close the ODBC Data Source Administrator.

8

Import SH Schema To import the SH schema information into the repository, perform the following steps: 1. In the Oracle BI Administration Tool, click File > Import > from Database . . .

2. In the Select Data Source dialog box, select the SH ODBC DSN you created in a previous step, enter SH as the user name and password, and click OK to open the Import dialog box.

3. In the Import dialog box, locate the SH schema folder.

9

4. Expand the SH schema folder and use Ctrl + Click to select the following tables: CHANNELS, COSTS, COUNTRIES, CUSTOMERS, PRODUCTS, PROMOTIONS, SALES, TIMES

5. Verify that only the Tables and Keys checkboxes are selected, which is the default, and click the Import button. The Connection Pool dialog box opens. It is best practice to only import objects needed to support your business

10

model. However, dont worry if you import extra objects at this point. You can always delete objects later if they do not support your business model. 6. In the Connection Pool dialog box, on the General tab, verify that the call interface is set to Default (OCI 10g) and change the data source name to the appropriate tnsnames.ora entry ( ORCL in this example). Please note that this is the TNS service name, not the ODBC DSN.

7. Leave the rest of the settings as they are and click OK to close the Connection Pool dialog box. The import process starts. 8. When the Import process completes, click Close to close the Import dialog box. 9. In the Physical layer of the repository, expand the SH schema folder and verify that the correct tables are imported.

11

10. To verify connectivity, click Tools > Update All Row Counts. 11. When update all row counts completes, verify that the row counts are displayed in the Physical layer of the Administration Tool:

Create Physical Joins To create physical joins in the Physical layer of the repository, perform the following steps: 1. In the Physical layer, right-click the SH schema folder and select Physical Diagram > Object (s) and All Joins. Alternatively, you can select the SH database object and then click the Physical Diagram button on the toolbar.

12

2. In the Physical Diagram, if the tables are too big, right-click in the white space, select Zoom, and adjust the size.

3. Rearrange the tables so they are all visible in the Physical Diagram.

4. Click the New Foreign Key button on the toolbar.

5. Click the Channels table and then the Sales table. The Physical Foreign Key dialog box opens.

13

It matters which table you click first. The join is creating a one-to-many (1:N) relationship that joins the key column in the first table to a foreign key column in the second table. The Administration Tool makes a best "guess" and automatically determines which columns should be included in the join. Make sure the join expression is: CHANNELS.CHANNEL_ID = SALES.CHANNEL_ID 6. Click OK to close the Physical Foreign Key dialog box. The join between Channels and Sales is displayed in the Physical Diagram.

7. Continue to create the following joins:

14

PROMOTIONS.PROMO_ID = SALES.PROMO_ID TIMES.TIME_ID = SALES.TIME_ID PRODUCTS.PROD_ID = SALES.PROD_ID CUSTOMERS.CUST_ID = SALES.CUST_ID COUNTRIES.COUNTRY_ID = CUSTOMERS.COUNTRY_ID Note that Countries joins to Customers and Costs in not joined for now. All other tables join directly to Sales.

When you are finished, click the X in the upper right corner to close the Physical Diagram. 8. Select File > Save or click the Save button on the toolbar to save the repository. 9. Click No when prompted to check global consistency. Checking Global Consistency checks for errors in the entire repository. Some of the more common checks are done in the Business Model and Mapping layer and Presentation layer. Since these layers are not defined yet, bypass this check until the other layers in the repository are built. You learn more about consistency check later in this tutorial. 10. Leave the Administration Tool and the SH repository open for the next topic. Congratulations! You have successfully created a new repository, set up an ODBC data source, imported a table schema from an external data source into the Physical layer, and defined keys and joins. In the next topic you learn how to build the Business Model and Mapping layer of a repository.

15

Building the Business Model and Mapping Layer of a RepositoryIn this topic you use the Oracle BI Administration Tool to build the Business Model and Mapping layer of a repository. The Business Model and Mapping layer of the Administration Tool defines the business, or logical, model of the data and specifies the mappings between the business model and the Physical layer schemas. This is where the physical schemas are simplified to form the basis for the users view of the data. The Business Model and Mapping layer of the Administration Tool can contain one or more business model objects. A business model object contains the business model definitions and the mappings from logical to physical tables for the business model. The main purpose of the business model is to capture how users think about their business using their own vocabulary. The business model simplifies the physical schema and maps the users business vocabulary to physical sources. Most of the vocabulary translates into logical columns in the business model. Collections of logical columns form logical tables. Each logical column (and hence each logical table) can have one or more physical objects as sources. There are two main categories of logical tables: fact and dimension. Logical fact tables contain the measures by which an organization gauges its business operations and performance. Logical dimension tables contain the data used to qualify the facts. To build the Business Model and Mapping layer, you perform the following steps: Create a Business Model Create Logical Tables Create Logical Columns Create Logical Joins Rename Business Model Objects Delete Unnecessary Business Model Objects Build Dimension Hierarchies

16

Create a Business Model To create a new business model, perform the following steps: 1. In the Business Model and Mapping layer, right-click the white space and select New Business Model.

2. In the Business Model dialog box, name the business model SH and leave the Available for queries box unchecked. The Description edit box is used to add a comment for yourself or another developer. Leave it empty.

3. Click OK to close the Business Model dialog. The new SH business model appears in the Business Model and Mapping layer. The red symbol on the business model indicates it is not yet enabled for querying. You enable the business model for querying later after the Presentation layer is defined and the repository passes a global consistency check.

17

Create Logical Tables To create a new logical table, perform the following steps: 1. In the Business Model and Mapping layer, right-click the SH business model and select New Object > Logical Table.

2. In the Logical Table dialog box, name the table Sales Facts.

3. Click OK to close the Logical Table dialog. The Sales Facts logical table appears in the SH business model in the Business Model and Mapping layer. The Sources folder is populated in the next step when you create a logical column.

18

Create Logical Columns To create a logical column, perform the following steps: 1. In the Physical layer, expand the Sales physical table.

2. Select the column AMOUNT_SOLD.

19

3. Drag the AMOUNT_SOLD column from the Physical layer to the Sales Facts logical table in the Business Model and Mapping layer. A new AMOUNT_SOLD logical column is added to the Sales Facts logical table.

4. Expand the Sources to see the logical table source that was created automatically when you dragged the AMOUNT_SOLD column from the Physical layer. Logical table sources define the mappings from a logical table to a physical table. A logical tables Sources folder contains the logical table sources. Because you dragged a column from the Physical layer, the logical table source name, SALES, is the same name as the physical table. However, it is possible to change names in the Business Model and Mapping layer without impacting the mapping.

20

5. In the Business Model and Mapping layer, double-click the AMOUNT_SOLD logical column to open the Logical Column dialog box.

6. Click the Aggregation tab.

7. In the Default aggregation rule drop down list, select SUM.

8. Click OK to close the Logical Column dialog box. Notice that the logical column icon is changed to indicate an aggregation rule is applied.

21

Create Logical Joins To create logical joins in the business model, perform the following steps: 1. Select the following tables in the Physical layer. Select only these tables: CHANNELS, CUSTOMERS, PRODUCTS, PROMOTIONS, TIMES

2. Drag the selected tables from the Physical layer onto the SH business model folder in the Business Model and Mapping layer. This automatically creates logical tables in the Business Model and Mapping layer. Notice that each logical table has a yellow table icon. In the Business Model and Mapping layer, this indicates a fact table. Because you have not yet created the logical joins, all table icons are yellow. The icon color for dimension tables changes to white in a later step when you create logical joins.

22

3. Right-click the SH business model and select Business Model Diagram > Whole Diagram.

4. Rearrange the table icons so they are all visible. Place the Sales Facts table in the middle. Adjust the zoom factor, if desired.

5. Click the New Complex Join button in the toolbar.

6. Click the Channels table icon first and then click the Sales Facts table icon in the Logical Table Diagram window. The order is important. The second table clicked is the many side of the relationship. The Logical Join dialog box opens. Leave the default values as they are, but note which properties you can set: name, business model, tables, driving table, join type, and cardinality. Also note 23

which properties you cannot set: the join expression and the join columns. Typically, when defining logical joins, you leave the defaults as they are.

7. Do not change the default values, click OK, and verify your work in the Logical Table Diagram. Notice that the fact table, Sales Facts, is at the many end of the join:

8. Repeat the steps for the remaining tables. Your final result should look similar to the picture.

24

9. Click the X in the upper right corner to close the Logical Table Diagram. Notice that the color of the table icons for the dimension tables has changed to white in the business model. In a business model, a yellow icon indicates a fact table and a white icon indicates a dimension table. Defining the join relationships determined which tables are the logical dimension tables and which is the logical fact table. A fact table is always on the many side of a logical join. You now have a logical star schema consisting of one logical fact table, Sales Facts, and five logical dimension tables: Channels, Customers, Products, Promotions, and Times.

10. Save the SH repository. Do not check global consistency.

Rename Business Model Objects To use the Rename Wizard to rename the objects in the business model, perform the following steps: 1. Click Tools > Utilities.

25

2. In the Utilities dialog box, click Rename Wizard and then Execute.

3. In the Rename Wizard, click the Business Model and Mapping tab and select the SH business model.

4. Click the Add Hierarchy button.

5. Click Next. 6. Click Select None.

7. Check Logical Table and Logical Column.

26

8. Click Next. 9. Select All text lowercase.

10. Click Add 11. Click Change specified text. In the Find box, type an underscore. In the Replace box, type a space.

12. Click Add.

27

13. Click First letter of each word capital and click Add. 14. Click Change specified text. In the Find box, type a space and the letters Id. In the Replace With box, type a space and the letters ID. Check Case sensitive.

15. Click Add. 16. Click Next and review changes.

17. Click Finish and verify that logical tables and logical columns in the Business Model and Mapping layer are changed as expected.

28

18. Save the repository. Do not check global consistency.

29

Delete Unnecessary Business Model Objects To delete logical columns that are not needed in the business model, perform the following steps: 1. For the Channels logical table in the Business Model and Mapping layer, use Ctrl + click to select the Channel Class ID and the Channel Total ID logical columns.

2. Right-click either of the highlighted columns and select Delete to delete the columns. Alternatively, you can use the Delete key on your keyboard.

3. Click Yes to confirm the delete.

30

4. Verify that the Channels logical table now has only four logical columns.

5. Repeat the steps to delete the following logical columns in the Customers table: Cust City ID Cust State Province ID Country ID Cust Main Phone Number Cust Total ID Cust Src ID Cust Eff From Cust Eff To Cust Valid

31

6. Place the cursor over the icon to display the screenshot and verify that the Customers logical table has only the following logical columns:

7. Place the cursor over the icon to display the screenshot and repeat the steps to delete the highlighted logical columns in the Products table.

32

8. Place the cursor over the icon to display the screenshot and verify that the Products logical table has only the following logical columns:

9. Place the cursor over the icon to display the screenshot and repeat the steps to delete the highlighted logical columns in the Promotions table.

10. Place the cursor over the icon to display the screenshot and verify that the Promotions logical table has only the following logical columns:

11. Do not delete any columns in the Times table. 12. Save the repository. Do not check global consistency.

33

Build Dimension Hierarchies Dimension hierarchies introduce formal hierarchies into a business model, allowing Oracle BI Server to calculate useful measures and allowing users to drill down to more detail. In a business model, a dimension hierarchy represents a hierarchical organization of logical columns belonging to a single logical dimension table. Common dimension hierarchies used in a business model are time periods, products, customers, suppliers, and so forth. Dimension hierarchies are created in the Business Model and Mapping layer and end users do not see them in end user tools such as Oracle BI Answers or Interactive Dashboards. In each dimension hierarchy, you organize dimension attributes into hierarchical levels. These levels represent the organizational rules and reporting needs required by your business. They provide the structure that Oracle BI Server uses to drill into and across dimensions to get more detailed views of the data. Dimension hierarchy levels are used to perform aggregate navigation, configure level-based measure calculations, and determine what attributes appear when Oracle BI users drill down in their data requests. To build the Channels dimension hierarchy in the SH business model, perform the following steps: 1. Right-click the Channels logical table and select Create Dimension.

34

2. Right-click the ChannelsDim object, which was created by the action in the previous step, and select Expand All.

3. Place the cursor over the icon to display the screenshot and verify that the ChannelsDim dimension hierarchy matches the picture.

4. Right-click the Channels Detail level and select New Object > Parent Level.

5. In the Logical Level dialog box, name the logical level Class and set the

35

Number of elements at this level to 3. This number does not have to be exact. The ratio from one level to the next is more important than the absolute number. These numbers only affect which aggregate source is used (optimization, not correctness of queries).

6. Click OK to close the Logical Level dialog box. The new Class level is added to the hierarchy.

7. Right-click the Class level and select Expand All.

36

8. Drag the Channel Class column from the Channel Detail level to the Class level to associate the logical column with this level of the hierarchy.

9. Right-click Channel Class and select New Logical Level Key.

10 In the Logical Level Key dialog box, verify that Channel Class and Use for drilldown are selected. The level key defines the unique elements in each logical level. Each level key can consist of one or more columns at this level.

37

11. Click OK to close the Logical Level Key dialog box. The Channel Class column now displays with a key icon.

12. Right-click the Class level and select New Object > Parent Level.

13. In the Logical Level dialog box, name the logical level Channel Total Attribute and set the Number of elements at this level to 1.

14. Click OK to close the Logical Level dialog box. The Channel Total Attribute level is added to the hierarchy.

38

15. Right-click the Channel Total Attribute level and select Expand All.

16.. Drag the Channel Total column from the Channel Detail level to the Channel Total Attribute level.

17. Right-click Channel Total and select New Logical Level Key.

18. In the Logical Level Key dialog box, verify that Channel Total and Use for

39

drilldown are selected.

19. Click OK to close the Logical Level Key dialog box. The Channel Total column now displays with a key icon.

20. Right-click the Channel Desc column and select New Logical Level Key.

21. In the Logical Level Key dialog box, notice that Use for drilldown is selected.

40

22. Click OK to close the Logical Level Key dialog. Both Channel Desc and Channel ID display with key icons.

23. Double-click the Channels Detail level to open the Logical Level dialog box.

24. Click the Keys tab.

41

25. Click Channels Detail_Key.

26. Click the Edit button.

27. In the Logical Level Key dialog box, uncheck Use for drilldown.

28. Click OK to close the Logical Level Key dialog box. Notice that the key icons are different. Channel Desc is used for drill down Channels Detail_Key is

42

not. Later, when a user drills down in Answers or a dashboard, the default drill is to the level key that has Use for drilldown checked in the next lowest level. Based on this example, when a user drills down from the Channel Class column (the next highest level), the default is to drill down to the Channel Desc column, not the Channels Detail_Key column.

29. Click OK to close the Logical Level dialog box. 30. Place the cursor over the icon to display the screenshot and verify that the finished ChannelsDim hierarchy looks like the picture.

31. Save the repository. Do not check global consistency. 32. Optional: Build a dimension hierarchy for the Products logical table. Use the preceding steps, the screenshot, and the characteristics below as a guide. Don't worry if you cannot complete this step. In Part Two of this OBE, you use a different repository that already has the dimension hierarchies prebuilt.

The ProductsDim dimension hierarchy should have the following characteristics: For the Subcategory level, set Number of elements at this level to 43

21. For the Category level, set Number of elements at this level to 5. For the Product Total Attribute level, set Number of elements at this level to 1. For the Products Detail level, uncheck Use for drill down for Products Detail_Key (Prod ID). Check Use for drill down for all other keys in the ProductsDim hierarchy. If you complete this step, save the repository. Do not check global consistency.

Building the Presentation Layer of a RepositoryIn this topic you use the Oracle BI Administration Tool to build the Presentation layer of a repository. The Presentation layer is built after the Physical layer and Business Model and Mapping layer and adds a level of abstraction over the Business Model and Mapping layer. It is the view of the data seen by end users in client tools and applications, such as Oracle BI Answers. The Presentation layer provides a means to further simplify or customize the Business Model and Mapping layer for end users. For example, you can organize columns into catalogs and folders. Simplifying the view of the data for users makes it easier to craft queries based on users business needs because you can expose only the data that is meaningful to the users, organize the data in a way that aligns with the way users think about the data, and rename data as necessary for the set of users. You typically create Presentation layer objects by dragging objects from the Business Model and Mapping layer. Corresponding objects are automatically created in the Presentation layer. Presentation layer objects can then be renamed and reorganized. To build the Presentation layer, you perform the following steps: 1. Drag the SH business model from the Business Model and Mapping layer to the Presentation layer to create the SH catalog in the Presentation layer.

44

2. Expand the SH catalog in the Presentation layer. Notice that the tables and columns in the Presentation layer exactly match the tables and columns in the Business Model and Mapping layer. Notice also that dimension hierarchies are not displayed.

3. Save the repository. Do not check global consistency.

45

Testing and Validating a RepositoryYou have finished building the initial business model and now need to test the repository before continuing your development. You begin by checking the repository for errors using the check consistency option. You then test the repository by running queries using Oracle BI Answers. Finally, you examine the query log file to verify the SQL generated by Oracle BI Server. To test and validate a repository, you perform the following steps: Run a Consistency Check Enable Query Logging Create an empty Webcatalog to test your RPD Change the metadata files file and Start Oracle BI Services Use Oracle BI Answers to Execute Queries Use Query Log to Verify Queries

Run a Consistency Check Consistency check is a utility in the Administration Tool that checks if a repository has met certain requirements. Repositories and the business models within them must pass the consistency check before you can make business models available for queries. When a repository or business model is inconsistent, a detailed message alerts you to the nature of the inconsistency. The Consistency Check Manager displays three types of messages: Error messages indicate errors that need to be fixed to make the repository consistent. Warning messages indicate conditions that may or may not be errors, depending upon the intent of the Oracle BI Server administrator. For example, if the Administrator user has an empty password this should be addressed, but is not a requirement for a consistent repository. Best Practices messages provide information about conditions but do not indicate an inconsistency. For example, if there are physical tables with no keys defined, a best practice message is displayed. Defining keys for physical tables is best practice, but is not a requirement for a consistent repository. For each message the Consistency Check Manager identifies the message type, the object type, the object, and provides a detailed description of the message. There are options to display only selected message types, display results using

46

qualified names, check all objects in the repository, and copy the results to another file. To check consistency, you perform the following steps: 1. Select File > Check Global Consistency.

2. You should receive a message indicating that the repository is consistent and asking if you want to make it available for queries.

3. Click Yes to make the SH business model available for queries. The Consistency Check Manager displays.

47

4. If the Consistency Check Manager displays any Error messages, edit the repository to correct the inconsistencies and run the consistency check again. If you see only Warning and Best Practices messages, you can ignore the messages for now and click Close.

5. In the Business Model and Mapping layer, notice that the SH business model icon has changed to indicate the business model is now available for queries (the red circle with a line is gone).

6. Double-click the SH business model object to open the Business Model properties dialog box. Notice that Available for queries is checked.

7. Click OK to close the Business Model properties dialog box. 8. Save the repository. Click No when asked to check global consistency (you just checked it).

48

Enable Query Logging To enable query logging for the Administrator user, perform the following steps: 1. Select Manage > Security.

2. In the Security Manager, select Users in the left pane. The Administrator user appears in the right pane.

3. In the right pane, double-click Administrator. The User dialog box opens.

4. Verify that the User tab is selected. In the Password field, type Administrator and then confirm in the Confirm Password field. In the Logging level field, set the value to 2.

49

To test the repository, you need to generate some queries, retrieve the results, and examine the query log. You log query activity at the individual user level. Logging is intended for testing, debugging, and technical support. In production mode, logging is normally disabled because query logging can impact performance by producing very large log files.

5. Click OK to close the User dialog box. 6. Click Action > Close to close the Security Manager. 7. Save the repository. Do not check global consistency. 8. Select File > Close to close the repository. 9. Select File > Exit to close the Administration Tool.

50

Create an empty Webcatalog to test your RPD The end-user report objects are stored in a Web Catalog. We will create a new Web catalog to start our testing of the SH.rpd. 1. Browse to G:\biee\10.1.3.2\OracleBIData\web\catalog Create a new folder in this location called SH_Start

Change the metadata files file and Start Oracle BI Services In this step, you start the Oracle BI Server service to load the SH repository into memory. An entry in the Repository section of the initialization file NQSConfig.ini instructs Oracle BI Server to load a specific repository into memory upon startup. If Oracle BI Server detects a syntax error while loading the repository, it logs the error to the server log file (...\\OracleBI\server\Log\NQServer.log). The Linux image includes a special Process Control page that allows us to easily perform this change to the servers main metadata files through a web GUI. Modify the NQSConfig.ini only if you wish to change system settings like turning caching on. You will find instructions for doing this in the online documentation.

51

The path to the Web Catalog is stored in another initialization file called InstanceConfig.xml. The editing of this file has also been simplified on the Linux image by the Process Control page

1. Open the Process Control Page: http://oracle2go.us.oracle.com/go/process_control/pc.html Select Repository: sh.rpd and Web Catalog SH_Start Click SET

2. If the Oracle BI Server, Oracle BI Presentation Server and Oracle BI Java Host services were not started prior to making the previous change, you will need to explicitly start them. Ensure that the previous step is completed and that the files listed under each service are correct.

Check the BI Server and BI Presentation Server boxes and click Start

Wait until all the relevant flags go green

52

Use Oracle BI Answers to Execute Queries To start Oracle BI Answers and execute a query, perform the following steps: 1. Select Start > Programs > Oracle Business Intelligence > Presentation Services. 2. Log in to Oracle Business Intelligence as Administrator with password Administrator 3. Click the Answers link.

4. Click the SH subject area.

5. In the left pane, click the Customers folder to expand it. Notice that the folders and columns in Answers match the folders and column in the Presentation layer of the repository. 6. Click the Cust State Province column in the left pane to add it to the request criteria on the right.

7. Click the Sales Facts folder in the left pane to expand it.

53

8. Click the Amount Sold column to add it to the request criteria.

9. Click the Results tab.

10. By default, results are displayed in a compound layout, consisting of a title and a table view.

54

Use Query Log to Verify Queries 1. Click Settings > Administration to open the Oracle BI Presentation Services Administration Window.

2. Click the Manage Sessions link to open the Session Management window.

3. In the Session Management window, under Cursor Cache, click the View Log link for the last entry.

4. The log displays the last query executed by Administrator. The log file should look similar to the picture.

55

Locate the SQL Request section. This section contains the logical SQL issued from Answers. Locate the General Query Info section, just below the SQL Request section. This section identifies the repository, subject area, and presentation catalog from which the query was run. Locate the Sending query to database named SH section, just below the General Query Info section. This section identifies the physical data source to which Oracle BI Server is connecting and the physical SQL that was generated. The rest of the file contains information such as query status, number of rows returned, and so forth. 5. Close the query log. 6. Click Finished to close the Session Management window. 7. Click Close Window to close the Oracle Bi Presentation Services Administration window. 8. Leave Answers open. Congratulations! Up to this point you have successfully built the Physical, Business Model and Mapping, and Presentation layers of a repository, run a consistency check, and tested the repository using Oracle BI Answers. For the remainder of this OBE you enhance the repository by performing tasks such as building calculation measures, adding multiple logical table sources, building variables and initialization blocks, mapping to aggregate tables, and so forth.

56

Creating Calculation MeasuresOften, a business wants to compare values of a measure and needs a calculation to express the comparison. Oracle BI Server has a calculation engine to perform a multitude of calculations. Calculation measures allow end users to ask business questions like Show me the accounts receivable balance as of Q3 or Show me the difference between units ordered and units shipped. An Expression Builder enables you to create expressions that are similar to expressions created with SQL. In the examples in this lesson, you use the Expression Builder to create calculation measures that appear as columns to users in Answers. Users can then easily build queries using familiar terminology. There are different methods for creating calculation measures in the Administration Tool. You can use existing logical columns as objects in a formula, use physical columns as objects in a formula, or use the Calculation Wizard to automate the process. All three methods are covered in this OBE. You use physical columns for calculations that require and aggregation rule to be applied after the calculation. You use logical columns for calculation formulas that require an aggregation rule that is applied before the calculation. You can also build calculation measures in Answers. The advantages to building calculation measures in the repository is the measures are built once and can be made available to all users. The advantage of defining a logical column formula based on existing logical columns is that you only have to define it once. When you create formulas based on physical columns, you have to map for each physical source it could be derived from. To create calculation measures, you perform the following steps: Create a BI Server ODBC Connection Load a Prebuilt Repository Create a New Measure Create a Calculation Measure Using Answers Create a Calculation Measure Using Logical Columns Create a Calculation Measure Using Physical Columns Create a Calculation Measure Using the Calculation wizard

57

Create a BI Server ODBC Connection To edit the RPD while the server is running it is necessary to create a direct connection to the server rather than opening up the .rpd file on its own. The Oracle BI Server provides an ODBC API just for this purpose. This is also the way that Presentation Services connects to the mid-tier BI Server, requests being sent to the server as Logical SQL queries. To connect to this layer to modify the .rpd Online, we need to first create the necessary ODBC DSN: 1. Open Start > Control Panel > Administrative Tools > Data Sources (ODBC) 2. Click on the System DSN tab and select Add 3. Enter a suitable name for the DSN e.g. LinuxPEServer-SalesHistory Enter oracle2go for the Server

Click Next > 4. Login ID: Administrator Password: Administrator Port: 9703 Check the box Connect to the Oracle BI Server to obtain default settings

58

Click Next > 5. Change the default Catalog to SH

Click Finish 6. Hit OK to close the ODBC Administrator

59

Load a Prebuilt Repository A prebuilt repository is provided to expedite your completion of the remaining exercises in this OBE. The provided repository is similar to the repository you built in the first part of this OBE, but with the following relevant differences: Physical joins are built for the the COSTS physical table in the Physical layer. There are four additional dimension hierarchies: CustomersDim, ProductsDim, PromotionsDim, and TimesDim. To load the prebuilt repository, perform the following steps: 1. Stop the Oracle BI Server service using the Process control page: http://oracle2go.us.oracle.com/go/process_control/pc.html 2. Using Windows Explorer, navigate to G:\biee\10.1.3.2\OracleBI\server\Repository. 3. Change the name of the SH.rpd file to SH_PartOne.rpd. 4. Using Windows Explorer, navigate to the SetupFiles folder and copy the SH_PartTwo.rpd file to G:\biee\10.1.3.2\OracleBI\server\Repository. 5. Rename SH_PartTwo.rpd to SH.rpd. There is no need to update the NQSConfig.ini file, because, in an earlier step, you modified the entry in the Repository section of the initialization file to instruct Oracle BI Server to load the SH repository into memory upon startup. 6. Start the Oracle BI Server service from the process control page: http://oracle2go.us.oracle.com/go/process_control/pc.html 7. Click Start > Programs > Oracle Business Intelligence > Administration to open the Administration Tool. 8. Click File > Open > Online. 9. In the Open Online dialog box, select the LinuxPEServer-Sales History DSN you created earlier. Type Administrator in the Password field and click Open.

10 The SH repository opens in online mode.

60

.

Up to this point , all the changes you have made to the repository have been in offline mode. Now that you have a consistent repository and Oracle BI Server is running and using the repository, you can make changes to the metadata in online mode. In offline mode the relationship between the Administration Tool and the repository is like the relationship between any Windows application and a file. An application, the Administration Tool in this case, opens a file for editing, makes changes to its in-memory copy, and tells the OS to save the changed file. In online mode, the relationship is different. Oracle BI Server has already opened the repository file and the operating system has put a write-lock on the file. In this mode, Oracle BI Server can act as an agent of the Administration Tool. When the Administration Tool tells it to, Oracle BI Server sends the Administration Tool a copy of its in-memory repository. Then it listens for messages from the Administration Tool about changes, makes those changes to its in-memory copy, and, when told by the Administration Tool, tells the OS to save the changed file. When you start the Administration Tool in online mode, you pick an Oracle BI ODBC DSN that points to the repository you want to edit (i.e., the repository that is the default repository in the DSN). The Administration Tool then communicates changes to Oracle BI Server and Oracle BI Server makes the corresponding changes to its in-memory copy. Typically, you develop a repository in offline mode and use online mode for minor updates and changes. If desired, examine the structure of the provided repository before proceeding with the remaining steps in this OBE. In particular, examine the relevant differences: the physical joins for the COSTS physical table, and the four additional dimension hierarchies: CustomersDim, ProductsDim, PromotionsDim, and TimesDim. 11 To verify connectivity, click Tools > Update All Row Counts. This may take a . few minutes. 12 When Update Row Counts completes, expand the Physical layer and verify that . row counts appear for all tables and columns.

61

Notice that the objects have a red check mark. Since Oracle BI Server may be processing queries while you are editing the repository in online mode, you must check out objects before editing them. Once the objects have been edited, you check them in again. At that point the changes you made become active. When you are finished editing, you can save the changes to the repository. In this example, the Administration Tool is configured to check out objects automatically. Thus, objects were checked out automatically when you ran Update Row Counts. If you do not see the red check marks, select Tools > Options > General Tab > Check out objects automatically.

62

Create a New Measure To add a new measure to the Sales Facts table, perform the following steps: 1. In the Physical layer, navigate to COSTS > UNIT_COST.

2. Drag UNIT_COST from the Physical layer to the SALES logical table source for the Sales Facts logical table. UNIT_COST appears as a logical column in the Sales Facts logical table.

3. Right-click the UNIT_COST logical column, select Rename, and rename the column to Unit Cost. Alternatively, slowly double-click the column to make it editable.

63

4. Set the aggregation rule for the Unit Cost logical column to SUM. Hint: doubleclick the column to open the Logical Column properties dialog box and click the Aggregation tab..

5. Drag the Unit Cost logical column to the Sales Facts presentation folder.

6. Click File > Check In Changes or click the Check In Changes button on the toolbar to check in changes.

7. Click Yes when prompted to check global consistency. The Consistency Check Manager opens and displays Warnings and Best Practices messages. Review the messages.

64

8. For the purposes of this tutorial, you disable the Warnings and Best Practices messages. Click the Options tab.

9. Expand Warnings folder, select Check Features Match Default, and then click the Disable button.

If you desire, review the other Warnings items that are checked. 10 Select Best Practices > Physical Table > Search for Tables With No Keys, . and then click the Disable button.

If you desire, review the other Best Practices items that are checked. 11 Click the Messages tab. .

65

12 Click Check All Objects. The Consistency Check Manager displays with no . messages, indicating a consistent repository.

13 Click Close to close the Consistency Check Manager. . 14 Save the repository. . 15 Return to Answers to test the new column in Answers. If Answers is not open, . select Start > Programs > Oracle Business Intelligence > Presentation Server, log in as Administrator with password Administrator, click the Answers link, and click the SH subject area. 16 Click Reload Server Metadata. . 17 Build the following request: . Times.Calendar Year, Sales Facts.Amount Sold, Sales Facts.Unit Cost.

18 Click Results. .

19 Click Settings > Administration > Manage Sessions > View Log to view the . query log and examine the SQL generated by the request.

66

Create a Calculation Measure Using Answers Before you create calculation measures in the metadata using the Administration Tool, you create a calculation measure using Answers. You do this so you can compare your results later when you create similar calculations measures in the repository. To create a calculation measure using Answers, perform the following steps: 1. Click the Criteria tab. The request from the previous set of steps should still be open. 2. Add another Amount Sold column to the request.

3. Click the Edit Formula button for the Amount Sold column that you just added.

4. The Edit Column Formula dialog box displays with "Sales Facts"."Amount Sold" in the Column formula field.

5. In the Edit Column Formula dialog box, click to the right of "Sales Facts"."Amount Sold" in the Column Formula field. 6. Click the Minus operator to add it to the formula.

67

7. In the left panel, click Sales Facts > Unit Cost to add it to the formula.

8. Click the Custom Headings check box.

9. In the Custom Heading field, type Gross Profit.

10.Click OK to close the Edit Column Formula dialog box and verify the change to the request.

68

11.Click Results.

12.Click Settings > Administration > Manage Sessions > View Log to view the query log. 13.Leave Answers open for the next topic.

69

Create a Calculation Measure Using Logical Columns In this topic, you define a new calculation measure named Gross Profit in the Sales Facts logical table, using existing logical columns to define the calculation formula. To create a calculation measure using logical columns, perform the following steps. 1. 2. Return to the SH repository, which should still be open in online mode in the Administration Tool. Right-click the Sales Facts logical table and select New Object > Logical Column.

3.

In the Logical Column dialog box, name the logical column Gross Profit and check Use existing logical columns as the source.

4. 5. 6.

Click the Expression Builder button (three dots) to open the Expression builder. In the left pane, click Logical Tables. Select Sales Facts in the middle pane, Amount Sold in the right pane, and click Insert. The Amount Sold column is added to the formula.

70

7. 8.

Click the minus sign operator to add it to the formula. Double-click Unit Cost in the right pane to add it to the formula.

9.

Click OK to close the Expression Builder. Notice that the formula appears in the Logical Column dialog box.

71

10. Click OK to close the Logical Column dialog box. The Gross Profit logical column appears in the business model.

11. Drag the Gross Profit logical column to the Sales Facts table in the Presentation layer.

12. Check in changes. 13. Click Yes when prompted to check global consistency. If the repository is consistent (no Error messages), close the Consistency Check Manager. If there are Error messages, you must correct the errors before continuing. 14. Save the repository. 15. Return to Answers, which should still be open from the previous topic. 16. Click Reload Server Metadata.

72

17. Expand Sales Facts and verify that the Gross Profit column is now visible in Answers.

18. Create the following request. (If the request from the previous topic is still open, delete the Gross Profit column you created in Answers and then add the Gross Profit column you created in the repository to the query.) Times.Calendar Year Sales Facts.Amount Sold, Sales Facts.Unit Cost, Sales Facts.Gross Profit

73

19. Click Results. Verify that the results are the same as for the query you built using the Gross Profit column created in Answers.

20. Click Settings > Administration > Manage Sessions > View Log to view the query log. Your results should look similar to the picture.

Note that the difference between AMOUNT_SOLD and UNIT_COST is being calculated in the outer query block (SAWITH0.c2 - SAWITH0.c1 as c4 in the example pictured here). Because you defined the Gross Profit calculation using logical columns, the columns are summed first and then the difference is calculated. You compare these results to the query results in the next practice. 21. Close the query log. 22. Click Finished to close the Session Management window. 23. Click Close Window to close Oracle BI Presentation Services Administration. 24. Leave Answers open for the next topic.

74

Create a Calculation Measure Using Physical Columns In this topic, you define a new calculation measure named Gross Profit Physical in the Sales Facts logical table, using physical columns to define the calculation formula. To create a calculation measure using physical columns, perform the following steps. 1. Return to the SH repository, which should still be open in online mode in the Administration Tool. 2. Right-click the Sales Facts logical table and select New Object > Logical Column.

3. In the Logical Column dialog box, name the logical column Gross Profit Physical.

4. Click the Aggregation tab. 5. Set the default aggregation rule to SUM.

6. Click OK to close the Logical Column dialog box. Gross Profit Physical is

75

added to the business model.

7. Expand Sales Facts > Sources and double-click the SALES logical table source. The Logical Table Source dialog box opens. 8. Click the Column Mapping tab.

9. Click the Expression Builder button for the Gross Profit Physical logical column.

10 In the Expression Builder, select Physical Tables > SALES >

76

.

AMOUNT_SOLD and then click the Insert button to add the column to the formula.

11 Click the minus sign operator to add it to the formula. . 12 Select Physical Tables > COSTS > UNIT_COST and then click the Insert . button to add the column to the formula.

13 Click OK to close the Expression Builder. Notice that the expression is added . in the Logical Table Source dialog box.

77

14 Click OK to close the Logical Table Source dialog box. The icon for Gross . Profit Physical changes to indicate an aggregation rule is applied.

15 Drag Gross Profit Physical to Sales Facts in the Presentation layer. .

16 Check in changes. . 17 Click Yes when prompted to check global consistency. If the repository is . consistent (no Error messages), close the Consistency Check Manager. If there are Error messages, you must correct the errors before continuing. 18 Save the repository. . 19 Return to Answers, which should still be open from the previous topic. . 20 Click Reload Server Metadata.

78

.

21 Expand Sales Facts and verify that the Gross Profit Physical column is now . visible in Answers.

22 Create the following request. . Times.Calendar Year, Sales Facts.Amount Sold, Sales Facts.Unit Cost, Sales Facts.Gross Profit Physical

23 Click Results. Verify that the results are the same for the Gross Profit . Physical (built using physical columns) as they were for the Gross Profit column (built using logical columns).

79

The calculation formula for the logical columns looks like this: sum(Amount Sold) sum(Unit Cost), whereas the calculation formula for the physical columns looks like this: sum(AMOUNT_SOLD UNIT_COST). Because of arithmetic laws, you know that you can sum ColumnA and sum ColumnB and then take the differences of those sums, and have exactly the same results if you calculate the difference first (the value in ColumnA the value in ColumnB for each row) and then sum the difference. So in this example, the results are the same for the logical column and the physical column calculations. 24 Click Settings > Administration > Manage Sessions > View Log to view . the query log. Your results should look similar to the picture.

Note that the difference between amount sold and unit cost is calculated first and then summed: sum(T245.AMOUNT_SOLD - T168.UNIT_COST)in the example pictured here. 25 Close the query log. . 26 Click Finished to close the Session Management window. . 27 Click Close Window to close Oracle BI Presentation Services Administration. . 28 Leave Answers open for the next topic. .

80

Create a Calculation Measure Using the Calculation wizard In this topic, you use the Calculation Wizard to define a new calculation measure named Share of Category in the Sales Facts logical table. To create a calculation measure using the Calculation Wizard, perform the following steps: 1. Return to the SH repository, which should still be open in online mode in the Administration Tool. 2. Right-click the Amount Sold logical column and select Duplicate.

3. A new column named Amount Sold#1 is added to the business model.

81

4. Rename Amount Sold#1 to Category Sales.

5. Double-click Category Sales to open the Logical Column dialog box. 6. Click the Levels tab and select Category as the logical level for ProductsDim.

Category Sales is now a level-based measure that will calculate total sales at the category level when used in a query. Level-based measures are useful for creating share measures. You use the Calculation Wizard to create a share measure in the steps that follow. 7. Click OK to close the Logical Column dialog box. 8. Right-click Amount Sold and select Calculation Wizard.

82

9. Click Next. 10.Check Category Sales as the column to compare with Amount Sold.

11.Click Next. 12.Uncheck Change and Percent Change and check Percent.

83

13.Change Calculation Name to Share of Category.

14.Click Next.

15.Click Finish. Share of Category is added to the business model.

16.Drag Category Sales and Share of Category to Sales Facts in the

84

Presentation layer.

17.Check in changes. 18.Click Yes when prompted to check global consistency. If the repository is consistent (no Error messages), close the Consistency Check Manager. If there are Error messages, you must correct the errors before continuing. 19.Save the repository. 20.Return to Answers, which should still be open from the previous topic. 21.Click Reload Server Metadata. 22.Expand Sales Facts and verify that Category Sales and Share of Category are now visible in Answers.

23.Place the cursor over the icon to display the screenshot and use it as a reference to create a query. Notice the sort settings for the Prod Category and Amount Sold columns.

24.Expand the Times folder.

85

25.Hold down the Ctrl key and click the Calendar Year column to open the Create/Edit Filter dialog box.

26.Click the All Choices link.

27.Click 2001 to add it to the Value field.

28.Click OK to close the Create/Edit Filter dialog box. The filter is added to the request.

29.Click Results. Only partial results are shown in the picture.

86

30.Leave Answers open.

Organizing the Presentation LayerThe Presentation layer is built after the Physical layer and Business Model and Mapping layer and adds a level of abstraction over the Business Model and Mapping layer. It is the view of the data seen by end users in client tools and applications, such as Oracle BI Answers. The Presentation layer provides a means to further simplify or customize the Business Model and Mapping layer for end users. For example, you can organize columns into catalogs and folders. Simplifying the view of the data for users makes it easier to craft queries based on users business needs because you can expose only the data that is meaningful to the users, organize the data in a way that aligns with the way users think about the data, and rename data as necessary for the set of users. You typically create Presentation layer objects by dragging objects from the Business Model and Mapping layer. Corresponding objects are automatically created in the Presentation layer. You also can manually create catalogs and folders based on the needs of your users. Presentation catalogs allow you to show different views of a business model to different sets of users. Presentation catalogs have to be populated with content from a single business model. They cannot span business models. However, multiple presentation catalogs can refer to the same business model. Presentation catalogs contain presentation tables. You can use the Presentation Tables tab in the Presentation Catalog properties dialog box to reorder, sort, or delete Presentation layer tables. You can also use this tab to access the Presentation Table dialog box, where you can create and edit tables. Changes to 87

the Presentation layer do not impact corresponding objects in the Business Model and Mapping layer. Use presentation tables to organize columns into categories that make sense to the user community. Presentation tables appear as folders in the Oracle BI user interface. Presentation tables contain presentation columns. A presentation table can contain columns from one or more logical tables. The names and object properties of the presentation tables are independent of the logical table properties. Presentation tables contain presentation columns. Use the Columns tab in the Presentation Table properties dialog box to reorder, sort, or delete Presentation layer columns. You can also use this tab to access the Presentation Column dialog box, where you can create and edit columns. Presentation columns define the columns used to build queries in the Oracle BI user interface, such as Oracle BI Answers. The presentation column names are, by default, identical to the logical column names in the Business Model layer. To provide a convenient organization for your end users, you can drag a column from a single logical table in the Business Model and Mapping layer onto multiple presentation tables. To organize the Presentation layer, perform the following steps: 1. Return to the SH repository, which should still be open in online mode in the Administration Tool. 2. In the Presentation layer, double-click the SH presentation catalog to open the Presentation Catalog dialog box.

3. Click the Presentation Tables tab.

88

4. To create a new presentation Table, click the Add button to open the Presentation Table dialog box. 5. Click the General tab and name the presentation table Calendar. 6. In the Description field, type -> Calendar time attributes. Adding -> in the description nests the table under the table above it. The description displays as a tool tip in Answers.

7. Click OK to close the Presentation Table dialog box. 8. Repeat the steps and create another presentation table named Fiscal with >Fiscal time attributes in the Description field.

9. Drag the tables or use the Up and Down buttons to rearrange the tables in the following order: Times

89

Fiscal Calendar Products Customers Channels Promotions Sales Facts

10.Click OK to close the Presentation Catalog dialog box. The new tables are added to the Presentation layer and the presentation tables are reordered.

11.Double-click the Channels presentation table to open the Presentation Table dialog box. 12.Click the Columns tab. 13.Drag the columns or use the Up and Down arrows to reorder the columns. A suggested approach is to order the columns hierarchically from top to bottom.

14.Click OK to close the Presentation Table dialog box. The column order is changed in the Presentation layer.

90

15.Expand the Times presentation table. 16.Use cut and paste to move all the fiscal columns from the Times presentation table to the Fiscal presentation table and all the remaining columns from the Times presentation table to the Calendar presentation table. Use Shift+click and Ctrl+click to select multiple columns.

17.Check in changes. 18.Click Yes when prompted to check global consistency. If the repository is consistent (no Error messages), close the Consistency Check Manager. If there are Error messages, you must correct the errors before continuing. 19.Save the repository. 20.Return to Answers, which should still be open from the previous topic. 21.Click Reload Server Metadata.

91

22.Verify that the Fiscal and Calendar folders are nested under the Times folder.

23.Verify that the columns in the Fiscal and Calendar folders appear as expected.

24.Verify that the Channels columns appear as expected.

25.Leave Answers open.

92

Using Initialization Blocks and VariablesYou can use variables in a repository to streamline administrative tasks and modify metadata content dynamically to adjust to a changing data environment. A variable has a single value at any point in time. Variables can be used instead of literals or constants in the Expression Builder in the Administration Tool. Oracle BI Server substitutes the value of a variable for the variable itself in the metadata. You use the Variable Manager to define variables and initialization blocks. There are two classes of variables: repository variables and session variables. A repository variable has a single value at any point in time. There are two types of repository variables: static and dynamic. Static repository variables have values that are constant and do not change while Oracle BI Server is running. Dynamic repository variables have values that are refreshed by data returned from queries in initialization blocks. Repository variables are represented by a question mark icon in the Variable Manager. Session variables are created and assigned a value when each user logs on. There are two types of session variables: system and nonsystem. System variables have reserved names and are used for specific purposes by Oracle BI Server, such as authenticating users. Non-system variables are applicationspecific variables created by an Administrator. System and nonsystem variables are represented by a question mark icon in the Variable Manager. Initialization blocks are used to initialize dynamic repository variables, system session variables, and nonsystem session variables. To create initialization blocks, session variables, and dynamic repository variables, you perform the following steps: Create an Initialization Block for Session Variables Test the Initialization Block and Session Variables Create a Dynamic Repository Variable

93

Create an Initialization Block for Session Variables Session variables are like dynamic repository variables in that they obtain their values from initialization blocks. Unlike dynamic repository variables, however, the initialization of session variables is not scheduled. When a user begins a session, Oracle BI Server creates new instances of session variables and initializes them. Unlike a repository variable, there are as many instances of a session variable as there are active sessions on Oracle BI Server. Each instance of a session variable could be initialized to a different value. A session is an instance of a user running the client application. The session starts when the application is started and ends when the application is exited. To create an initialization block for session variables, perform the following steps: 1. Return to the SH repository, which should still be open in online mode in the Administration Tool.

2. Click Manage > Variables to open the Variable Manager.

3. Click Session > Initialization Blocks.

94

4. Right-click in the white space on the right and select New Initialization Block.

5. In the Session Variable Initialization Block dialog box, type setUser in the Name field.

6. Click the Edit Data Source button to open the Session Variable Initialization Block Data Source dialog box.

95

7. Click the Browse button and select SH > Connection Pool in the Select Connection Pool dialog box.

8. Double-click Connection Pool or click the Select button to add the connection pool to the Session Variable Initialization Block Data Source dialog box. 9. In the Default Initialization String field, type the following initialization string: select ':USER', case when upper(':USER') = 'KURT' then 'Germany' when upper(':USER') = 'KEIKO' then 'Japan' when upper(':USER')= 'CHARLES' then 'United Kingdom' when upper(':USER') = 'KAREN' then 'United States of America' end, 'CountryManagers', 2 from Dual

10. Click OK to close the Session Variable Initialization Block Data Source dialog box. The initialization string is visible in the Session Variable Initialization Block dialog box.

96

11. Click Edit Data Target to open the Session Variable Initialization Block Variable Target dialog box. 12. Click New to open the Session Variable dialog box. 13. In the Name field, type USER.

14. Click OK to close the Session Variable dialog box. 15. Click Yes when prompted about the USER session variable having a special purpose.

16. The USER variable is added to the Session Variable Initialization Block Variable Target dialog box.

97

17. Repeat the steps and add three more variables: UserCountry, GROUP, and LOGLEVEL. Click Yes when promoted about the GROUP and LOGLEVEL session variables having a special purpose. The order is important. The order of the variables must match the order of the values for the variables in the initialization string in the initialization block.

98

18. Click OK to close the Session Variable Initialization Block Variable Target dialog box. The variables are displayed in the Variable Target section of the Session Variable Initialization Block dialog box.

19. Click OK to close the Session Variable Initialization Block dialog box. The setUser initialization block is visible in the Security Manager.

20. Click Action > Close to close the Variable Manager. 21. Check in changes. 22. Save the repository.

99

Test the Initialization Block and Session Variables 1. Click Manage > Security to open the Security Manager.

2. Click Groups in the left pane.

3. Right-click the white space in the right pane and select New Security Group.

4. Name the group CountryManagers. 5. Click the Permissions button to open the User / Group Permissions dialog box.

100

6. Click the Filters tab. 7. Click the Add button. 8. Click the Customers presentation table.

9. Click Select to add Customers to the User / Group Permissions dialog box.

10. Click the Expression Builder button (three dots) on the right to open the

101

Expression Builder (you may need to scroll to see the button). 11. Select Logical Tables > Customers > Country and then click the Insert button to add Country to the formula.

12. Click the = operator to add it to the formula. 13. Select Session Variables > UserCountry and click the Insert button to add UserCountry to the formula as an argument in the VALUEOF() function.

14. Click OK to close the Expression Builder. The filter is added in the User / Group Permissions dialog box.

102

15. Click OK to close the User / Group Permissions dialog box. 16. Click OK to close the Group dialog box. CountryManagers is added as a group in the Security Manager.

17. Click Action > Close to close the Security Manager. 18. Check in changes. 19. Save the repository. 20. Return to Answers. 21. Log out of Answers.

22. Test the initialization block by logging in to Answers as one of the users in the initialization block: Kurt, Keiko, Charles, or Karen. 23. Create the following query: Customers.Country, Times.Calendar.Calendar Year, Sales Facts.Amount Sold.

24. Click Results. The results of the query should correspond to the the user's country (Kurt = Germany, Keiko = Japan, Charles = United Kingdom, Karen = United States of America). The picture shows the results when the user = Kurt.

103

25. Leave Answers open.

Create a Dynamic Repository Variable 1. Return to the SH repository open in online mode. 2. Click Manage > Variables to open the Variable Manager. 3. Click Repository > Initialization Blocks.

4. Right-click the white space and select New Initialization Block to open the Repository Variable Init Block dialog box. 5. Name the initialization block getMaxSalesDate.

6. Click Edit Data Source to open the Repository Variable Init Block Data Source dialog box. 7. Click the Browse button to open the Select Connection Pool dialog box.

104

8. Double-click the SH > Connection Pool object to add it to the Connection Pool field in the Repository Variable Init Block Data Source dialog box. 9. In the Default Initialization String field, type the following SQL: select TIME_ID, CALENDAR_YEAR, CALENDAR_MONTH_DESC, CALENDAR_MONTH_ID from TIMES WHERE TIME_ID = (select max(TIME_ID) from SALES)

10.Click OK to close the Repository Variable Init Block Data Source dialog box. The connection pool and initialization string are added to the Repository Variable Init Block dialog box.

105

11.Click Edit Data Target to open the Repository Variable Init Block Variable Target dialog box.

12.Use the New button to create four variables: maxSalesDate, maxYear,

106

maxMonthDesc, and maxMonthID. The order is important. The order of the variables must match the column order in the initialization string.

13.Click OK to close the Repository Variable Init Block Variable Target dialog box. The variables appear in the Variable Target field in the Repository Variable Init Block dialog box.

14.Click Edit Data Source to open the Repository Variable Init Block Data Source dialog box. 15.Click Test and verify you get the results in the picture.

16.Close Results. 17.Click OK to close the Repository Variable Init Block Data Source dialog box.

107

18.Click OK to close the Repository Variable Init Block dialog box. The getMaxSalesDate initialization block is displayed in the Variable Manager.

19.Select Repository > Initialization Blocks > Variables > Dynamic to see the variables displayed in the Variable Manager.

20.Click Action > Close to close the Variable Manager. 21.Check in changes. 22.Select File > Check Global Consistency. If the Consistency Check Manager displays any errors, edit the repository to correct the errors before continuing. If there are no error messages, close the Consistency Check Manager. 23.Save the repository. 24.Return to Answers. 25.Build the following query: Calendar.Calendar Year, Sales Facts.Amount Sold.

26.Click the Add Filter button for the Calendar Year column.

108

27.In the Create/Edit Filter dialog box, click Add > Variable > Repository.

28.In the Server Variable field, type maxYear.

29.Click OK to close the Create/Edit Filter dialog box. The filter is added to the request.

30.Click Results and verify that Calendar Year returns the expected result.

109

Adding Multiple SourcesData is often partitioned into multiple physical sources for a single logical table in a business model. When a logical table source does not contain the entire set of data at a given level, you need to specify the portion of the set that it does contain. When individual sources at a given level contain information for a portion or fragment of the domain, Oracle BI Server needs to know the content of the sources in order to pick the appropriate source for the query. The goal is to provide seamless and efficient access from the users' perspective. When there are multiple sources, the metadata is built so that Oracle BI Server handles the navigation to the appropriate source. Oracle BI Server can seamlessly access and process data from multiple sources in an efficient manner to satisfy users requests. In this example, sales quota numbers are stored in an XML file, SHQuota.xml. You incorporate the quota numbers into the business model and create business measures to report variance from quota and percent of quota. To add quota information to the business model, you perform the following steps. Import the XML data source into the repository Map the Logical Dimension Columns Setup Time Alias on imported XML source Create the quota measures Test the Quota Measures. First, copy the file SHQuota.xml to the network drive G:\. This equates to the folder /ora/ in the Linux file system. Also, go to the Process Control page and change the BI Server to use the original SH.rpd that you backed-up as SH_backup.rpd at the beginning of this entire tutorial.

Import the XML data source into the repository 1. Return to the SH repository open in online mode. 2. Select File > Import > from Database.

110

3. Change the Connection Type to XML in the dropdown. Insert the URL: G:\SHQuota.xml Leave the XSLT and other parameters blank.

4. Click OK. The Import dialog box opens. 5. In the Import dialog box, select the top level SHQuota.xml object.

6. Verify that Tables are checked and click Import. Click OK to accept the default configuration for the XML Connection Pool

111

7. When import completes, close the Import dialog box and verify that the SHQuota table has been imported into the Physical layer.

8. Double-click the Table database object in the Physical layer (SHQuota) to open the Table dialog box. 9. Since this file needs to be accessed by the Linux server we need to change the path to the file. Click the XML tab. Change the URL from G:\SHQuota.xml to /ora/SHQuota.xml

112

10.Since XML is all text by default, this time we need to manually tell the server what format the column data is expected in. Click on the Columns tab. Double-click on Amt column and change Type to DOUBLE. Click OK.

11.Likewise, change the following other column types: Quota: DOUBLE Year: INT QtrNumber:INT

12.Click OK to close the Table dialog box. 13.Check in changes. 14.Save the repository.

113

Map the Logical Dimension Columns 1. In the Business Model and Mapping layer, expand Customers > Sources and note that there are two logical table sources: CUSTOMERS and COUNTRIES.

2. Drag the physical column Country from SHQuota in the Physical layer to the logical column Customers.Country in the Business Model and Mapping layer. Notice that a new logical table source, SHQuota, is created automatically.

3. Drag the physical columns SubRegion and Region from SHQuota in the Physical laye