Thursday, May 10, 2012

OIM: Helpful SQLs


Hi this Thiago Leoncio again: Goal of this article is provide you some helpful OIM Sqls. So, you will not waste your time with such complex Data Model as OIM is. Some of them you can use to OIM 10G and OIM11G.
Here you go:
====================================================================
OIM 10G (&& ||) OIM  11G SQLS:
====================================================================
The queries we are going to run to generate the high priority report for the analysts are:
1) All the pending open tasks assigned to GROUP
SELECT SCH_KEY,OSI_ASSIGNED_TO_UGP_KEY, UGP_NAME, OSI_ASSIGNED_DATE, REQ_KEY,OBJ.OBJ_NAME AS OBJ_NAME FROM OTI
INNER JOIN UGP ON UGP.UGP_KEY = OTI.OSI_ASSIGNED_TO_UGP_KEY
INNER JOIN OBJ ON OBJ.OBJ_KEY = OTI.OBJ_KEY
AND OSI_ASSIGN_TYPE = ‘Group’
AND PKG_TYPE=’Provisioning’
AND REQ_KEY IS NOT NULL
ORDER BY OSI_ASSIGNED_DATE
2) All the pending open tasks assigned to USERS
SELECT SCH_KEY,OSI_ASSIGNED_TO_USR_KEY, OSI_ASSIGNED_DATE,REQ_KEY,USR_FIRST_NAME,USR_LAST_NAME,USR_MANAGER_KEY,USR_EMAIL,OBJ.OBJ_NAME AS OBJ_NAME FROM OTI
INNER JOIN USR ON USR.USR_KEY = OTI.OSI_ASSIGNED_TO_USR_KEY
INNER JOIN OBJ ON OBJ.OBJ_KEY = OTI.OBJ_KEY
AND PKG_TYPE=’Provisioning’
AND REQ_KEY IS NOT NULL
ORDER BY OSI_ASSIGNED_DATE
3) All the pending approvals assigned to GROUP
SELECT SCH_KEY,OSI_ASSIGNED_TO_UGP_KEY, UGP_NAME,OSI_ASSIGNED_DATE, REQ_KEY,OBJ.OBJ_NAME AS OBJ_NAME FROM OTI
INNER JOIN UGP ON UGP.UGP_KEY = OTI.OSI_ASSIGNED_TO_UGP_KEY
INNER JOIN OBJ ON OBJ.OBJ_KEY = OTI.OBJ_KEY
AND OSI_ASSIGN_TYPE = ‘Group’
AND PKG_TYPE=’Approval’
AND REQ_KEY IS NOT NULL
ORDER BY OSI_ASSIGNED_DATE
4) All the pending approvals assigned to USERS
SELECT SCH_KEY,OSI_ASSIGNED_TO_USR_KEY, OSI_ASSIGNED_DATE, REQ_KEY,USR_FIRST_NAME,USR_LAST_NAME,USR_MANAGER_KEY,USR_EMAIL,OBJ.OBJ_NAME AS OBJ_NAME FROM OTI INNER JOIN USR ON USR.USR_KEY = OTI.OSI_ASSIGNED_TO_USR_KEY INNER JOIN OBJ ON OBJ.OBJ_KEY = OTI.OBJ_KEY AND PKG_TYPE=’Approval’ AND REQ_KEY IS NOT NULL ORDER BY OSI_ASSIGNED_DATE
5)Below Query will provide you the list of all the users and their resource Status.
SELECT usr.usr_login, usr.usr_first_name, usr.usr_last_name,
obj.obj_key, obj.obj_name, oiu.oiu_create, ost.ost_status, orc.orc_tos_instance_key
FROM orc, usr, obj, oiu, ost, obi WHERE orc.orc_key = oiu.orc_key AND oiu.usr_key = usr.usr_key AND
oiu.ost_key = ost.ost_key AND oiu.obi_key = obi.obi_key AND obi.obj_key = obj.obj_key
6)Below Query gives me all the records of users that are disabled/terminated prior to 15 days (from today) but their AD directory resource is not revoked yet.
SELECT usr.usr_login,usr.usr_first_name,usr.usr_last_name,usr.usr_end_Date,usr.usr_status “User Status”,ost.ost_status “AD Status”,sysdate – 15 “date comparison” FROM orc, usr, obj, oiu, ost, obi WHERE orc.orc_key = oiu.orc_key AND oiu.usr_key = usr.usr_key AND oiu.ost_key = ost.ost_key AND oiu.obi_key = obi.obi_key AND obi.obj_key = obj.obj_key AND obj.obj_name = ‘AD User’ AND ost.ost_status != ‘Revoked’ AND usr.usr_disabled = 1 AND usr.usr_end_date < sysdate – 15
7)SCHEDULED TASK
select tsk_classname,tsk_name,to_char(tsk_last_start_time,’DD/MM/YYYY
HH24:MI:SS’) STARTTIME,to_char(tsk_last_stop_time,’DD/MM/YYYY
HH24:MI:SS’) STOPTIME,to_char(tsk_next_start_time,’DD/MM/YYYY
HH24:MI:SS’) NEXTSTART,tsk_freqtype,tsk_disable from tsk;
====================================================================
These next SQLS are Oracle Database SQLS===>Database Metadata:
====================================================================
8)This SQL below will show you wait sessions(waiter) and who they are waiting(Holder)
SELECT
DECODE(request,0,’Holder: ‘,’Waiter: ‘)||sid sess,
id1, id2, lmode, request, type
FROM V$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type FROM V$LOCK WHERE request>0)
ORDER BY id1, request;
=
9)This is a easy way to find an object(example schedule) using Database Metadata to search some columns:
select * from user_tab_comments where comments is not null and upper(comments) like upper(‘%schedule%’) order by table_name
I hope this helps,
Thiago Leoncio

Friday, April 27, 2012

OIM11G: BulkLoad Utility


Hi, this is Thiago again. This article I will explain step-by-step how to use BulkLoad Utility. Please note that you can see the document and one video related of this task.
1-First Step: I will import the table I want to use into bulkLoad process:
[oracle@xpto bin]$ imp ONE_SCHEMA/****** file=HR_TEMP.dmp full=yes
Import: Release 11.1.0.7.0 – Production on Tue Mar 27 13:14:06 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 – Produc tion
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and UTF8 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export server uses AL16UTF16 NCHAR character set (possible ncharset conversion)
. importing DEV_OIM’s objects into OIM_SCHEMA
. importing DEV_OIM’s objects into OIM_SCHEMA
. . importing table “HR_TEMP” 20 rows imported
Import terminated successfully without warnings.
2-Environment Variables
[oracle@xpto bin]$ export ORACLE_HOME=[ORACLE-DATABASE-HOME]/product/11.1.0/db_1
[oracle@xpto bin]$ export JAVA_HOME=[OIM-JAVA-HOME]/oim11g_MWH/jdk160_24/
[oracle@xpto bin]$ export PATH=$JAVA_HOME/bin:$ORACLE_HOME/bin:$PATH
[oracle@xpto bin]$ cd [OIM-HOME]server/db/oim/oracle/Utilities/oimbulkload
Be careful with this information below:
…
34.5.2.2 Creating Database Tables As the Input Source
If you want to use a database table as the input source for loading OIM User data, then apply the following guidelines while creating the database table:
Create the table in the Oracle Identity Manager database.
The table must contain the following primary key column:
OIM_BLKLD_USRSEQ NUMBER(19)  <— very important ****
So,
ALTER TABLE HR_TEMP ADD(OIM_BLKLD_USRSEQ NUMBER(19));
The utility uses this column as the primary key. If required, you can use a database sequence to populate this column.
The rest of the columns must be the same as the ones in the USR table that you want to use. In other words, ignore optional USR_ columns that you do not want to include in the table that you create.
Note that the following default values are inserted into Oracle Identity Manager if the table does not contain values for these columns:
ORG_NAME: Xellerate Users
USR_TYPE: End-User
USR_STATUS: Active
USR_EMP_TYPE: Full-Time
…
———————————-
3-RUNNING BULKLOAD UTILITY:
———————————
cd [OIM_HOME]/server/db/oim/oracle/Utilities/oimbulkload/scripts
./oim_blkld.sh
***************************************
M A I N M E N U
***************************************
Select the operation to perform:
1) Load User Data
2) Load Account Data
3) Load Role Data
4) Load Role Hierarchy
5) Load Role Membership
6) Load Role Category
7) Generate Audit Snapshot
8) Exit
## Enter your option [1-8] :
1
—————————
Enter Database Details:
—————————
######################################################
###### ENTER DATABASE INFORMATION #######
######################################################
###### Get the ORACLE_HOME #######
## Enter the ORACLE HOME directory or Press [Enter] to
accept the default …/product/11.1.0/db_1 as ORACLE_HOME.
The ORACLE_HOME ==> …/oracle/product/11.1.0/db_1 IS VALID
###### Get the database connect string ######
## Enter the OIM database connect string in following format //HostIPAddress:Port/ServiceName
//THIAGO-OIMIP:1521/idm11gdb
ERROR ==> You must enter the name of the Oracle Identity Manager(OIM) database user
## Enter Oracle Identity Manager(OIM) database user name
OIM_SCHEMA
The OIM database user name entered is ==> The ORACLE_HOME ==> [ORACLE-DATABASE-HOME]/product/11.1.0/db_1 IS VALID
###### Get the Oracle Identity Manager password #######
*****
**** Password Entered ****
==== Attempting to connect to OIM database ====
Connection to OIM database is established successfully…
Compiling Procedures ….
Compilation done…
Enter password for OIM database user again :
**********************************
Select the input for user load:
**********************************
1) DB Table
2) CSV File
3) Exit
Enter your option (1, 2 or 3):
1
Enter the name of the DB table, to be used as load source:
HR_TEMP
Enter the comma separated column names, to be loaded, of table HR_TEMP :
USR_FIRST_NAME,USR_LAST_NAME,USR_LOGIN,USR_EMP_TYPE,ACT_KEY
Enter the Name of tablespace to be used for creating custom objects, by the utility [OIM_SCHEMA]:
OIM_SCHEMA is selected as default tablespace
Enter the batch size for processing ( default size is 10000 ) :
5000
Do you wish to insert log msgs (This will impact performance) (y/Y/n/N) :
y
————————————————————-
Utility expects you to create a User using OIM web console
and enter a password for this user, which will be used as
initial password for all users loaded using Bulk Load utility
————————————————————-
Enter the User ID (USR_LOGIN), of the user created from web console :
xelsysadm
Exception table name :HR_TEMP_EX1
Processing TMP table: HR_TEMP
********************************************************************************************************************
****** User load for table ‘HR_TEMP’ complete.
For details check file ../logs_20120306_1400/oim_blkld_user_load_summary.log ******
********************************************************************************************************************
****** RE-BUILDING INDEXES and ENABLING CONSTRAINTS ******
************** THIS MAY TAKE SOMETIME **************
****** Indexes and FK constraints successfully enabled ******
GO TO TABLE:OIM_BLKLD_LOG
Check the bulkload_usr table:

Reference:
LINK:http://docs.oracle.com/cd/E21764_01/doc.1111/e14309/bulkload.htm#CHDGFGHH
Video: http://www.youtube.com/watch?v=szVznoYwLEM
I hope this helps,
Thiago Leoncio