Visualizzazione post con etichetta SQL*Plus. Mostra tutti i post
Visualizzazione post con etichetta SQL*Plus. Mostra tutti i post

martedì 2 aprile 2013

Tip: Scheduling OWB jobs using SQLPlus

Scheduling jobs in OWB 11g using the Calendar feature is possible only if you have bought the Data Integrator Enterprise Edition, which is not the case of the project I am currently working on.

Error you get when you try to create a new Calendar Module in OWB 11g without Data Integrator EE license

You can still schedule jobs by using a SQLPlus script which can then be called in a .bat or Shell script and scheduled using Windows Scheduler or Crontab in Unix.
In OWB 11g, we can find a SQL script ready to use in [OWBHOME]\owb\rtp\sql. The script you need is called: sqlplus_exec_template.sql
The script can be executed only by a Workspace Owner or a Workspace user with Execute privileges.
The script uses the following parameters:
  • WORKSPACE 
  • Workspace in which the job is to run: e.g. MY_WORKSPACE Make sure you specify the right Workspace Name. You can check it by executing:  

    SELECT * FROM ALL_IV_WORKSPACES
  • LOCATION_NAME 
  • Physical Name of the Location to which this task was deployed: e.g. MY_WAREHOUSE  
  • TASK_TYPE   
    • PLSQLMAP - OWB PL/SQL Mapping
    • SQLLOADERCONTROLFILE - OWB SQL*Loader Mapping
    • PROCESSFLOW - OWB ProcessFlow
    • ABAPFILE - OWB SAP Mapping
    • DATAAUDITOR - OWB DataAuditor Mapping
    • SCHEDULEDJOB - OWB Scheduled Job
    • CTMAPPING  - OWB Template Mapping
  • TASK_NAME
  • Physical Name of the Deployed Object.e.g. MY_MAPPING. Make sure you specify the TASK_NAME in the following format: [PARENT_TASK]/TASK_NAME
  • SYSTEM_PARAMS { , | (name = value [, name = value]...)}
  • CUSTOM_PARAMS { , | (name = value [, name = value]...)}
The following example shows how to call the DIM_ALL workflow under DIM_FACT workflow package deployed in WFS_LOCATION location in MYWKS workspace.

SQL> @sqlplus_exec_template.sql MYWKS WFS_LOCATION PROCESSFLOW "DIM_FACT
/DIM_ALL" "," ","


The script calls functions from the OWBSYS.wb_rt_script_util package so you may need to grant the right privilege to the OWB User.

giovedì 24 gennaio 2013

Tip: How to get directoy listed in SQL*Plus

Today I needed to launch several .sql scripts from the same directory. I needed to get the script names in a quick way, and possibly being able to copy and paste them.
The solution was using:

SQL> host dir
 El volumen de la unidad C es OS
 El número de serie del volumen es: 6A31-3504

 Directorio de C:\Users\cristina\Documents\

24/01/2013  14:02    <DIR>          .
24/01/2013  14:02    <DIR>          ..
23/01/2013  11:44           291.729 acciones.sql
23/01/2013  18:17            17.826 canales_comunicacion.sql
23/01/2013  18:17           292.138 etapas.sql
24/01/2013  12:14       126.673.515 exp1980.sql
24/01/2013  12:23        91.241.885 exp1985.sql
24/01/2013  12:29        38.205.132 exp1989.sql


SQL*Plus HOST command allows you to execute OS commands such as dir, cd, etc.