Sei sulla pagina 1di 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Student Examples

Rittman Mead Consulting 2009

Oracle Warehouse Builder 11gR2

Development & Deployment

OWB Installation and Database Setup


Hands-On Exercise 1: Creating the OWB Repository & User
Open a terminal window.
Set the environment variables:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
Make sure the database and listener are started:
lsnrctl start
sqlplus / as sysdba
SQL> startup
Unlock the OWBSYS account. This is required for repository installation.
SQL> alter user owbsys identified by password account unlock
Exit sqlplus by typing : exit
Start the Repository Assistant.
cd $ORACLE_HOME/owb/bin/unix
Run: ./reposinst.sh
Click next to proceed from the welcome page
Step 1-10. Enter database information:
Host: localhost
Port: 1521
Oracle Service Name: orcl.localdomain
Click Next.
Step 2-10. Choose Operation
Select Manage Warehouse Builder Workspaces.
Click Next.
Step 3-10. Choose Workspace Operations.
Choose Create a New Warehouse Builder workspace.
Step 4-10. New or Existing User
Choose Create a workspace with a new user as workspace owner
Click Next.
Step 5-10. DBA Information
User Name: sys
Password: ioug10
Rittman Mead Consulting

Page 2 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Click Next.
Step 6-10. Workspace Owner (New)
Workspace Owners User Name:
Workspace Owners Password:
Workspace Name:

owb_repos
password
training

Click Next.
Step 7-10. OWBSYS Information.
Fill in the password for the previously unlocked OWBSYS account. Click Next.
Step 8-10. Select Tablespaces.
Leave the defaults in place:
Tablespace for Data:
Tablespace for Indexes:
Tablespace for Temporary Data:
Tablespace for Snapshots:

USERS
USERS
TEMP
USERS

Click Next.
Step 9-10. Select Languages.
Leave the default in place:
Base Language : AMERICAN ENGLISH
Select no additional display languages
Click Next.
Step 10-10. Workspace Users (Optional)
Create the following users with passwords password.
Select the USERS tablespace for data and indexes, and TEMP for the temporary
tablespace.
training_stg
Click Next.
Summary.
Check the summary and click Finish to create the repository and your database users.
This may take a while to complete.

Rittman Mead Consulting

Page 3 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 2: Prepare for future exercises


Download the ORDERS_SRC dump file by opening a terminal and executing:
wget http://dl.dropbox.com/0/view/77gp8zjcqp5h0fl/Collaborate%2010/
orders_src.dmp
Create the ORDERS_SRC user:
sqlplus / as sysdba
SQL> create user orders_src identified by password;
SQL> grant connect, resource to orders_src;
Import the ORDERS_SRC schema:
imp orders_src/password file=orders_src.dmp full=y
Prepare for the external table demonstration later:
Create a directory on your PC, and note its location. For this example, we will use a
directory called /home/oracle/Source_Data. Move into this directory and then pull down
the customers_csv file:
wget http://dl.dropbox.com/0/view/kcxnc6z9g93x2ez/Collaborate%2010/
customers_csv

Rittman Mead Consulting

Page 4 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 3
Open a terminal window as the oracle user and set the proper ORACLE_HOME and
ORACLE_SID.
Then run the OWB Design Center:
cd $ORACLE_HOME/owb/bin/unix
Run: ./owbclient.sh
When the Design Center Logon dialog shows enter the following details:
User Name :
Password:

owb_repos
password

Ensure the Connection Details option is selected, and enter the following details:
Host:
Port:
Service Name:

localhost
1521
orcl.localdomain

Click Ok.
When the Oracle Warehouse Builder opens, explore the user interface, taking a look at
the application toolbar, the Project Navigator tab, the Locations Navigator tab and the
Globals tab.

Rittman Mead Consulting

Page 5 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 4: Creating a Project


Select File > New.
The object gallery opens. Select Project
Alternatively right-click on MY_PROJECT and select New...

Enter the following details in the Create Project dialog:


Name
: Training_Project
Description
: This is a project for the training exercise.
Expand the new project in the Projects Navigator to see the objects it contains.

Rittman Mead Consulting

Page 6 of 26

Oracle Warehouse Builder 11gR2

Rittman Mead Consulting

Development & Deployment

Page 7 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 5: Creating a Data Source Module


Within the TRAINING_PROJECT project you just created, expand the Databases and
Oracle entries.
Right-click on the Oracle entry, and select New Oracle Module
The Create Module wizard will now be displayed.
Click Next.
Step 1-2: Name and Description dialog
Enter and select the following values:
Name
: ORDERS_SRC
Module Status
: Development
Step 2-2. Connection Information
Press the Edit button and enter the following connection details:
Name
Description
Type
User Name
Password
Host
Service Name
Version

: ORDERS_SRC_LOCATION1
: Orders source data
: HOST:PORT:SERVICE
: orders_src
: password
: localhost
: orcl.localdomain
: 11.2

Leave all other settings as the default. Press the Test Connection button to check that
the details are entered correctly, and press OK to save the connection details.

Rittman Mead Consulting

Page 8 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Click Next in the wizard and verify that Summary window that opens.
If all looks ok then click Finish to create the new ORDERS_SRC module.
Click the Save-All icon in the toolbar to save your changes.
This can also be done using File->Save All or by pressing CTRL-S.
Make sure to do this regularly since it will commit the changes to the database.
Note: unchanged items in the repository will show up in italic in the Oracle Warehouse
Builder interface.
Right-click on the new ORDERS_SRC module in the projects navigator, and select
Import->Database Objects

The Import Metadata Wizard will open.


Click Next to continue.
Step 1-3. Filter Information
Select Table click Next.

Rittman Mead Consulting

Page 9 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Step 2-3. Object Selection page.


Expand the list of tables and copy all of them across to the Selected pane.

Press Next, review the selected tables, and press Ok to complete the metadata import.
Rittman Mead Consulting

Page 10 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Review the imported table metadata in the Design Center Project Explorer, and use the
Save All button on the Warehouse Builder toolbar to save your project.

Rittman Mead Consulting

Page 11 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 6: Creating Target Modules


Within the TRAINING_PROJECT, expand the Databases and Oracle entries. Right-Click
on the Oracle entry and select New Oracle Module
Step 1-2. Name and Description page
Enter the following details:
Name
: TRAINING_STG
Module Status
: Development
Step 2-2. Connection Information page
Press the Edit button, create location TRAINING_STG_LOCATION1 and fill in the details
for the TRAINING_STG user that was created when the repository was created (see
earlier lab). Make sure to test the connection before clicking Ok.
User Name
Password
Host
Port
Service Name
Schema
Version

: TRAINING_STG
: password
: localhost
: 1521
: orcl
: TRAINING_STG
: 11.2

Click Next and then Finish to create the module. Do not attempt to import any table
metadata in to the new module, as the underlying schema is currently empty.

Rittman Mead Consulting

Page 12 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Repeat this step again but this time create a module called TRAINING_DW, this time
creating the location TRAINING_DW_LOCATION1.
Once these steps are completed, view the new Oracle Database modules in your project.

Rittman Mead Consulting

Page 13 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 7: Importing Files, Creating an External Table


Within the TRAINING_PROJECT, locate the Files entry. Right-Click on it and select New
Flat File Module.
In the Create Module wizard Name and Description page, enter the following details:
Name
: SOURCE_FILES
Description
: Source files used in training project
On the Connection Information page, press the Edit button, and enter the following
values:
Name
Type

: SOURCE_FILES_LOCATION1
: general

Then use the Browse button to locate the directory that you created earlier, and in which
the source file is located.

Press OK to save the Source File location.


When you return to the Connection Information page, check the Import After Finish
checkbox so that Warehouse Builder starts the file metadata import process
automatically.

Rittman Mead Consulting

Page 14 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Press Finish to complete the wizard.


When the Import Metadata Wizard starts, click Add Sample File.
Using the Open dialog, select the customers_csv file and click Open.

On the File Import page the file has now been added as a Sample File.

Rittman Mead Consulting

Page 15 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Click Import to continue. This will open the Flat File Sample Wizard.
Step 1-3. Name.
On the Flat File Sample wizard, press Next and then review the file details. Leave all
values as the default, and then press Next.

Strep 2-3. Simple delimited.


On the Simple Delimited page, check that Records delimited by is checked with a value
of <CR>, and that Field Delimiter is set to Comma (,).

Rittman Mead Consulting

Page 16 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Click Next.
Step 3-3. Field Properties.
On the Field Properties check the checkbox Use the First Record as the Field
Names.

Press Next to review the summary and click Finish to complete the wizard.
Save you changes.

Rittman Mead Consulting

Page 17 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Now that you have imported the file metadata, you will now create an external table to
make accessing the data within it more convenient. Locate the TRAINING_STG module
within your project, then locate the External Tables entry, right-click on it and select New
External Table.

The Create External Table Wizard opens.


Click Next to continue.
Step 1-3. Name and Description
Name the external table stg_customers_ext and press Next.
Step 2-3. File Selection.
On the File Selection page, select the customer_csv file that you imported previously.
Click OK to save the location details, Next and then Finish to complete the wizard. Save
your changes.

Rittman Mead Consulting

Page 18 of 26

Oracle Warehouse Builder 11gR2

Rittman Mead Consulting

Development & Deployment

Page 19 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 8: Creating Relational Objects


In this exercise, you will create three tables to hold data on customers, orders and
products. Later on, you will map data in to these tables before loading them in to your
data warehouse.
Locate the TRAINING_STG Oracle Database module in your project, expand it and
locate the Tables entry.
Right click on the Tables entry and select New Table.
Enter the name STG_PRODUCTS and click Ok.
A new tab will open, allowing to enter details on the newly create table.
Using the Columns tab, enter the following column details:

Name

Data Type Length

Precision Scale Not Null

PROD_ID

NUMBER

PROD_NAME

VARCHAR2

20

COLOUR

VARCHAR2

20

PRICE

NUMBER

10

COST

NUMBER

10

PROD_TYPE_ID

NUMBER

PROD_TYPE_DSC

VARCHAR2

Rittman Mead Consulting

20

Page 20 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 9: Deploying Relational Objects


In this hands-on exercise, you will deploy the tables and external table that you designed
in the previous exercises.
SQL> grant create any directory to training_stg;
SQL> grant drop any directory to training_stg;
Using Oracle Warehouse Builder, select Tools > Control Center Manager to start the
Control Center Manager application.
Locate the TRAINING_STG_LOCATION1 entry in the list of locations, expand it, and
then expand the TRAINING_STG module to display the list of objects that it contains.
Click on and select the TRAINING_STG module, as shown in the figure below.

Click on the Default Actions button on the right-hand side of the Control Center
Manager, to set the Deploy Action for each of the selected objects to Create.
Since none of the objects have been previously deployed the deployment action is set to
Create for all objects.

Rittman Mead Consulting

Page 21 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

From the application menu, select File > Deploy > To Control Center.
When prompted to register the TRAINING_STG_LOCATION1 location, enter the
password and click Test Connection to check the connection details are valid. Once
confirmed, press OK to save the location details, and then check that the deployment
was successful (see below) before proceeding.

Once you have checked that the tables have been deployed correctly, close the Control
Center Manager and return to the Design Center.

Rittman Mead Consulting

Page 22 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Hands-On Exercise 10: Creating Data Mappings


In this first mapping, we will take data from the source PRODUCT, PRODUCT_DETAILS
and PRODUCT_TYPES tables, join them and load the results in to the
STG_PRODUCTS table.
In the Project Explorer, within the TRAINING_PROJECT, expand the Databases and
Oracle entries. locate the TRAINING_STG module and the Mappings folder within it.
Right-click on the mappings folder and select New Mapping.
Call the mapping MAP_STG_PRODUCTS
In the mapping editor, locate the Component Palette. If not found it can be opened by
choosing View->Component Palette. Drag and drop a Table Operator on to the
mapping canvas. Using the Add Table Operator dialog, select the PRODUCTS table from
within the ORDERS_SRC module. Repeat the process to add the PRODUCT_DETAILS
and PRODUCT_TYPES tables.
Note that you can multi-select these 3 files at once as well.

Using the mapping operator palette, drop a Joiner operator on to the mapping canvas, to
the right of the three tables you just added.
Double-click on the Joiner operator and select the Groups.
Rename INGRP1 and INGRP2 to PRODUCTS and PRODUCT_DETAILS respectively.
Add a 3rd input group called PRODUCT_TYPES.
Rename OUTGRP1 to STG_PRODUCTS, like this:

Rittman Mead Consulting

Page 23 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Press OK to save the details.


On the mapping canvas, select the INOUTGRP1 entry in the PRODUCTS table, and
drag and drop it on to the PRODUCTS group in the Joiner operator. Do the same with
the PRODUCT_DETAILS table, dragging its INOUTGRP1 column on to the
PRODUCT_DETAILS Joiner group, and drag the PRODUCT_TYPES header on to the
PRODUCT_TYPES joiner group, like this:

Single-click on the Join operator, and then click in the Join Condition property in the
Property Inspector (if not open it can be opened using
View->Property Inspector).
Press the ellipses button () to bring up the Expression Builder.
Using the Expression Builder, join the three input tables in the following way:
PRODUCTS.PROD_TYPE_ID =
and

Rittman Mead Consulting

PRODUCT_TYPES.PROD_TYPE_ID

Page 24 of 26

Oracle Warehouse Builder 11gR2

PRODUCTS.PROD_ID =

Development & Deployment

PRODUCT_DETAILS.PROD_ID

Press the Validate button to check that your syntax is correct.

Once you have completed this step, press OK to save the join details.
In the mapping editor, use the mapping object palette to drag and drop another Table
Operator on to the mapping canvas to the right of the joiner operator. Using the Add
Table Operator dialog, select the STG_PRODUCTS table from within the
TRAINING_STG module, like this:

Now connect the PROD_ID, PROD_NAME, PROD_TYPE_ID, COLOUR, PRICE, COST


and PROD_TYPE_DSC columns in the join operator to the corresponding columns in the
STG_PRODUCTS table, like this:

Rittman Mead Consulting

Page 25 of 26

Oracle Warehouse Builder 11gR2

Development & Deployment

Select File > Validate from the menu or click its corresponding icon in the toolbar to
check that the mapping is valid, and then save and close the mapping.

Before we can deploy this new mapping to the database, we need to ensure that the
TRAINING_STG user you created previously can access tables in the ORDERS_SRC
schema. Normally, your DBA would grant access to these tables individually, but for now,
the course instructor will connect to the database as the SYSTEM user and grant the
SELECT ANY TABLE role to the TRAINING_STG account.
SQL> grant select any table to training_stg;
Using the Control Center Manager, deploy the new mapping to the database, and ensure
that it compiles and deploys correctly.
Still within the Control Center Manager, select in turn each of the mappings, right-click on
them and select Start.

Rittman Mead Consulting

Page 26 of 26

Potrebbero piacerti anche