Data Mining INST
Data Mining INST
Data Mining INST
Administrator's Guide
11g Release 2 (11.2)
E16807-08
July 2013
Oracle Data Mining Administrator's Guide, 11g Release 2 (11.2)
E16807-08
Copyright © 1996, 2013, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it
on behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,
any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users
are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and
agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and
adaptation of the programs, including any operating system, integrated software, any programs installed on
the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to
the programs. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management
applications. It is not developed or intended for use in any inherently dangerous applications, including
applications that may create a risk of personal injury. If you use this software or hardware in dangerous
applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other
measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages
caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks
are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,
Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced
Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information on content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle
Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your
access to or use of third-party content, products, or services.
Contents
Preface ................................................................................................................................................................. v
Audience....................................................................................................................................................... v
Documentation Accessibility ..................................................................................................................... v
Related Documentation .............................................................................................................................. vi
Where to Find Database Tuning Documentation .................................................................................. vi
Conventions ................................................................................................................................................. vi
iii
Connect the Spreadsheet Add–In....................................................................................................... 3-12
Index
iv
Preface
This manual explains how to install Oracle Data Mining and prepare the database for
data mining activities.
The preface contains these topics:
■ Audience
■ Documentation Accessibility
■ Related Documentation
■ Where to Find Database Tuning Documentation
■ Conventions
Audience
This guide is intended primarily for users who want to install, configure, and use
Oracle Data Mining on Microsoft Windows for data mining exercises and
demonstrations.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
v
Related Documentation
The documentation set for Oracle Data Mining is part of the Oracle Database 11g
Release 2 (11.2) Online Documentation Library. The Oracle Data Mining
documentation set consists of the following documents:
■ Oracle Data Mining Concepts
■ Oracle Data Mining User's Guide
■ Oracle Data Mining Java API Reference (javadoc)
For detailed information about the Oracle Data Mining PL/SQL interface, see Oracle
Database PL/SQL Packages and Types Reference.
For detailed information about the SQL data mining functions, see Oracle Database SQL
Language Reference.
For an introduction to Oracle application development, see Oracle Database 2 Day
Developer's Guide.
See Also:
Oracle Database Performance Tuning Guide for getting started
Oracle Database Performance Tuning Guide for more detail on memory
configuration
In addition, if parallel execution is desired, then there are INIT.ORA parameters that
control this functionality.
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements
associated with an action, or terms defined in text or the
glossary.
italic Italic type indicates book titles, emphasis, or placeholder
variables for which you supply particular values.
vi
Convention Meaning
monospace Monospace type indicates commands within a paragraph,
URLs, code in examples, text that appears on the screen, or
text that you enter.
ORACLE_HOME ORACLE_HOME represents the directory in which Oracle
Universal Installer installs an Oracle product. ORACLE_HOME
contains subdirectories for Oracle software executables and
network files.
vii
viii
What's New in Oracle Data Mining
Administration?
■ Oracle Data Mining supports a new release of Oracle Data Miner. The earlier
release, Oracle Data Miner Classic, is still available for download on OTN, but it is
no longer under active development.
To download Oracle Data Miner 11g Release 2, go to:
http://www.oracle.com/technetwork/database/options/odm/dataminerworkflo
w-168677.html
To download Oracle Data Miner Classic, go to:
http://www.oracle.com/technetwork/database/options/advanced-analytics/o
dm/downloads/index.html
ix
MODEL procedure will accept a PMML document and translate the information into an
Oracle Data Mining model. This includes creating and populating model tables as well
as SYS model metadata.
External models imported in this way will be automatically enabled for Exadata
scoring offload.
See Also:
Oracle Database PL/SQL Packages and Types Reference for information
about DBMS_DATA_MINING.IMPORT_MODEL
Oracle Data Mining Concepts for information about scoring in Oracle
Exadata
No DMSYS Schema
Oracle Data Mining 11g is more tightly integrated with Oracle Database than it was in
previous releases. Data Mining metadata and PL/SQL packages have been migrated
from DMSYS to SYS. The DMSYS schema does not exist in Oracle Database 11g fresh
installations.
Enhanced Security
Security features of Oracle Data Mining are significantly enhanced in 11g. Improved
security for data mining has several aspects:
■ Previously, Oracle Data Mining used DMSYS as its own repository schema. This
necessitated the granting of advanced database privileges to DMSYS, a non-system
account. In 11g, the Oracle Data Mining metadata repository is in SYS, where it is
accessible only to the system DBA.
■ The SQL auditing system can be used to track operations on mining model objects.
■ New system and object privileges for mining model objects are introduced in 11g.
x
See Also:
"Auditing Mining Models" on page 5-4
Chapter 4, "Users and Privileges for Data Mining"
xi
See Also: Oracle Database PL/SQL Packages and Types Reference
xii
1
Getting Started with Oracle Data Mining
1
The steps described in this chapter explain how to install Oracle Data Mining locally
on your Windows PC or laptop and start up the client interfaces: Oracle Data Miner
and Oracle Spreadsheet Add-In for Predictive Analytics.
This chapter provides summary information. Details are provided in subsequent
chapters of this manual.
4. If the user will need to import or export data mining models, grant this additional
privilege.
GRANT CREATE ANY DIRECTORY TO dmuser;
For import/export operations, the user must create a directory object. The user
may also require additional privileges. See "Exporting and Importing Mining
Models" on page 5-6 for details.
See: Chapter 4, "Users and Privileges for Data Mining" for more
detailed instructions
Note: Oracle Data Miner Classic, the previous release of Oracle Data
Mining, is still available for download on the Oracle Technology
Network.
http://www.oracle.com/technetwork/database/options/advanced-
analytics/odm/downloads/index.html
Oracle Data Miner Classic is no longer under active development.
3. Open the zip file and extract the contents to the Microsoft Office Library, typically:
C:\Program Files\Microsoft Office\Office\Library
4. Open Excel and click Tools > Add–Ins. Select Oracle Predictive Analytics from
the Add–Ins dialog box. The OraclePA menu is added to the Excel toolbar.
5. From the Add-In menu in Excel, choose Connect.
6. In the Connect (Oracle Database) dialog:
■ Select the Net Service Name that you created.
■ Provide the user name and password of the data mining user.
Click Connect to launch the Spreadsheet Add-In.
4. Connect to the database as the Data Mining user. Run the dmsh script.
CONNECT dmuser
@ ORACLE_HOME\RDBMS\demo\dmsh
COMMIT;
5. Once you have completed steps 1 through 4, you can run the PL/SQL programs.
This chapter is intended for anyone who wishes to install Oracle Data Mining and its
client interfaces on a personal computer or laptop running Microsoft Windows.
1. Before you begin the installation, ensure that your computer meets the system
requirements described in Oracle Database Installation Guide for Microsoft Windows.
4. To start the installation, run SETUP.EXE from the Database installation directory.
Oracle Universal Installer opens and displays the Configure Security Options
page. Type your My Oracle Support email address. Click Next.
5. In the Download Software Updates box, type your My Oracle Support credentials
if you want to automatically download software updates. Click Next.
6. On the Select Installation Option page, choose Create and configure a database.
8. On the Typical Install Configuration page, specify the following information about
the installation:
■ Oracle Base — Specify a base directory for Oracle products on this computer.
If this directory does not exist, the Installer will create it.
Oracle base is the root of the Oracle directory tree. It may contain multiple
Oracle home directories. By convention, Oracle base is referred to as ORACLE_
BASE.
■ Software Location — The Installer provides a Software Location under
ORACLE_BASE. This will be the home directory for this installation of Oracle
Database. If this directory does not exist, the Installer will create it. If the
directory does exist, make sure that it is empty.
■ Database File Location — The Installer provides a Database File Location
under ORACLE_BASE. This directory will hold the data files for the starter
database. If this directory does not exist, the Installer will create it. If the
directory does exist, make sure that it is empty.
■ Database Edition — Choose Enterprise Edition.
■ Global Database Name — Specify a unique name for the starter database.
The Global Database name is the fully–qualified name of the database: for
example, dbname.us.oracle.com. Specify a unique name for dbname that is not
more than eight characters.
■ Administrative Password — Specify a password for the database system
accounts SYS and SYSTEM. The password should have at least eight characters
and include both alphabetic and numeric characters.
You will have the opportunity to change the passwords at a later time.
■ Confirm Password — Re–enter the administrative password.
11. The Install Product page displays the progress of the installation.
12. Once the software has been copied to your computer, the Database Configuration
Assistant creates and starts the starter database.
13. The Database Configuration Assistant displays summary information about the
starter database.
At the bottom of the page is a note about passwords for the starter database.
Choose Password Management if you wish to reset the administrative passwords
or unlock any other accounts that are available in the database. By default the SYS
and SYSTEM accounts are unlocked.
Note: If you wish to use Oracle sample data or the Oracle Data
Mining sample programs, unlock the SH account.
See Chapter 7 for information about the sample programs.
16. If you stopped any Oracle services before running Oracle Universal Installer, you
can restart them at this time.
In Windows Control Panel, choose Administrative Tools, then Services. Find the
service names that start with "Oracle". Choose Start for each one.
4. Start the database service, Oracle ServiceSID, using the Services program in
Control Panel.
5. Start up the database.
srvctl start database -d db_name
4. Start the database service, Oracle ServiceSID, using the Services program in
Control Panel.
5. Start up the database.
srvctl start database -d db_name
See Also: Oracle Database Installation Guide for Microsoft Windows for
more information about chopt
Note: You only need to install Oracle Database Examples if you wish
to use the sample programs. If you do not wish to install the sample
programs, you can skip this section.
See Also:
Oracle Database Examples Installation Guide for complete installation
instructions
Chapter 7 for information about the Oracle Data Mining sample
programs
Oracle Universal Installer displays the Specify Install Location page. Specify the
Oracle base and Oracle home provided in the database software installation (step
8).
Do not assume that the directories displayed by the Installer are correct.
Click Next.
See Also: Step Four: If You Want to Use Oracle Data Miner in
Chapter 1
See Also: Oracle Data Mining Concepts for information about Oracle
predictive analytics
■ An Oracle Net Service Name for the database connection. Instructions for creating
an Oracle Net Service Name are provided in Chapter 3.
connection, you can use the PREDICT, EXPLAIN, PROFILE, and export/import operations
provided by the Add–In.
To create the connection and install the Add–In in Excel, follow the instructions in
"Connect the Spreadsheet Add–In" on page 3-12.
Note: The first time you use the Add–In, you will be prompted to
provide the path to the Java executable. Specify the full path of
jdk\bin\java.exe under Oracle home.
For the installation described in "Install Oracle Database" on page 2-1,
the path would be:
C:\app\myuser\product\11.2.0\dbhome_1\jdk\bin\java.exe
This chapter explains how to connect to a database to use Oracle Data Mining. It
contains the following sections:
■ Connect Application Development Tools
■ Connect SQL*Plus
■ Connect SQL Developer
■ Oracle Client and Oracle Net
■ Connect the Spreadsheet Add–In
Connect SQL*Plus
When SQL*Plus starts up it is already connected to the local database. Enter the name
of a user ID that has data mining privileges, as described in Chapter 4. You will be
prompted to enter the password.
■ For Connection Name, specify a meaningful name that you will remember.
■ For Username/Password, provide a user name and password for the
connection. The user must have data mining privileges as described in
Chapter 4.
■ For Hostname, specify localhost to indicate that the database is hosted on the
local computer.
■ For Port, specify the port where the database will listen to requests from the
client. The default port is 1521.
■ For SID (Service Identifier), specify the simple database name. This is the first
component of the global database name described in the installation
instructions in Chapter 2.
Click Connect to connect to the database using the specified credentials.
You may also identify a connection with a predefined Net Service Name.
Oracle Spreadsheet Add–In for Predictive Analytics, whether running locally or
remotely, requires the installation of Oracle Client and the creation of a Net Service
Name.
Note: SQL Developer and Oracle Data Miner do not require the
installation of Oracle Client.
For details about Oracle Data Miner installation and configuration, see
Oracle Data Miner 11g Release 2 "Getting Started" on the Oracle
Technology Network:
http://www.oracle.com/technetwork/database/options/odm/datam
inerworkflow-168677.html
Additional details are available in the online help for Oracle Data
Miner.
1. Ensure that your computer meets the system requirements described in Oracle
Database Client Installation Guide for Microsoft Windows.
2. Stop any Oracle services that may be running on your computer.
In Windows Control Panel, choose Administrative Tools, then Services. Find the
service names that start with "Oracle". Choose Stop for each one.
Click Next.
6. In the Download Software Updates page, provide your My Oracle Support
credentials if you want to automatically download software updates. Click Next.
7. On the Select Product Languages page, select the language for the Oracle Client
user interface.
Click Next.
8. On the Specify Install Location page, provide the path of the Base directory in
which you installed Oracle Database. (See "Install Oracle Database" step 8.)
The Installer provides a Software Location under Oracle Base. This will be the
home directory of the Oracle client that you are installing (Oracle home). If this
directory does not exist, the Installer will create it. If the directory does exist, make
sure that it is empty.
Click Next.
9. The Installer performs prerequisite checks, then displays the Summary page.
Click Install to complete the set up process and begin the installation.
10. On the Install Product page, the Installer displays a progress bar.
11. Oracle Net Configuration Assistant starts and displays the Welcome page.
14. If you stopped any Oracle services before running Oracle Universal Installer, you
can restart them at this time.
In Windows Control Panel, choose Administrative Tools, then Services. Find the
service names that start with "Oracle". Choose Start for each one.
Choose Next.
7. On the next page specify the communication protocol. The default is TCP.
Choose Next.
8. On the next page, choose Yes, perform a test to test the new connection.
The connection will probably fail until you provide a new user ID and password.
9. If the user name and password were the only problem with the connection, Oracle
Net Configuration Assistant makes a successful test connection.
Choose Next.
10. Oracle Net Configuration Assistant reports that the connection configuration was
successful. When you click Next, you are returned to the Welcome page, where
you have the opportunity to perform additional configuration.
Click Finish to exit Oracle Net Configuration Assistant.
From the list of predefined Net Service Names, choose the connection you want to
use. Provide a user name and password and click Connect to activate the
Spreadsheet Add–In.
This chapter explains how to create data mining users and control their mining
activities through the use of database privileges.
5. To create a user named dmuser, type these commands. Specify a password of your
choosing.
CREATE USER dmuser IDENTIFIED BY password
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
QUOTA UNLIMITED ON USERS;
Commit;
Specify the USERS and TEMP tablespaces. These tablespaces are included in the
starter database that was created during the installation, and they are typically
included in a database by default. (See "Install Oracle Database" on page 2-1). The
USERS and TEMP tablespaces are generally assigned to users that generate examples
and demonstrations.
See Also:
Oracle Database 2 Day DBA for an introduction to creating database
users
Oracle Database SQL Language Reference for the complete syntax of the
CREATE USER statement
Additional access rights are required for exporting and importing mining models, as
described in "Exporting and Importing Mining Models" on page 5-6.
Additional system and object privileges described in "System Privileges for Data
Mining" and "Object Privileges for Mining Models" can be used to enable or restrict
particular mining activities.
Note: To create a user for the Data Mining sample programs, you
need to run two configuration scripts as described in "Installation
and Setup" on page 7-1.
The following statement revokes the privilege of scoring or viewing model details in
other schemas. When this statement is executed, dmuser can only perform data mining
activities in the dmuser schema.
REVOKE SELECT ANY MINING MODEL FROM dmuser;
This statement prevents dmuser from renaming or changing the cost matrix of
testmodel. However, dmuser can still apply testmodel to the sales table.
REVOKE ALTER ON MINING MODEL sh.testmodel FROM dmuser;
In this chapter, you will learn how to retrieve information about mining models from
the data dictionary and perform various operations on mining models.
ALGORITHM VARCHAR2(30)
CREATION_DATE NOT NULL DATE
BUILD_DURATION NUMBER
MODEL_SIZE NUMBER
COMMENTS VARCHAR2(4000)
The information in the COMMENTS column is generated by a SQL COMMENT statement. The
comment provides descriptive information about the model. If no comment was
generated by SQL COMMENT, the COMMENTS column is empty. See "Adding a Comment to
a Mining Model" on page 5-4.
See Also:
Oracle Data Mining Concepts for information about mining functions
and algorithms
Oracle Data Mining User's Guide for more information about ALL_
MINING_MODELS
Note: The attributes listed in this data dictionary view are the
physical columns in the build data that were used to construct the
model. Some or all of these columns should be present for scoring.
These data attributes are referred to as the model signature.
The term attribute is more accurately used to designate the numericals
and categoricals derived from the data attributes for manipulation by
the algorithm. These model attributes may or may not correspond to
data attributes, depending on transformations and on whether or not
the column is nested. The model attributes can be viewed in the model
details returned by the GET_MODEL_DETAILS functions in the DBMS_
DATA_MINING package.
See Also:
Oracle Data Mining User's Guide for more information about attributes
Oracle Data Mining User's Guide for more information about ALL_
MINING_MODEL_ATTRIBUTES
Oracle Database PL/SQL Packages and Types Reference for details about
the GET_MODEL_DETAILS functions
Model settings are specified in a settings table that is used in the model build. The
settings all have default values. The defaults are used when they are not overridden by
settings specified in the settings table, or when there is no settings table.
See Also:
Oracle Database PL/SQL Packages and Types Reference for more
information about model settings
Oracle Data Mining User's Guide for more information about ALL_
MINING_MODEL_SETTINGS
See: Oracle Database PL/SQL Packages and Types Reference for details
You can view the comment by querying the catalog view USER_MINING_MODELS.
SQL> COLUMN comments FORMAT a22
SQL> SELECT model_name, mining_function, algorithm, comments FROM user_mining_models;
To drop this comment from the database, issue the following statement:
SQL> COMMENT ON MINING MODEL dt_sh_clas_sample '';
OS
XML
XML,EXTENDED
See Also: Oracle Database Security Guide for details about the AUDIT_
TRAIL settings
For example, this statement generates an audit trail for all GRANT operations on the
model NB_SH_CLAS_SAMPLE in the DMUSER schema.
SQL> AUDIT GRANT ON MINING MODEL dmuser.nb_sh_clas_sample;
This statement generates an audit trail for all operations on the same model.
SQL> AUDIT GRANT,AUDIT,COMMENT,RENAME,SELECT
ON MINING MODEL dmuser.nb_sh_clas_sample;
You can refine the criteria for auditing with the following additional semantics.
AUDIT {operation|ALL} ON MINING MODEL schema_name.model_name
[BY [SESSION|ACCESS]]
[WHENEVER [NOT] SUCCESSFUL]];
This SQL command gives user dmuser both read and write access to dmtest.
GRANT READ,WRITE ON DIRECTORY dmtest TO dmuser;
MODEL_NAME
------------------------------
GLMR_SH_REGR_SAMPLE
SVMC_SH_CLAS_SAMPLE
The following commands create the directory object mydir and export all models from
dmuser to mydir.
SQL> CREATE OR REPLACE DIRECTORY mydir AS '/scratch/dumpfiles';
SQL> EXECUTE dbms_data_mining.export_model('all_dmuser_models.dmp', 'mydir');
An export or import creates a log file in the same directory as the dump file. Error
messages are returned to the current output device (such as the screen), and the log file
may provide additional information.
This sample export created two files in the mydir directory:
■ A dump file named ALL_DMUSER_MODELS01.DMP (note the 2-digit suffix added to
the name)
■ A log file with the name DMUSER_EXP_920.LOG
For detailed information about the default names of files, see Oracle Database PL/SQL
Packages and Types Reference.
You can view the log file using a system command or editor. You must know the path
of the physical directory in order to locate the file.
DMUSER_EXP_920.LOG lists the two exported mining models and supporting objects .
Starting "DMUSER"."DMUSER_exp_17": DM_EXPIMP_JOB_ID=17
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 1.062 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/POST_INSTANCE/PROCACT_INSTANCE
. . exported "DMUSER"."DM$PIGLMR_SH_REGR_SAMPLE" 7.085 KB 14 rows
. . exported "DMUSER"."DM$PISVMC_SH_CLAS_SAMPLE" 7.507 KB 17 rows
. . exported "DMUSER"."DM$PCGLMR_SH_REGR_SAMPLE" 53.27 KB 2278 rows
. . exported "DMUSER"."DM$PAGLMR_SH_REGR_SAMPLE" 5.796 KB 24 rows
. . exported "DMUSER"."DM$PBGLMR_SH_REGR_SAMPLE" 15.76 KB 67 rows
. . exported "DMUSER"."DM$PDGLMR_SH_REGR_SAMPLE" 8 KB 66 rows
. . exported "DMUSER"."DM$PDSVMC_SH_CLAS_SAMPLE" 9.023 KB 88 rows
. . exported "DMUSER"."DM$PFGLMR_SH_REGR_SAMPLE" 5.656 KB 10 rows
. . exported "DMUSER"."DM$POSVMC_SH_CLAS_SAMPLE" 5.320 KB 8 rows
. . exported "DMUSER"."DM$PXSVMC_SH_CLAS_SAMPLE" 7.265 KB 77 rows
. . exported "DMUSER"."DM$PZSVMC_SH_CLAS_SAMPLE" 6.164 KB 1 rows
. . exported "DMUSER"."DM$P_MODEL_EXPIMP_TEMP" 5.921 KB 2 rows
Master table "DMUSER"."DMUSER_exp_17" successfully loaded/unloaded
******************************************************************************
Dump file set for DMUSER.DMUSER_exp_17 is:
/scratch/dumpfiles/all_dmuser_models01.dmp
Job "DMUSER"."DMUSER_exp_17" successfully completed at 10:30:19
The following command restores all models from the dump file to the DMUSER schema.
SQL> EXECUTE dbms_data_mining.import_model('all_dmuser_models01.dmp', 'mydir');
@ $ORACLE_HOME/RDBMS/demo/dmshgrants dmuser2
The import command, also executed as SYS, loads the two models into the DMUSER2
schema.
SQL> EXECUTE dbms_data_mining.import_model('all_dmuser_models01.dmp', 'mydir',
null, null, null, 'todmuser2', 'dmuser:dmuser2');
A parameter specifies TODMUSER2.LOG as the name of the log file; the .LOG extension is
added automatically to the name. The log file shows the names of the imported
models and supporting metadata.
Master table "SYS"."todmusr2" successfully loaded/unloaded
Starting "SYS"."todmusr4": DM_EXPIMP_JOB_ID=21
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "DMUSER2"."DM$PIGLMR_SH_REGR_SAMPLE" 7.085 KB 14 rows
. . imported "DMUSER2"."DM$PISVMC_SH_CLAS_SAMPLE" 7.507 KB 17 rows
. . imported "DMUSER2"."DM$PCGLMR_SH_REGR_SAMPLE" 53.27 KB 2278 rows
. . imported "DMUSER2"."DM$PAGLMR_SH_REGR_SAMPLE" 5.796 KB 24 rows
. . imported "DMUSER2"."DM$PBGLMR_SH_REGR_SAMPLE" 15.76 KB 67 rows
. . imported "DMUSER2"."DM$PDGLMR_SH_REGR_SAMPLE" 8 KB 66 rows
. . imported "DMUSER2"."DM$PDSVMC_SH_CLAS_SAMPLE" 9.023 KB 88 rows
. . imported "DMUSER2"."DM$PFGLMR_SH_REGR_SAMPLE" 5.656 KB 10 rows
. . imported "DMUSER2"."DM$POSVMC_SH_CLAS_SAMPLE" 5.320 KB 8 rows
. . imported "DMUSER2"."DM$PXSVMC_SH_CLAS_SAMPLE" 7.265 KB 77 rows
. . imported "DMUSER2"."DM$PZSVMC_SH_CLAS_SAMPLE" 6.164 KB 1 rows
. . imported "DMUSER2"."DM$P_MODEL_EXPIMP_TEMP" 5.921 KB 2 rows
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/POST_INSTANCE/PROCACT_INSTANCE
Job "SYS"."todmusr2" successfully completed at 11:15:26
See: Oracle Database PL/SQL Packages and Types Reference for more
examples
See: Oracle Database PL/SQL Packages and Types Reference for more
information about PMML import
This chapter explains how to upgrade or downgrade Oracle Data Mining 11g Release 2
(11.2). It contains the following sections:
■ Data Mining Upgrade Overview
■ Upgrade Using Database Upgrade Assistant
■ Upgrade Using Export/Import
■ Post Upgrade Steps
■ Downgrade Data Mining
Note: Models created by the Oracle Data Mining PL/SQL API can be
upgraded from 10.1 to 11g.
Models created by the Oracle Data Mining Java API cannot be
upgraded from 10.1 to 11g. The 10.1 version of the Java API was no
longer supported in Oracle Data Mining 10.2.
Model upgrade from 9.2 release to 11g releases is not supported.
If the result is non-zero rows, create and run a SQL script as follows:
SQL> set head off
SQL> spool directory_path/drop_dmsys_synonyms.sql
SQL> SELECT 'Drop public synonym ' ||'"'||SYNONYM_NAME||'";'
FROM DBA_SYNONYMS WHERE TABLE_OWNER = 'DMSYS';
SQL> spool off
SQL> @directory_path/drop_dmsys_synonyms.sql
Once DMSYS is removed, the SYS.DBA_REGISTRY view will no longer list Oracle Data
Mining as a component.
After upgrading to 11g, you can no longer switch to the Data Mining Scoring Engine
(DMSE). The Scoring Engine does not exist in 11g.
Note: The TEMP tablespace must already exist in the 11g database.
The DMEIDMSYS script uses the TEMP and SYSAUX tablespaces to create
the DMSYS schema.
If you shutdown the database before operating on the upgraded mining models, this
will also flush the shared pool.
After the import is complete, you should drop the DMSYS schema from the database.
If there are any 11g Release 2 (11.2) mining models in the database, you must manually
delete them using the DBMS_DATA_MINING.DROP_MODEL routine before downgrading the
database. If you do not do this, the database downgrade process will be aborted. See
Oracle Database PL/SQL Packages and Types Reference for the calling syntax of DROP_
MODEL.
You can learn a great deal about the Oracle Data Mining APIs from the Data Mining
sample programs. The programs illustrate typical approaches to data preparation,
algorithm selection, algorithm tuning, testing, and scoring. Each program creates a
mining model in the database. All the programs include extensive inline comments to
help you understand the code.
See Also: Oracle Data Mining User's Guide for information about the
Data Mining APIs
Note: The Oracle Data Mining Java API is deprecated in this release.
The Java sample programs are still shipped, but Oracle recommends
that you not use the Oracle Data Mining Java API in new applications.
Support for deprecated features is for backward compatibility only
■ If the database does not include the sample schemas, you can install them
manually or by using Oracle Database Configuration Assistant. See Oracle
Database Sample Schemas for instructions.
2. Determine whether or not Database Examples was installed with Oracle Database.
Database Examples provides a set of sample programs that illustrate numerous
features of Oracle Database, including Oracle Data Mining. The programs are
loaded into the RDBMS/demo subdirectory of Oracle home.
If Database Examples was not installed, you can perform the installation by
following the instructions in "Optionally Install Oracle Database Examples" on
page 2-10. Alternatively, you can download the Data Mining sample programs
from the Oracle Technology Network.
http://www.oracle.com/technetwork/database/options/odm/index.html
2. If you do not have a user ID for your data mining activities, you can create one by
following the instructions in "Example: Create a Database User in SQL*Plus" on
page 4-1.
3. Run dmshgrants.sql to grant data mining privileges and SH access to your user
ID. Several tables in SH are used by the Data Mining sample programs. Specify the
data mining user name as the parameter. Specify the full path of the Oracle home
directory.
@ ORACLE_HOME\RDBMS\demo\dmshgrants dmuser
5. Run dmsh.sql to populate the schema of the Data Mining user with tables, views,
and other objects needed by the sample programs. Specify the full path of the
Oracle home directory.
@ ORACLE_HOME\RDBMS\demo\dmsh
COMMIT;
Note: The files listed in Figure 7–1 include all the Data Mining
PL/SQL programs. However, one of the files, dmhpdemo.sql, is not a
Data Mining program.
Use Windows Search to find the files named dm*.java in the same directory. Windows
Search returns the Data Mining Java programs, as shown in Figure 7–2.
2. Run the program by specifying an at sign (@) followed by the fully-qualified path
of the program. In the following example, replace ORACLE_HOME with the path of
the Oracle home directory.
SQL>@ ORACLE_HOME\RDBMS\demo\dmnbdemo
This example executes the program dmnbdemo.sql, which creates a Naive Bayes
model.
>java -version
2. Add ORACLE_HOME\jdk\bin\ to your PATH variable before the paths of any other
Java versions. ORACLE_HOME is the full path to the Oracle home directory.
3. Add the following Data Mining JAR files to your Windows CLASSPATH:
ORACLE_HOME\RDBMS\jlib\jdm.jar
ORACLE_HOME\RDBMS\jlib\ojdm_api.jar
ORACLE_HOME\RDBMS\jlib\xdb.jar
ORACLE_HOME\jdbc\lib\ojdbc5.jar
ORACLE_HOME\oc4j\j2ee\home\lib\connector.jar
ORACLE_HOME\jlib\orai18n.jar
ORACLE_HOME\jlib\orai18n-mapping.jar
ORACLE_HOME\lib\xmlparserv2.jar
4. Compile the programs listed in Figure 7–2. To use the JAVAC executable, open a
command window and go to \RDBMS\demo in Oracle home.
>javac program_name.java
For example:
>javac dmnbdemo.java
If JAVAC is not found, then check the value of the PATH variable.
The model names distinguish the models created by the Java programs from those
created by the PL/SQL programs. The models created by the Java programs have "_
JDM" appended to the name.
See Also:
■ Oracle Database PL/SQL Packages and Types Reference for syntax of
the PL/SQL API
■ Oracle Data Mining User's Guide for information on the use of the
APIs
■ Oracle Database SQL Language Reference for syntax of the SQL
functions for model scoring
See Also:
■ Oracle Data Mining Concepts for information about text mining
with Oracle Data Mining
■ Oracle Data Mining User's Guide for details about text
transformation in PL/SQL
Note: The Oracle Data Mining Java API is deprecated in this release.
Oracle recommends that you not use deprecated features in new
applications. Support for deprecated features is for backward
compatibility only
See Also: ■
See Also:
■ Oracle Data Mining Concepts for information about text mining
with Oracle Data Mining
■ Oracle Data Mining User's Guide for details about text
transformation in Java
The Java text mining programs both use the dmtxtnmfdemo.java interface to
transform the text for mining. The programs are as follows:
■ dmtxtnmf.sql — Creates a text mining model using the Non-Negative Matrix
Factorization algorithm
■ dmtxtsvmdemo.java — Creates a text mining model using SVM classification
You can see the references to tables in SH by listing the view definitions. The definition
of the view MINING_DATA_BUILD_V is shown as follows.
SQL> set long 1000000
SQL> set longc 100000
SQL> set pagesize 100
SQL> SELECT text FROM all_views WHERE
owner='dmuser3'AND view_name='mining_data_build_v';
The views are used to build, test, and score the sample models. Each view has a
CUSTOMER_ID column, which is the case ID, and an AFFINITY_CARD column, which is
the target used by the predictive models. Most of the views provide data for 1500
customers (1500 rows). The view used by the One-Class SVM model has data for 940
customers.
The columns of training data in the MINING_DATA_BUILD_V view are as follows.
SQL> DESCRIBE mining_data_build_v
SIMM_16MB_PCMCIAII_CARD NUMBER
STANDARD_MOUSE NUMBER
Tip: The process of extracting terms from a text column into a nested
table column is described in Oracle Data Mining User's Guide.
You can list these tables with the following SQL statements.
SQL>CONNECT dmuser
Enter password: password
SQL>SELECT table_name FROM user_tables WHERE table_name LIKE '%MINING%';
This appendix provides a set of SQL and PL/SQL commands that test whether or not
the basic capabilities of data mining are present in the database. You can execute these
commands directly in the database without downloading or installing any additional
software.
Note: These commands create and score several data mining models.
These models do not perform meaningful data mining. They simply
show whether or not model creation and scoring operations are
working properly.
Insure that the USERS and TEMP tablespaces are present in the database. These
tablespaces are typically included by default and are always included in the starter
database created during installation (See "Install Oracle Database" on page 2-1). You
can check with a simple query.
select tablespace_name from dba_tablespaces;
Alternatively, you can copy each command from Example A–1 to the SQL command
line and execute it individually.
--------------------------------------------------------
-- create a simple table for mining
--------------------------------------------------------
CONNECT dm/dm;
CREATE TABLE mt (p NUMBER, t NUMBER);
INSERT INTO mt VALUES (1,1);
INSERT INTO mt VALUES (2,2);
COMMIT;
--------------------------------------------------------
-- create models
--------------------------------------------------------
EXEC dbms_data_mining.create_model('MAI','ATTRIBUTE_IMPORTANCE','MT',null,'T');
EXEC dbms_data_mining.create_model('MAR','ASSOCIATION','MT','T');
EXEC dbms_data_mining.create_model('MNB','CLASSIFICATION','MT',null,'T');
EXEC dbms_data_mining.create_model('MSVM','REGRESSION','MT',null,'T');
EXEC dbms_data_mining.create_model('MKM','CLUSTERING','MT',null);
EXEC dbms_data_mining.create_model('MNMF','FEATURE_EXTRACTION','MT',null);
--------------------------------------------------------
-- score models
--------------------------------------------------------
SELECT p,t,PREDICTION(MNB USING *) pred_nb,
p,t,prediction(MSVM USING *) pred_svm,
p,t,cluster_id(MKM USING *) clus,
p,t,feature_id(MNMF USING *) feat
FROM mt;
--------------------------------------------------------
-- drop the models and data
--------------------------------------------------------
EXEC dbms_data_mining.drop_model('MAI');
EXEC dbms_data_mining.drop_model('MAR');
EXEC dbms_data_mining.drop_model('MNB');
EXEC dbms_data_mining.drop_model('MSVM');
EXEC dbms_data_mining.drop_model('MKM');
EXEC dbms_data_mining.drop_model('MNMF');
Command Output
The output of the commands in Example A–1 is as follows.
User created.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Table created.
1 row created.
1 row created.
Commit complete.
MODEL_NAME ALGORITHM
------------------------------ ------------------------------
MAI MINIMUM_DESCRIPTION_LENGTH
MAR APRIORI_ASSOCIATION_RULES
MKM KMEANS
MNB NAIVE_BAYES
MNMF NONNEGATIVE_MATRIX_FACTOR
MSVM SUPPORT_VECTOR_MACHINES
6 rows selected.
P T PRED_NB P T PRED_SVM P
---------- ---------- ---------- ---------- ---------- ---------- ----------
T CLUS P T FEAT
---------- ---------- ---------- ---------- ----------
1 1 1 1 1 1.48008198 1
1 3 1 1 1
2 2 2 2 2 1.51991802 2
2 2 2 2 1
Table dropped.
D
E
data dictionary views, xi, 5-1
Data Mining option, 2-1 Enterprise Edition, 2-1, 2-5
Index-1
EXPDP, 5-6 adding a comment, 5-4
EXPLAIN, 2-11, 2-13, 7-10 applying, 4-4
exporting, 2-13, 4-2, 5-6 to 5-8, 6-2, 7-9, 7-10 auditing, 5-4
changing the name, 4-4
listing, 5-1
F object privileges, 4-4
feature extraction, 7-7, 7-8, 7-9, 7-10 See also scoring
settings, 5-3
G upgrading, 6-1
viewing, 4-4
Generalized Linear Models, 7-6, 7-7, 7-10 model details, 5-2
GET_DEFAULT_SETTINGS, xi model signature, xi, 5-2
GET_MODEL_DETAILS, 5-2
GET_MODEL_SETTINGS, xi
GET_MODEL_SIGNATURE, xi N
GLM Naive Bayes, 7-7, 7-9
See Generalized Linear Models Net Configuration Assistant, 2-11, 3-8
global database name, 2-5, 3-3 Net Service Name, 2-12, 3-8
new features, ix
I NMF
See Non-Negative Matrix Factorization
IMPDP, 5-6 Non-Negative Matrix Factorization, 7-7, 7-8, 7-9,
importing, 2-13, 4-2, 5-6 to 5-9, 6-2, 7-9, 7-10 7-11
INIT.ORA, vi normalization, 7-9, 7-10
installation
Data Mining sample programs, 7-1
Oracle Client, 3-4 O
Oracle Data Miner, 2-11 object privileges, 4-4
Oracle Database, 2-1 O-Cluster, 7-7, 7-9
Oracle Database Examples, 2-10 OLTP, v
Oracle Spreadsheet Add-In for Predictive One-Class SVM, 7-7
Analytics, 2-11 Oracle base directory, 2-5, 2-11
Oracle By Example, 3
J Oracle Client
connect, 3-3
Java API, ix, 6-1, 1, 8 install, 3-4
See also deprecated features required for Spreadsheet Add-In, 2-11
Java API sample programs, 7-8 Oracle Data Miner, ix, 3, 3-1, 2, 3-3, 4
Java API text mining, 7-10 Oracle Data Pump, 5-6
JDM 1.0 standard, 7-8 Oracle Database
JSR-73 specification, 7-8 Enterprise Edition, 2-1, 2-5
install, 2-1
K local, 3-2
remote, 3-3
k-Means, 7-6, 7-9 Oracle home directory, 2-5, 2-10, 2-11, 2-13, 3-6, 7-2,
7-4, 7-5
L Oracle Net, 3-3
Oracle Objects for OLE, 2-11
linear regression, 7-6, 7-7, 7-9
Oracle services, 2-2
logistic regression, 7-6, 7-7, 7-9
Oracle Spreadsheet Add-In for Predictive Analytics
loopback adapter, 2-2
install, 2-12
Net Service Name, 3-3, 3-8
M start, 2-12
market basket data, 7-12 Oracle Text, 7-7
memory tuning parameters, vi ORACLE_BASE, 2-5
Microsoft Excel, 1-4, 2-11, 2-12, 3-12 ORACLE_HOME, vii
Microsoft Windows, 2-1
Minimum Description Length, 7-6, 7-9 P
mining models
parallel execution, vi
about, 5-1
performance, vi
Index-2
PGA_AGGREGATE_TARGET, vi See Also One-Class SVM
PL/SQL API, 3-1, 6-1 See Support Vector Machine
PL/SQL sample programs, 7-6 SYS, x, 2-5
PL/SQL text mining, 7-8 system privileges, 4-3
PMML, ix, 5-11
port number, 3-2
T
PREDICT, 2-11, 2-13, 7-10
predictive analytics, 2-11, 3-3, 7-8, 7-9, 7-10 term extraction, 7-7, 7-8
privileges for data mining, x, 2-1, 3-1, 4-1, 5-7, 7-1 text mining, 7-7, 7-8, 7-9, 7-10, 7-13
privileges for exporting and importing, 5-7 transformations, 7-9
privileges for running sample programs, 7-1, 7-2 tuning, vi
production database, v, 2-1
PROFILE, 2-11, 2-13, 7-10 U
upgrading, 6-1
R USER_AUDIT_OBJECT, 5-6
regression, 7-6, 7-7, 7-9, 7-10 USER_MINING_MODEL_ATTRIBUTES, 5-1
USER_MINING_MODEL_SETTINGS, 5-1
USER_MINING_MODELS, 5-1
S USER_OBJ_AUDIT_OPTS, 5-6
sample mining models, 7-5 USER_OBJECTS, xi
sample programs, 2-10, 7-1 users, 2-1, 3-2, 5-7, 7-1, 7-2
configuration scripts, 4-3, 7-1, 7-2
data used by, 7-11
find, 7-2
install, 7-1
Java, 7-4, 7-8
PL/SQL, 7-6
run, 7-4, 7-5
user, 4-3, 7-1
sample schemas, 7-1
scoring
batch, v, vi
java programs, 7-9
model signature, 5-2
privileges for, 4-3
real-time, vi
single-row, v
Scoring Engine, 6-2
See also desupported features
security, x, 4-1
SELECT ANY MINING MODEL, 4-3
SELECT MINING MODEL, 4-4
SGA_TARGET, vi
SH schema, 7-1, 7-2, 7-11
shared cursor, vi
SID, 3-3
software location
See Oracle home directory
Spreadsheet Add-In
See Oracle Spreadsheet Add-In for Predictive
Analytics
start, 2-12
SQL AUDIT, 5-4
SQL COMMENT, 5-4
SQL Developer, 3-1, 3-2, 4
SQL*Plus, 3-1
starter database., 2-5
Support Vector Machine, 7-7, 7-8, 7-9, 7-11
SVM
Index-3
Index-4