Query objectGUID using dbms_ldap package

Hi
I've managed to retrieve the objectGUID from Active Directory using the DBMS_LDAP package.
It is returned in this format: 8FDD7ACDA0749648B136E0AD6847BD64
How can I use this value in a filter for dbms_ldap.search_s?
objectGUID=8FDD7ACDA0749648B136E0AD6847BD64 does not work,
I've also tried escaping the value \8F\DD\... and \\8F\\DD\\...
Any one know what I need to do?
Thanks

I already have the HEX value of the GUID - the problem is the function dbms_ldap.search_s appears to be trying to match the objectGUID which has been converted to ascii.
I can do partial matches like objectGUID=cf*
But that is matching an ascii representation of the GUID: eg. cf¿t¿H¿6¿@¿D
And nothing can match the upside down question marks.
There must be another way - or another unique identifier to compare/filter by.

Similar Messages

  • Extracting OBJECTGUID using DBMS_LDAP package

    Hi,
    My final goal of this exercise is to search a LDAP for an objectGUID and get the sAMAccountName of the user.
    But to get the things started I'm trying the easier way and doing the reverse..
    But when I extract objectGUID by searching for sAMAccountName in LDAP - I get the objectguid in the following two formats.
    1. utl.cast_to_raw(substr(temp_vals(i),1,200)): 7E0C3F3F3F3F3F31333F783F
    2. substr(temp_vals(i),1,200) : ~ ?????13?x?
    But I would like to extract the GUID in the escaped format \7e\0c\3f\3f.................... format and which is 48 characters long. Can someone point me in the right direction as to how I can achieve my result both ways.??
    Thanks in Advance
    Any Pointers will be appreciated!!

    Thanks Justin and Billy for your replies..
    Here is the code I'm using. As mentioned earlier I would like to obtain my results in escaped format e.g. (\a6\53\6d\40\03\e6\83\45\ae\9a\32\a5\95\6b\e8\f1)
    This is because a third party application stores user id's in the above format and I would like to join my retrieved results from LDAP with it. Once I achieve this I would also like to do the reverse i.e. pass the escaped values and retrieve the user information from LDAP.
    Currently when I pass sAMAccountName, I do get the following formats based on what function I use.
    1. (SUBSTR(temp_vals(i), 1, 200) -> Results in ~ ?????13?x?
    2. utl_raw.cast_to_raw(SUBSTR(temp_vals(i), 1, 200)) -> Results in 7E0C3F3F3F3F3F31333F78EF
    I simply cannot escape the values given in step two because I believe both are in different format as binary, raw string etc..
    Please let me know if this is achievable ??
      CREATE OR REPLACE PROCEDURE "Schema"."LDAP_PROC" IS
        ldap_host       VARCHAR2(512);          -- The LDAP Directory Host
        ldap_port       VARCHAR2(512);          -- The LDAP Directory Port
        ldap_user       VARCHAR2(512);          -- The LDAP Directory User
      ldap_guid VARCHAR2(512); -- To store the GUID
        ldap_passwd     VARCHAR2(512);          -- The LDAP Directory Password
        ldap_baseDN     VARCHAR2(512);          -- The starting (base) DN
        retval          PLS_INTEGER;            -- Used for all API return values.
        my_session      DBMS_LDAP.SESSION;      -- Used to store our LDAP Session
        res_attrs       DBMS_LDAP.STRING_COLLECTION;    -- A String Collection used
                                                        --   to specify which
                                                        --   attributes to return
                                                        --   from the search.
                                                        --   attribute.
    search_filter   VARCHAR2(512);          -- A simple character string used to
                                                --   store the filter (criteria) for
                                                --   the search.
        res_message     DBMS_LDAP.MESSAGE;      -- Used to store the message
                                                --   (results) of the search.
        temp_entry      DBMS_LDAP.MESSAGE;      -- Used to store entries retrieved
                                                --   from the LDAP search to print
                                                --   out at a later time.
        entry_index     PLS_INTEGER;            -- Used as a counter while looping
                                                --   through each entry. As we
                                                --   retrieve an entry from the LDAP
                                                --   directory, we increase the
                                                --   counter by one.
        temp_dn         VARCHAR2(512);          -- After each entry is retrieved
                                                --   from the LDAP directory (from
                                                --   the search), we want to use
                                                --   this variable to extract, store
                                                --   and print out the DN for each
                                                --   entry.
        temp_attr_name  VARCHAR2(512);          -- After retrieving an entry from
                                                --   LDAP directory, we will want to
                                                --   walk through all of the
                                                --   returned attributes. This
                                                --   variable will be used to store
                                                --   each attribute name as we loop
                                                --   through them.
        temp_ber_elmt   DBMS_LDAP.BER_ELEMENT;
        attr_index      PLS_INTEGER;            -- Used as a counter variable for
                                                --   each entry returned for each
                                                --   entry.
       temp_vals       DBMS_LDAP.STRING_COLLECTION;    -- Used to extract, store,
      --  temp_vals       DBMS_LDAP.BINVAL_COLLECTION;                                                --   and print each of the
                                                        --   values from each
                                                        --   attribute.
    BEGIN
        DBMS_OUTPUT.ENABLE(1000000);
        retval := -1;
         ldap_host    := 'LDAP_Server_name';
        ldap_port    := '389';
        ldap_user    := 'Username';
        ldap_passwd  := 'Password';
        ldap_baseDN  := 'DC=XXX,DC=XX,DC=XX';
        -- Print out variables.
        DBMS_OUTPUT.PUT_LINE('DBMS_LDAP Search Example');
        DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
        DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Host ', 25, ' ') || ': ' || ldap_host);
        DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Port ', 25, ' ') || ': ' || ldap_port);
        DBMS_OUTPUT.PUT_LINE(RPAD('LDAP User ', 25, ' ') || ': ' || ldap_user);
        DBMS_OUTPUT.PUT_LINE(RPAD('LDAP Base ', 25, ' ') || ': ' || ldap_baseDN);
         DBMS_LDAP.USE_EXCEPTION := TRUE;
        -- Obtain an LDAP session. The init() function initializes a session with an
        -- LDAP server. This actually establishes a connection with the LDAP server
        -- and returns a handle to the session which can be used for further
        -- calls into the API.
        my_session := DBMS_LDAP.INIT(ldap_host, ldap_port);
        DBMS_OUTPUT.PUT_LINE (
            RPAD('LDAP Session ', 25, ' ') || ': ' ||
            RAWTOHEX(SUBSTR(my_session, 1, 16)) ||
            ' - (returned from init)'
        -- Bind to the directory. The function simple_bind_s can be used to perform
        -- simple username/password based authentication to the directory server.
        -- The username is a directory distinguished name. This function can be
        -- called only after a valid LDAP session handle is obtained from a call to
        -- DBMS_LDAP.init(). If the connection was successful, it will return:
        -- DBMS_LDAP.SUCCESS. This function can raise the following exceptions:
        --      invalid_session : Raised if the session handle ld is invalid.
        --      general_error   : For all other errors. The error string associated
        --                        with this exception will explain the error in
        --                        detail.
        retval := DBMS_LDAP.SIMPLE_BIND_S(my_session, ldap_user, ldap_passwd);
        DBMS_OUTPUT.PUT_LINE(
            RPAD('simple_bind_s Returned ', 25, ' ') || ': '|| TO_CHAR(retval)
        -- Before actually performing the sort, I want to setup the attributes I
        -- would like returned. To do this, I declared a "String Collection" that
        -- will be used to store all of the attributes I would like returned.
        --      If I wanted to return all attributes, I would specify:
        --          res_attrs(1) := '*';
        --      If I wanted multiple (specified) attributes, I would specify:
        --          res_attrs(1) := 'cn';
        --          res_attrs(2) := 'loginShell';
        --res_attrs(1) := 'uid';
       -- res_attrs(2) := 'cn';
        res_attrs(1) := 'objectGUID';
       -- res_attrs(2) := 'sAMAccountName';
        -- Finally, before performing the actual search, I want to specify the
        -- criteria I want to search on. This will be passed as the "filter"
        -- parameter to the actual search.
        --      If you wanted all of the entries in the directory to be returned,
        --      you could simply specify:
        --          search_filter   := 'objectclass=*';
        --      You could also refine your search my specify a criteria like the
        --      following:
        --          search_filter   := 'cn=*Hunter*';
        search_filter  :=  'sAMAccountName=*282618726*';
        -- Finally, let's issue the search. The function search_s performs a
        -- synchronous search in the LDAP server. It returns control to the PL/SQL
        -- environment only after all of the search results have been sent by the
        -- server or if the search request is 'timed-out' by the server.
        -- Let's first explain some of the incoming parameters:
        --      ld       : A valid LDAP session handle.
        --      base     : The dn of the entry at which to start the search.
        --      scope    : One of SCOPE_BASE     (0x00)
        --                        SCOPE_ONELEVEL (0x01)
        --                        SCOPE_SUBTREE  (0x02)
        --                 indicating the scope of the search.
        --      filter   : A character string representing the search filter. The
        --                 value NULL can be passed to indicate that the filter
        --                 "(objectclass=*)" which matches all entries is to be
        --                 used.
        --      attrs    : A collection of strings indicating which attributes to
        --                 return for each matching entry. Passing NULL for this
        --                 parameter causes all available user attributes to be
        --                 retrieved. The special constant string NO_ATTRS ("1.1")
        --                 MAY be used as the only string in the array to indicate
        --                 that no attribute types are to be returned by the server.
        --                 The special constant string ALL_USER_ATTRS ("*") can be
        --                 used in the attrs array along with the names of some
        --                 operational attributes to indicate that all user
        --                 attributes plus the listed operational attributes are to
        --                 be returned.
        --      attronly : A boolean value that MUST be zero if both attribute types
        --                 and values are to be returned, and non-zero if only types
        --                 are wanted.
        --      res      : This is a result parameter which will contain the results
        --                 of the search upon completion of the call. If no results
        --                 are returned, res is set to NULL.
        -- Now let's look at the two output parameters:
        --      PLS_INTEGER
        --      (function return)   : DBMS_LDAP.SUCCESS if the search operation
        --                            succeeded. An exception is raised in all other
        --                            cases.
        --      res (OUT parameter) : If the search succeeded and there are entries,
        --                            this parameter is set to a NON-NULL value
        --                            which can be used to iterate through the
        --                            result set.
        retval := DBMS_LDAP.SEARCH_S(
              ld         =>  my_session
            , base       =>  ldap_baseDN
            , scope      =>  DBMS_LDAP.SCOPE_SUBTREE
            , filter     =>  search_filter
            , attrs      =>  res_attrs
            , attronly   =>  0
            , res        =>  res_message
        DBMS_OUTPUT.PUT_LINE(
            RPAD('search_s Returned ', 25, ' ') || ': ' || TO_CHAR(retval)
        DBMS_OUTPUT.PUT_LINE (
            RPAD('LDAP Message ', 25, ' ') || ': ' ||
            RAWTOHEX(SUBSTR(res_message, 1, 16)) ||
            ' - (returned from search_s)'
        -- After the search is performed, the API stores the count of the number of
        -- entries returned.
        retval := DBMS_LDAP.COUNT_ENTRIES(my_session, res_message);
        DBMS_OUTPUT.PUT_LINE(
            RPAD('Number of Entries ', 25, ' ') || ': ' || TO_CHAR(retval)
        DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
        -- Retrieve the first entry.
        temp_entry := DBMS_LDAP.FIRST_ENTRY(my_session, res_message);
        entry_index := 1;
        -- Loop through each of the entries one by one.
        WHILE temp_entry IS NOT NULL LOOP
            -- Print out the current entry.
            temp_dn := DBMS_LDAP.GET_DN(my_session, temp_entry);
            DBMS_OUTPUT.PUT_LINE (' dn: ' || temp_dn);
            temp_attr_name := DBMS_LDAP.FIRST_ATTRIBUTE(
                  my_session
                , temp_entry
                , temp_ber_elmt
            attr_index := 1;
            WHILE temp_attr_name IS NOT NULL LOOP
                temp_vals := DBMS_LDAP.GET_VALUES(my_session, temp_entry, temp_attr_name);
                IF temp_vals.COUNT > 0 THEN
                    FOR i IN temp_vals.FIRST..temp_vals.LAST LOOP
                        DBMS_OUTPUT.PUT_LINE(
                            RPAD('   ' || temp_attr_name, 25, ' ') ||
                            ': ' ||(SUBSTR(temp_vals(i), 1, 200)
    -- (SUBSTR(temp_vals(i), 1, 200) -> Results in ~ ?????13?x?
    --utl_raw.cast_to_raw(SUBSTR(temp_vals(i), 1, 200)) -> Results in 7E0C3F3F3F3F3F31333F78EF
    --BUT i WOULD LIKE TO GET MY RESULTS BACK IN THE FOLLOWING FORMAT
    --\a6\53\6d\40\03\e6\83\45\ae\9a\32\a5\95\6b\e8\f1
    --The format given above is an example only...
      END LOOP;
                END IF;
                temp_attr_name := DBMS_LDAP.NEXT_ATTRIBUTE(   my_session
                                                            , temp_entry
                                                            , temp_ber_elmt);
                attr_index := attr_index + 1;
            END LOOP;
            temp_entry := DBMS_LDAP.NEXT_ENTRY(my_session, temp_entry);
            DBMS_OUTPUT.PUT_LINE('=======================================================================');
            entry_index := entry_index + 1;
        END LOOP;
        -- Unbind from the directory
        retval := DBMS_LDAP.UNBIND_S(my_session);
        DBMS_OUTPUT.PUT_LINE(RPAD(
            'unbind_res Returned ', 25, ' ') || ': ' ||
            TO_CHAR(retval)
        -- Handle Exceptions
        EXCEPTION
            WHEN OTHERS THEN
                DBMS_OUTPUT.PUT_LINE('');
                DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
                DBMS_OUTPUT.PUT_LINE('Exception Encountered');
                DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
                DBMS_OUTPUT.PUT_LINE('  Error code    : ' || TO_CHAR(SQLCODE));
                DBMS_OUTPUT.PUT_LINE('  Error code    : ' || TO_CHAR(SQLCODE));
                DBMS_OUTPUT.PUT_LINE('  Error Message : ' || SQLERRM);
                DBMS_OUTPUT.PUT_LINE('  Exiting.');
    END;
    END LOOP;
                END IF;
                temp_attr_name := DBMS_LDAP.NEXT_ATTRIBUTE(   my_session
                                                            , temp_entry
                                                            , temp_ber_elmt);
                attr_index := attr_index + 1;
            END LOOP;
            temp_entry := DBMS_LDAP.NEXT_ENTRY(my_session, temp_entry);
            DBMS_OUTPUT.PUT_LINE('=======================================================================');
            entry_index := entry_index + 1;
        END LOOP;
        -- Unbind from the directory
        retval := DBMS_LDAP.UNBIND_S(my_session);
        DBMS_OUTPUT.PUT_LINE(RPAD(
            'unbind_res Returned ', 25, ' ') || ': ' ||
            TO_CHAR(retval)
        -- Handle Exceptions
        EXCEPTION
            WHEN OTHERS THEN
                DBMS_OUTPUT.PUT_LINE('');
                DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
                DBMS_OUTPUT.PUT_LINE('Exception Encountered');
                DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------------');
                DBMS_OUTPUT.PUT_LINE('  Error code    : ' || TO_CHAR(SQLCODE));
                DBMS_OUTPUT.PUT_LINE('  Error code    : ' || TO_CHAR(SQLCODE));
                DBMS_OUTPUT.PUT_LINE('  Error Message : ' || SQLERRM);
                DBMS_OUTPUT.PUT_LINE('  Exiting.');
    END;

  • Query slow using SDO_GEOM package

    Hi,
    i've a query that extract this data from a table:
    SDO_GEOM.sdo_centroid (geometry, 0.5).sdo_point.x
    It's very, but very slow, about 15sec for 300 records.
    Remove this package from select it's very fast.
    Any ideas to how tuning spacial package??
    TNX

    With column in select:
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.05          0        606          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       14      1.31       5.32          0         36          0         184
    total       16      1.33       5.37          0        642          0         184
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 119
    Rows     Row Source Operation
        184  TABLE ACCESS FULL CAA_PA (cr=129 pr=0 pw=0 time=2880603 us cost=7 size=219 card=1)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                      14        0.00          0.00
      Disk file operations I/O                        1        0.00          0.00
      SQL*Net message from client                    14       24.76         24.80
    ********************************************************************************whitout package in select :
    SELECT ID2 AS ID_COLUMN,
             '' AS SYMBOL,
             ICONCODE AS IMAGECODE_COLUMN,
             ID_UNICO AS TOOLTIP_COLUMN,
             1121 AS QUERYID,
             '0' AS HASACTIONS,
             1 AS ALIGNMENT
        FROM IDT_SETPRIMARIO.V_CAA_XY
       WHERE     X > 1567630
             AND X < 1872370
             AND Y > 4998933
             AND Y < 5139066
             AND ICONCODE IS NOT NULL
    ORDER BY ICONCODE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.02          0        370          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       14      0.83       1.82          0        121          0         184
    total       16      0.84       1.85          0        491          0         184
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 119
    Rows     Row Source Operation
        184  TABLE ACCESS FULL CAA_PA (cr=121 pr=0 pw=0 time=1473516 us cost=7 size=219 card=1)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                      14        0.00          0.00
      Disk file operations I/O                        1        0.00          0.00
      SQL*Net message from client                    14       20.27         20.30
    ********************************************************************************

  • Please help with assigning user to a group in AD using dbms_ldap

    Dear gurus of Apex and LDAP!
    Please help me a bit.
    I managed to create any user in AD from Apex using dbms_ldap package and set many of his attributes. But I cannot set that my user belongs to specific group, let's say MY_GROUP. I guess the name of attribute for group is 'member' or 'memberOf', so I tried them both in the same way as I've done for other attributes:
    v_vals(1) := 'MY_GROUP';
    DBMS_LDAP.populate_mod_array(v_array, DBMS_LDAP.MOD_ADD, 'member', v_vals);
    I've got LDAP client/server error: CONSTRAINT violation. 000020B5: AtrErr: DSID-031516FC, #1: 0: 000020B5:
    DSID-031516FC, problem 1005 (CONSTRAINT_ATT_TYPE), DATA 0, Att 1f (MEMBER)
    v_vals(1) := 'MY_GROUP';
    DBMS_LDAP.populate_mod_array(v_array, DBMS_LDAP.MOD_ADD, 'memberOf', v_vals);
    I've got LDAP client/server error: DSA IS unwilling TO perform. 0000209A: SvcErr: DSID-031A0929, problem 5003 (WILL_NOT_PERFORM), DATA 0
    After that I've tried to extend group name to string, which is shown in LDAP browser for attribute 'memberOf' (when I've added it manualy):
    v_vals(1) := 'CN=MY_GROUP,OU=GROUPS,OU=Allianz,DC=allianz,DC=com';
    DBMS_LDAP.populate_mod_array(v_array, DBMS_LDAP.MOD_ADD, 'member', v_vals);
    I've got LDAP client/server error: OBJECT CLASS violation. 0000207D: UpdErr: DSID-03150913, problem 6002 (OBJ_CLASS_VIOLATION), DATA 0
    v_vals(1) := 'CN=MY_GROUP,OU=GROUPS,OU=Allianz,DC=allianz,DC=com';
    DBMS_LDAP.populate_mod_array(v_array, DBMS_LDAP.MOD_ADD, 'memberOf', v_vals);
    LDAP client/server error: DSA IS unwilling TO perform. 0000209A: SvcErr: DSID-031A0929, problem 5003 (WILL_NOT_PERFORM), DATA 0
    I've also tried some other variants (without 'CN=' and without 'OU=GROUPS,OU=Allianz'), but still no success.
    Search of this forum and even google didn't help either :(
    Please, help me to find the correct syntax for it or tell me if it's not possible.
    Thanx in advance,
    Vladimir

    Vladimir ,
    firstly the attributes member and memberOf are special attributes in AD having a set of predefined values. Hence an error will be thrown if you try to assign them values like 'MY_GROUP'. There are two basic solutions to this problem : Either you define an OU in your AD which will act as your 'MY_GROUP'. This is a quick fix solution and is not robust at all. The other solution is to add your own property in the tree , something like 'roleCode', you can then assign it any value you want.
    But the problem now is, AD does not allow addition of new attributes in the structure. You have to use ADAM in for this and you can specify a common linking mechanism between AD and ADAM now such as email address can act as the link between both the directories.
    Hope this helps
    Shantanu

  • Using DBMS_LDAP in Apex

    Hi there
    I have the following problem. I have a simple function which uses DBMS_LDAP package. For testing purposes, when I call the function from sql*plus or sqldeveloper, it works fine and I can authenticate the user in AD. However, when using the same function call in Apex, the screen 'freezes' for about a minute and returns 'IE cannot display page' message. It looks like getting time out. Is this a network/firewall issue? Is Apex using some kind of proxy and cannot establiss LDAP session? Your help is really appresiated much.
    thanks, Ed

    Joel
    thank you for clarification. Really appreciate your help. I was able to get the list. Here is the procedure. The line that fails is highlighed. Basically it can't initialize the session on AD server...
    declare
         p_username          varchar2(25):='test';
         p_password          varchar2(25):='test';
         l_user               varchar2(256);
         l_ldap_server     varchar2(256)     := 'AD host';
         l_domain          varchar2(256)     := 'domain';
         l_ldap_port          number               := 389;
         l_retval          pls_integer;
         l_session          dbms_ldap.session;
         l_cnt               number;
    begin
    --     l_retval := dbms_ldap.unbind_s( l_session );
         l_user               := p_username||'@'||l_domain;
    *     l_session          := dbms_ldap.init( l_ldap_server, l_ldap_port ); -- start session*     
    l_retval          := dbms_ldap.simple_bind_s( l_session, l_user, p_password ); -- auth as user
         l_retval          := dbms_ldap.unbind_s( l_session ); -- unbind
         dbms_output.put_line( 'yes');
    exception when others then
    dbms_output.put_line( 'no');
    raise_application_error(-20101, 'invalid user');
         end;
    thanks, Ed

  • Using a packaged function in a query

    Hi ,
    I have read the following statement (correct option for the question)in 1z0-147 questions.
    The question is :: WHEN USING A PACKAGED FUNCTION IN A QUERY which of the following is true ::
    The packaged function cannot execute DML statements against the table that is being queriedI tried the following to understand the above statement
    create or replace package test_pk is
    function fn_test(i number) return number ;
    end;
    create or replace package body test_pk is
    function fn_test (i number) return number is
      j number:=1;
    begin
        insert into a values(200,300);
        commit;
       return j;
       end;
    end test_pk;  Upon executing the above function in the select statement
    select TEST_PK.FN_TEST(1) from dualI got the error saying that Can't perform DML Inside SElect
    Is this example for the above statement is TRUE ????
    Could you please explain me if my example is wrong
    Thanks
    Edited by: Smile on Nov 22, 2012 9:47 AM

    No, it is not true. Any function used in SQL is not allowed to perform a DML operation other than SELECT regardless if it is against the table that is being queried or not. Select is allowed against any table. And function in your example does INSERT which is not allowed. Also, Any function used in SQL is not allowed to perform commit/rollback/savepoint.
    SY.
    Edit: unless function is autonomous transaction.
    Edited by: Solomon Yakobson on Nov 22, 2012 10:22 AM

  • Need to generate the excel file with diffrent sheets using utl_file package

    Hi,
    Sorry for previous message in which I had missed the usage of " UTL_FILE " package
    I need to generate the excel file with diffrent sheets . Currently I am generating the data in three diffrent excel files using
    " UTL_File " package and my requirement is to generate this in a single excel file with diffrent sheets.
    Please help on this
    Thanks & Regards,
    Krishna Vyavahare

    Hello 10866107,
    at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the packages behind second and fourth link support more than one worksheet.
    Regards
    Marcus

  • How could I Encrypt the data of SDO_GEOMETRY type using DBMS_CRYPTO package

    Hi:
    I want to Encrypt the data of SDO_GEOMETRY object type using DBMS_CRYPTO package.
    What could I do? hope anyone can help me,give me a suggestions!
    thanks in advance.
    lgs

    well, the spatial api would not be able to handle this data anymore, so what you are trying to do is converting an SDO_GEOMETRY to some cryptable user type (see http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm#sthref1506) and encrypting this.
    Before using the SDO_GEOMETRY type will have to decrypt and reconvert it again and pass it to the spatial query or function.

  • ORA-02019 while using DBMS_FILE_TRANSFER Package.

    Hi,
    I am trying to transfer the datafiles from 10.2.0.3 database residing on File-system to 11gR2 database residing on ASM. Both the DBs are on Different machines across datacenters.
    I am trying to use Transportable Tablespace to move the data. As a part of it, I am trying to use DBMS_FILE_TRANSFER package to move the 10gR2 files to 11gR2 ASM.
    I am getting the below issue while doing so:
    SQL> exec sys.DBMS_FILE_TRANSFER.GET_FILE('sdir','data01.dbf','tdir','data01.dbf','RECDB');
    BEGIN sys.DBMS_FILE_TRANSFER.GET_FILE('sdir','data01.dbf','tdir','data01.dbf','RECDB'); END;
    ERROR at line 1:
    ORA-02019: connection description for remote database not found
    ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 37
    ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 132
    ORA-06512: at line 1
    Above SQL was executed from Target Host (11gR2) to GET file from 10gR2. The above directory objects point to correct locations on respective hosts.
    RECDB - it is the DB link which is owned by SYSTEM user and will connect to 10gR2 DB as SYSTEM user.
    Strange thing is when i am querying the source 10gR2 DB from Target DB using Db link, IT is WORKING fine
    SQL> select name from v$database@RECDB ;
    NAME
    POCREC01
    Elapsed: 00:00:00.15
    SQL> select * from dual@RECDB;
    D
    X
    Elapsed: 00:00:00.12
    I also have TNS entry in target tnsnames.ora as:
    POCREC01 =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = pocserver.com)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = pocrec01)
    SQL> create database link RECDB connect to system identified by <password> using 'POCREC01';
    Database link created.
    SQL> select * from all_db_links;
    OWNER
    DB_LINK
    USERNAME
    HOST
    CREATED
    SYSTEM
    RECDB
    SYSTEM
    POCREC01
    05-JAN-11
    So, I want help on whether above issue is a BUG with Package (checked in Metalink and cannot find anything) OR am I doing something wrong??
    Thanks

    Can you please use "create public database link " to create the db link as a PUBLIC link and retry.

  • DBMS_LDAP package documentation and samples

    Where can I find the DBMS_LDAP package documentation and samples to use it to connect to OID from pl/sql blocks.
    TIA,
    Nishant

    I have been successful using the PL/SQL DBMS_LDAP utilities and enhancing the included examples to bulk create portal users as well as adding them to a default portal group as outlined in the DBMS_LDAP demo examples (search.sql, trigger.sql, empdata.sql).
    Using this PL/SQL trigger on the EMP table, I can add, delete or modify various user entries. However, while I can add a user to a default portal group, I have been unsuccessful in deleting a user from a group as well as modifying a users default group by deleting their "uniquemember" entry from one group and adding it to another using the DBMS_LDAP procedures.
    Has anyone deleted a user from an existing group and how is this done programatically using the DBMS_LDAP utilities? Also, but less important, is there a way to programmatically modify a user from one portal group to another?
    I don't necessarily want the code - just the method of doing this. Do I have to read in all of the 'uniquemember' attributes from the group (via DBMS_LDAP.populate_mod_array, for example), then manipulate the list and write it back. Or, is there a function that will allow me to delete or modify an entry in the 'uniquemember' attribute.
    Regards,
    Edward Girard

  • DBMS_LDAP package

    Hi,
    Please, where can I find the DBMS_LDAP package. I've Oracle 8.1.7 with Win2000?
    Am I oblige to install Oracle Internet Directory to use it?
    Thanks.

    Dear V Garcia
    I would like to ask you, how we could load DBMS_LDAP package into our from application, we developed an application using Oracle Forms (6i) deployed into Oracle9i AS (1.0.2.2.2.A) connected to Oracle8i Database server (Release 8.1.7). The problem is how I can use Oracle forms to authenticate users login using LDAP instead of traditional user authentication using forms trigger and database tables. I tried to find any document(s) that help in using LDAP through Oracle Forms6i without any success. I appreciate any Help

  • Retrieve LDAP data in Chunks using DBMS_LDAP

    Need help in getting the LDAP data in Chunks using the DBMS_LDAP. The reason being i have over 8000 records in the AD and it is configured that i cannot retrieve more than 1000 at a stretch.
    The AD administrator had given me an option of fetching it based on the pagesize which they use on AD.
    Dim DirSearcher As New DirectorySearcher()
    DirSearcher.SearchRoot = New DirectoryEntry("LDAP://" & System.Environment.UserDomainName)
    DirSearcher.Filter = "(&(objectclass=user)(objectcategory=person))"
    DirSearcher.PageSize = 1000
    Can we have something like this done in the DBMS_LDAP package to fetch the records in AD in chunks of 1000 records?
    version details
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production

    if there are more than 1000 entries which starts with a character, how will this solution work?You would have to incorporate one more loop (and so on, in case it still errors out):
      for c in ascii ('a') .. ascii ('z')
      loop
        for d in ascii ('a') .. ascii ('z')
        loop
          l_retval :=
            dbms_ldap.search_s (ld         => ld
                                base       => base,
                                scope      => dbms_ldap.scope_subtree,
                                filter     => '(&(objectCategory=person)(objectClass=user)(sAMAccountName=' || chr (c) || chr(d) || '*))',
                                attrs      => attrs,
                                attronly   => 0,
                                res        => res
        end loop; 
      end loop; 
    ...Not nice I know, but it seems to be the only way to avoid »ORA-31202: DBMS_LDAP: LDAP client/server error: Sizelimit exceeded«.

  • Invalid DBMS_LDAP package

    I'm trying to fix invalid objects before database upgrade. I ran dbupgdiag.sql tool which reports DBMS_LDAP package as invalid. According to Enterprise Manager, the package is wrapped and contains some errors (see below). How can I unwrap the package and fix the errors?
    Line # = 50 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 50 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 73 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 73 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 105 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 105 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 135 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 135 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 175 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 175 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 211 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 211 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 218 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 218 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 276 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 276 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 283 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 283 Column # = 14 Error Text = PL/SQL: Statement ignored
    Line # = 289 Column # = 14 Error Text = PLS-00201: identifier 'DBMS_SYS_ERROR.RAISE_SYSTEM_ERROR' must be declared
    Line # = 289 Column # = 14 Error Text = PL/SQL: Statement ignored

    I have been successful using the PL/SQL DBMS_LDAP utilities and enhancing the included examples to bulk create portal users as well as adding them to a default portal group as outlined in the DBMS_LDAP demo examples (search.sql, trigger.sql, empdata.sql).
    Using this PL/SQL trigger on the EMP table, I can add, delete or modify various user entries. However, while I can add a user to a default portal group, I have been unsuccessful in deleting a user from a group as well as modifying a users default group by deleting their "uniquemember" entry from one group and adding it to another using the DBMS_LDAP procedures.
    Has anyone deleted a user from an existing group and how is this done programatically using the DBMS_LDAP utilities? Also, but less important, is there a way to programmatically modify a user from one portal group to another?
    I don't necessarily want the code - just the method of doing this. Do I have to read in all of the 'uniquemember' attributes from the group (via DBMS_LDAP.populate_mod_array, for example), then manipulate the list and write it back. Or, is there a function that will allow me to delete or modify an entry in the 'uniquemember' attribute.
    Regards,
    Edward Girard

  • Required to create a script for base table update using XMLSTORE package.

    Hi can anybody provide me some help full suggestion on how to update base table using XMLSTORE package.
    I created a simple script for Employee table and can able to do the basic operation like Insert and update on the table.
    Query is as follow's
    DECLARE
    insCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    xmlDoc CLOB :=
    '<ROWSET>
    <ROW num="1">
    <EMPLOYEE_ID>922</EMPLOYEE_ID>
    <SALARY>1801</SALARY>
    <HIRE_DATE>17-DEC-2007</HIRE_DATE>
    <JOB_ID>ST_CLERK</JOB_ID>
    <EMAIL>RAUSSJACK</EMAIL>
    <LAST_NAME>JACK</LAST_NAME>
    <DEPARTMENT_ID>20</DEPARTMENT_ID>
    </ROW>
    <ROW>
    <EMPLOYEE_ID>923</EMPLOYEE_ID>
    <SALARY>2001</SALARY>
    <HIRE_DATE>31-DEC-2005</HIRE_DATE>
    <JOB_ID>ST_CLERK</JOB_ID>
    <EMAIL>PATHAK</EMAIL>
    <LAST_NAME>PRATIK</LAST_NAME>
    <DEPARTMENT_ID>20</DEPARTMENT_ID>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLSTORE.newContext('EMPLOYEES'); -- Get saved context
    DBMS_XMLSTORE.clearUpdateColumnList(insCtx); -- Clear the update settings
    -- Set the columns to be updated as a list of values
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'EMPLOYEE_ID');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'SALARY');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'HIRE_DATE');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'JOB_ID');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'EMAIL');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'LAST_NAME');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'DEPARTMENT_ID');
    -- Insert the doc.
    rows := DBMS_XMLSTORE.insertXML(insCtx, xmlDoc);
    --COMMIT;
    DBMS_OUTPUT.put_line(rows || ' rows inserted.');
    -- Close the context
    DBMS_XMLSTORE.closeContext(insCtx);
    END;
    SELECT employee_id, LAST_name FROM employees WHERE employee_id = 114;
    DECLARE
    updCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    xmlDoc CLOB :=
    '<ROWSET>
    <ROW>
    <EMPLOYEE_ID>114</EMPLOYEE_ID>
    <LAST_NAME>PRABHU</LAST_NAME>
    </ROW>
    </ROWSET>';
    BEGIN
    updCtx := DBMS_XMLSTORE.newContext('EMPLOYEES'); -- get the context
    DBMS_XMLSTORE.clearUpdateColumnList(updCtx); -- clear update settings
    -- Specify that column employee_id is a "key" to identify the row to update.
    DBMS_XMLSTORE.setKeyColumn(updCtx, 'EMPLOYEE_ID');
    rows := DBMS_XMLSTORE.updateXML(updCtx, xmlDoc); -- update the table
    DBMS_XMLSTORE.closeContext(updCtx); -- close the context
    commit;
    END;
    Nowi want little modification on this above query like as i am passing static XML tags and i want it to pick the dynamic XML from web and use the XMLSTORE for the update.
    and also for complex XML having 2-3 levels how this query needs to be changed.As i am new to this Oracle utillity any help from xepert will be a great help for me.
    Thanks

    Nowi want little modification on this above query like as i am passing static XML tags and i want it to pick the dynamic XML from webFrom a Web Service?
    You'll need UTL_HTTP or HttpUriType interface to send the request and receive the XML response.
    Search in the forum, there are already a lot of useful examples available.
    and also for complex XML having 2-3 levels how this query needs to be changed.DBMS_XMLStore is OK for readily processing a canonical XML format (/ROWSET/ROW/COLUMN structure or alike).
    However, if you have to deal with a more complex structure, you either have to :
    - use a target object table that matches the XML structure
    - preprocess the input document using XSLT to transform it to canonical format
    That's why DBMS_XMLStore is not appropriate for multilevel documents, especially if they contain nested repeating groups.
    In this case, XMLTable is a more flexible way of parsing the XML and process it relationally at the same time.
    Depending on the size of the document, performance may be improved with schema-based object-relational storage.
    For more help, please post a new thread in the {forum:id=34} forum, with the following information :
    - database version (select * from v$version)
    - a sample XML document (the complex one)
    - DDL of your target table
    - mapping between XML elements and columns (ie which tag goes to which column?)
    - an XML schema (if you have one)

  • Error while sending a mail using UTP_MAIL package in Oracle 10g

    Hi,
    We are using UTP_MAIL package to send a mail from Oracle 10g.We have follwed the following steps ...
    SQL> connect sys/password as sysdba
    Connected.
    SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql
    Package created.
    Synonym created.
    SQL> @$ORACLE_HOME /rdbms/admin/prvtmail.plb
    Package body created.
    SQL > alter system set smtp_out_server = '<mail_server_ip:25>' scope =spfile;
    System altered..
    Now we try the code
    begin
    utl_mail.send(
    sender => 'sender's mail',
    recipients => 'receiver mail',
    CC => 'optional',
    subject => 'Testing utl_mail',
    message => 'Test Mail'
    end;
    But we get the following error...
    ERROR at line 1:
    ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 97
    ORA-06512: at "SYS.UTL_SMTP", line 139
    ORA-06512: at "SYS.UTL_MAIL", line 405
    ORA-06512: at "SYS.UTL_MAIL", line 594
    ORA-06512: at line 2
    We also tried connecting to the mail server through telnet .But it is not getting connected..
    Please help us to solve the issue.

    From your own posting you may have the clue, if you try to access your mail server through telnet and it is not successful, it means the service is down or there are networking issues.
    On pre 10gR2 versions there was a bug 4083461.8. It could affect you if you are on 10gR1
    "Bug 4083461 - UTL_SMTP.OPEN_CONNECTION in shared server fails with ORA-29278 Doc ID:      Note:4083461.8"
    This was fixed on 10gR2 base and on 9.2.0.8.0
    ~ Madrid

Maybe you are looking for

  • Export sections to Excel as individual tabs

    Hi, My report is sectioned for e.g by Area. Is there any way I can export this to excel as separate tabs i.e. a tab for each area? Any help would be appreciated. Regards, Aoife

  • Since installing iOS 7 my iMessage won't activate

    I have updated to iOS 7 now I message won't work. Tried reset network settings still no joy

  • Developer 6i Download

    So that we may better diagnose DOWNLOAD problems, please provide the following information. - Server name: download.oracle.com - Filename: 6irel2nt.exe - Date/Time: 15-MAR-2002 16:20 - Browser + Version: IE 6.0 - O/S + Version: Win 2K SP 2 - Error Ms

  • Invoice to PO and Receipt Matching

    Hello, Any one knows what tables/columns are updated in R12 when Invoice is matched against PO vs Invoice is matched against PO and Receipt?

  • Master Data Text and Attributes

    Guys,            I read some posts on sdn regarding differences between master data texts and attributes and now I am a little confused.  I thought attributes define a char.  then what does text do?  Does it not define or describe the char as well?