sabato 5 novembre 2022

ODI 12c - How Is It Possible To Restrict ODI User Access To Projects and Models?

Oggi vediamo la security di ODI  che permette di limitare gli accessi agli utenti ai vari oggetti di ODI. Supponiamo di dover:

  1. Limitare l'accesso ad un progetto 
  2. Limitare l'accesso ai model che contengono gli odidatastore
Come primo step creiamo un utente a cui permettere di visualizzare un solo progetto ed un solo folder.



Una volta creato l'utente TEST_AP questo risulta essere presente su ODI ma senza alcun privilegio compreso quello di CONNECT, quindi se proviamo a connetterci avremo un errore.




A questo punto occorre aggiungere all'utente i relativi profili di sicurezza presenti su ODI tra cui CONNECT affinchè si possa connettere ad ODI.


Assegnato il profilo CONNECT l'utente riesce a collegarsi ad ODI ma non vede nulla di quanto presente sul Work Repository.


A questo punto affinchè l'utente possa vedere quanto presente nel designer occorre associare i corretti profili. Per permettere la visualizzazione di un progetto occorre assegnare il profilo NG_DESIGNER che rispetto al profilo DESIGNER presente una serie di limitazioni.

Partiamo da quanto presente sul WorkRepository e facciamo in modo che l'utente creato TEST_AP visualizzi solo quanto presente nel progetto TEST2.



Assegnamo all'utente TEST_AP i profili NG_DESIGNER ed NG_METADATA_ADMIN



Una volta applicati all'utente i profili scelti effettuiamo un DRAG del progetto da selezionare sull'utente TEST_AP ed a questo punto nel momento in cui applichiamo le modifiche si aprirà un pannello con tutti i privilegi associati al progetto TEST2 da associare all'utente TEST_AP selezionato.



A questo punto selezioniamo le grant necessarie e se ci ricolleghiamo con l'utente TEST_AP avremo presente nel DESIGNER il progetto scelto.



Per assegnare i modelli occorre effettuare un drag del modello sull'utente cosi come avvenuto per il progetto ed anche in questo caso si aprire una finestra con tutte le grant associate al Model e da associare all'utente TEST_AP.




Se ci colleghiamo con l'utente TEST_AP questo è quanto visualizzeremo nel DESIGNER:



Tuttavia  anche se visualizziamo il progetto con i relativi Packages e Mapping e Modelli non possiamo crearne di nuovi in quanto non abbiamo le necessarie grant.





Per creare nuovi mapping o odidastore occorre modificare le grant presenti nei profili assegnati. 




Da quanto indicato sopra si evince che per la definizione precisa di grant occorre purtroppo visualizzare i vari profili o crearne di nuovi ma tuttavia occorre per forza definire prima tutte le grant e poi associarle ai vari utenti. Questo significa creare dei profili ad hoc da assegnare ai vari utenti, magari duplicando quelli originali messi a disposizione da ODI. Occorre però tenere presente che in caso di Upgrade i profili custom non verranno aggiornati:


Di seguito alcune note ODI da visionare prima di effettuare modifiche ai vari profili di sicurezza:
  • NOTE:423677.1 - How Is It Possible To Restrict ODI User Access To Projects and Models?
  • NOTE:423787.1 - Setting Up ODI User Privileges On Folder Objects
  • NOTE:424351.1 - How is it Possible to Inhibit ODI Users From Reverse Engineering Specific Models?
  • NOTE:424530.1 - How To Manage Access Authorizations On Object Instances In Different ODI Work Repositories
  • NOTE:424664.1 - Restricting Privileges to Users and Contexts in ODI with Security Manager
  • NOTE:823783.1 - Frequently Asked Questions Concerning ODI Users, Roles Credentials and Security







giovedì 16 giugno 2022

BIAPPS - INFORMATICA - Query per estrarre l'associativa Workflow / Mapping di Informatica

 Di seguito una query per poter associare i workflow ai mapping eseguiti in Informatica.

Tutto internamente ad Informatica:


-------------------------------------------------------------------

--- QUERY ESTRAZIONE associativa WF_MAPPING in INFORMATICA      ---

--- Da eseguire come utente sys sul database che contiene il repository di INFORMATICA   ---

-------------------------------------------------------------------

SELECT distinct 

        SUB.SUBJ_NAME subject_area_info ,

        WF.WORKFLOW_NAME, opb_task.TASK_NAME task_name_info,     

        OPB_TASK_INST.INSTANCE_NAME ,MAP.MAPPING_NAME

        ,MAP.MAPPING_ID, opb_task.IS_VALID,    opb_task.IS_ENABLED,

        OPB_OBJECT_TYPE.OBJECT_TYPE_NAME TASK_TYPE_NAME

    FROM

        INFA.OPB_TASK_INST, 

        INFA.OPB_OBJECT_TYPE, 

        INFA.OPB_TASK, 

        INFA.REP_WORKFLOWS WF,

        INFA.OPB_SUBJECT SUB,

        INFA.OPB_SESSION SESS, 

        INFA.OPB_MAPPING map

    WHERE

        OPB_TASK_INST.TASK_TYPE = OPB_OBJECT_TYPE.OBJECT_TYPE_ID

        AND OPB_TASK_INST.WORKFLOW_ID = OPB_TASK.TASK_ID

        AND OPB_TASK_INST.VERSION_NUMBER = OPB_TASK.VERSION_NUMBER

        AND OPB_TASK.IS_VISIBLE = 1

        AND WF.WORKFLOW_ID=OPB_TASK_INST.WORKFLOW_ID 

        AND WF.SUBJECT_ID=SUB.SUBJ_ID 

        AND OPB_TASK.SUBJECT_ID=SUB.SUBJ_ID

        AND SUB.SUBJ_ID=WF.SUBJECT_ID 

        AND OPB_TASK_INST.TASK_ID=SESS.SESSION_ID 

        AND MAP.MAPPING_ID=SESS.MAPPING_ID

        AND MAP.SUBJECT_ID=WF.SUBJECT_ID

        AND MAP.IS_VALID=1



giovedì 21 aprile 2022

RDBMS - Funzioni per criptare e decriptare una stringa

Di seguito un paio di funzioni per criptare e decriptare un testo.

Gli algoritmi utilizzati sono : 

A =DES3_CBC_PKCS5  D =ENCRYPT_AES256 +CHAIN_CBC +PAD_PKCS5;

Di seguito le funzioni:

--------------------------------------------------------------------------------

--- funzione per cifrare un testo

--- ALGORITMO = 

---    A =DES3_CBC_PKCS5

---    D =ENCRYPT_AES256 +CHAIN_CBC +PAD_PKCS5;

--- ES: select pkg_gest_plsql_odi.cifra('Questo è un testo molto lungo da cifrare, contiene anche ritorni a capo etc...',  'MIACHIAVE012345678901234','D') cifrato  from dual;

---------------------------------------------------------------------------------

 function CIFRA(in_str in VARCHAR2, 

                                 chiave in varchar2, 

                                 Algoritmo in char) 

                  return RAW is

 raw_da_cifrare RAW(2048) :=  UTL_RAW.CAST_TO_RAW(CONVERT(in_str,'AL32UTF8','WE8MSWIN1252'));

 raw_chiave     RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(chiave,'AL32UTF8','WE8MSWIN1252'));

 alg           PLS_INTEGER;

 v_err varchar2(4000):=null; 

BEGIN

 if Algoritmo = 'D' then

    alg := sys.DBMS_CRYPTO.DES3_CBC_PKCS5;

 elsif Algoritmo = 'A' then

    alg := sys.DBMS_CRYPTO.ENCRYPT_AES256 + 

           sys.DBMS_CRYPTO.CHAIN_CBC + 

           sys.DBMS_CRYPTO.PAD_PKCS5;

 else    RAISE_APPLICATION_ERROR(-20001,'Algoritmo non previsto, scegliere D o A!');

 end if;

 return dbms_crypto.Encrypt(raw_da_cifrare, alg, raw_chiave);

EXCEPTION

      WHEN OTHERS THEN

        V_ERR:='Errore => '||SQLERRM;

         RAISE_APPLICATION_ERROR(-20002,V_ERR); 

END CIFRA;

--------------------------------------------------------------------------------

--- funzione per decifrare un testo

--- ALGORITMO = 

---    A =DES3_CBC_PKCS5

---    D =ENCRYPT_AES256 +CHAIN_CBC +PAD_PKCS5;

-- ES:   select pkg_gest_plsql_odi.decifra('DC84F4C1CA98FC27208C3A5013F0A88720DCCE5E5C1E250ADD38352404F3CB73E6C4A97DE64E999997B43F5531EAE824D6A2EA7AC5EE78BF5DBC3CCB86CC131B89CBADD7295D71DBE57B7CDC1DFE3787',     'MIACHIAVE012345678901234','D')   from dual;

 function DECIFRA(in_raw in RAW, chiave in varchar2, Algoritmo in char) 

                  return VARCHAR2 is

 raw_chiave     RAW(128) :=   UTL_RAW.CAST_TO_RAW(CONVERT(chiave,'AL32UTF8','WE8MSWIN1252'));

 raw_decifrata  RAW(2048);

 alg            PLS_INTEGER;

 v_err varchar2(4000):=null; 

BEGIN

 if Algoritmo = 'D' then

    alg := DBMS_CRYPTO.DES3_CBC_PKCS5;

 elsif Algoritmo = 'A' then

    alg := DBMS_CRYPTO.ENCRYPT_AES256 + 

           DBMS_CRYPTO.CHAIN_CBC + 

           DBMS_CRYPTO.PAD_PKCS5;

 else

    RAISE_APPLICATION_ERROR(-20001,

                 'Algoritmo non previsto, scegliere D o A!');

 end if;


 raw_decifrata := dbms_crypto.Decrypt(hextoraw(in_raw), alg, raw_chiave);

 return CONVERT(UTL_RAW.CAST_TO_VARCHAR2(raw_decifrata),'WE8MSWIN1252','AL32UTF8');

EXCEPTION


      WHEN OTHERS THEN

         V_ERR:='Errore => '||SQLERRM;

         RAISE_APPLICATION_ERROR(-20002,V_ERR); 

END DECIFRA;

--------------------------------------------------------------------------------

Occorrono per funzionare logicamente le grant sul package DBMS_CRYPTO di sys.

lunedì 11 aprile 2022

RDBMS ORACLE 19c - Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in a PDB

Sulle nuove versioni del DB Oracle è possibile portare le dimensioni di alcuni Datatypes al limite massimo consentito, ad esempio le Tabelle possono avere i campi di tipo VARCHAR2 non più come limite massimo 4000 ma ad esempio 32k.

Per poter effettuare questa modifica però occorre settare il seguente parametro:

  • MAX_STRING_SIZE = EXTENDED

Di seguito viene indicato come attivare questo incremento di Maximun Size all'interno di un Pluggable DB.

Per incrementare la dimensione massima di una colonna con Datatype VARCHAR2, NVARCHAR2 o un RAW in un Pluggable DB effettuare i seguenti passi:

  1. Shut down the PDB.
  2. Reopen the PDB in migrate mode.

Note:

The following SQL statement can be used to reopen a PDB in migrate mode when the current container is the PDB:

ALTER PLUGGABLE DATABASE pdb-name OPEN UPGRADE;

  1. Change the setting of MAX_STRING_SIZE in the PDB to EXTENDED.
  2. Run the rdbms/admin/utl32k.sql script in the PDB. You must be connected AS SYSDBA to run the utl32k.sql script.
  3. Reopen the PDB in NORMAL mode.

Note:

The utl32k.sql script increases the maximum size of the VARCHAR2NVARCHAR2, and RAW columns for the views where this is required. The script does not increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

  1. Run the rdbms/admin/utlrp.sql script in the PDB to recompile invalid objects. You must be connected AS SYSDBA to run the script.

Di seguito alcuni riferimenti:

  • Oracle Multitenant Administrator's Guide for more information about modifying the open mode of PDBs.
  • Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in a PDB
    • https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/MAX_STRING_SIZE.html#GUID-D424D23B-0933-425F-BC69-9C0E6724693C
  • Database Reference
    • https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/MAX_STRING_SIZE.html#GUID-D424D23B-0933-425F-BC69-9C0E6724693C


venerdì 4 marzo 2022

ORA 12c - Oracle Pluggable Database 12c Automatic Startup

SQL*Plus: Release 12.1.0.2.0 Production on Fri Mar 4 08:41:43 2022

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> ALTER PLUGGABLE DATABASE REPOSORCL OPEN READ WRITE;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME   OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

3 REPOSORCL   READ WRITE NO

SQL> alter pluggable database REPOSORCL save state;

Pluggable database altered.

SQL>  select con_name,state from dba_pdb_saved_states;

CON_NAME STATE

---------------   -------------

REPOSORCL   OPEN

SQL> shutdown immediate;

Pluggable Database closed.

SQL> startup

Pluggable Database opened.

SQL> select con_name,state from dba_pdb_saved_states;

CON_NAME      STATE

---------------   -------------

REPOSORCL   OPEN

SQL> exit

Per eliminare lo startupt automatico occorre effettuare la DISCARD dello stato del Pluggable.

DISCARD STATO 

alter pluggable database REPOSORCL DISCARD state;