Help troubleshooting ORA-31003 when granting privilege

Hi All
I'm stumped on this. I need to enable network services for APEX_030200 using the script provided by Oracle.
I've read many metalink docs and forums etc... Spent hours(days...) troubleshooting so any help would be greatly appreciated.
We reloaded the XML as documented in [ID 472764.1] - no luck.
Additional Info-
Oracle Version - Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 upgraded from 10g but working fine until now.
select COMP_ID,COMP_NAME,VERSION,STATUS from dba_registry WHERE COMP_ID='XDB';
XDB
Oracle XML Database
11.1.0.7.0 VALID
Oracle Application Express 3.2.1.00.11 upgraded from 3.1
(technically the issue started after upgrading to 3.2.1, the script ran without errors and the application worked as expected when I ran
ERRORORA-31003: Parent /sys/acls/ already contains child entry power_users.xml
ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 226
ORA-06512: at line 30
ORA-01403: no data found
Details:
DECLARE
ACL_PATH VARCHAR2(4000);
ACL_ID RAW(16);
BEGIN
-- Look for the ACL currently assigned to '*' and give APEX_030200
-- the "connect" privilege if APEX_030200 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
-- Before checking the privilege, ensure that the ACL is valid
-- (for example, does not contain stale references to dropped users).
-- If it does, the following exception will be raised:
-- ORA-44416: Invalid ACL: Unresolved principal 'APEX_030200'
-- ORA-06512: at "XDB.DBMS_XDBZ", line ...
SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID
FROM XDB.XDB$ACL A, PATH_VIEW P
WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
EQUALS_PATH(P.RES, ACL_PATH) = 1;
DBMS_XDBZ.ValidateACL(ACL_ID); Looks like it can't validate the ACL.
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_030200',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_030200', TRUE, 'connect');
END IF;
EXCEPTION
-- When no ACL has been assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users to connect to everywhere',
'APEX_030200', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
Error at line 4
ORA-31003: Parent /sys/acls/ already contains child entry power_users.xml
ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 226
ORA-06512: at line 30
ORA-01403: no data found
One suggestion (metalink note ID 854083.1])was a mismatch no so as shown:
HOST ACL ACLID
* /sys/acls/power_user 7C6E4C2B5E410EC7E044001A4B09A6D9
s.xml
HOST ACLID
* 7C6E4C2B5E410EC7E044001A4B09A6D9
Again any suggestions, tips would be appreciated.
Moe

APEX creates (and also already did this the first time) a /sys/acls/power_users.xml file that defined in that file the ACL's, principals etc.
The error message is correct. DBMS_NETWORK_ACL_ADMIN tries to create a XML FILE that already defined the security rules and/or tries to add security definitions that ae already defined in the file.
*ERROR*ORA-31003: Parent /sys/acls/ already contains child entry power_users.xml
ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 226
ORA-06512: at line 30
ORA-01403: no data foundSo it sounds to me it is a scripting issue in the upgrade APEX scripts. Maybe you could even ignore it if it tries to add something that was already was added in the original release...?

Similar Messages

  • Help! ORA 01012 WHEN execute SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER

    I encounter ORA 01012 WHEN execute "SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;" in my ProC program, but under SQLPLUS it is ok. The whole scenarios are:
    1. My platform is Solaris 10, Oracle 10.2g / 64bit
    2. "alter system archive log current" failure, Oracle complaint about flash_recovery_area full, so I run
    delete obsolete;
    crosscheck backup;
    delete expired backup;
    3. Later I issued command "shutdown", oralce had no reponse after long time, so I issued command "shutdown abort" to shutdown the database, and then "startup" the database successfully to "READ WRITE", user application can also accessed the database.
    4. One of my ProC program get ORA-01012 when execute SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;
    5. But I got no error if I execute "SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL; " using SQLPLUS.
    Any suggestion about this problem? blow is my ProC function call.
    u_int32_t
    proc_GetLastSCN()
    char buf[300];
    u_int32_t scn=0;
    if (proc_ConnectDB() == APP_ERROR)
    return APP_ERROR;
    memset(buf, 0, sizeof(buf));
    snprintf(buf, sizeof(buf),
    "select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from DUAL");
    oraca.orastxtf = ORASTFERR;
    EXEC SQL WHENEVER SQLERROR GOTO ora_sqlerror;
    EXEC SQL WHENEVER NOT FOUND DO break;
    EXEC SQL WHENEVER SQLWARNING CONTINUE;
    EXEC SQL PREPARE S5 FROM :buf;
    EXEC SQL DECLARE C5 CURSOR FOR S5;
    EXEC SQL OPEN C5;
    for (;;) {
    EXEC SQL FETCH C5 INTO :scn;
    EXEC SQL CLOSE C5;
    proc_DisconnectDB();
    return scn;
    ora_sqlerror:
    dyn_error("ORACLE error --proc_GetLastSCN\n");
    EXEC SQL CLOSE C5;
    proc_DisconnectDB();
    return 0;
    int32_t
    proc_ConnectDB()
    /* Declare variables. No declare section is needed if MODE=ORACLE. */
    VARCHAR username[DB_MAX_NAME_LEN];
    /* VARCHAR is an Oracle-supplied struct */
    VARCHAR password[DB_MAX_NAME_LEN];
    int32_t ret = APP_OK;
    strncpy((char *) username.arr, gateinfo.szSrvLogin, sizeof(gateinfo.szSrvLogin));
    username.len = (unsigned short) strlen((char *) username.arr);
    strncpy((char *) password.arr, gateinfo.szSrvPassword, strlen(gateinfo.szSrvPassword));
    password.len = (unsigned short) strlen((char *) password.arr);
    EX_SCREEN_INIT();
    EXEC SQL WHENEVER SQLERROR GOTO ora_sqlerror;
    EXEC SQL CONNECT :gateinfo.szSrvLogin IDENTIFIED BY :gateinfo.szSrvPassword;
    return ret;
    ora_sqlerror:
    errlog(ELOG_ERROR, "proc_ConnectDB@Failed to connect to %s!", gateinfo.szHistSrv);
    sql_error("ORACLE error proc_ConnectDB --\n");
    ret = APP_ERROR;
    return ret;
    }

    01012, 00000, "not logged on"
    // *Cause:
    // *Action:use COPY & PASTE so we can see what you do & how Oracle responds.

  • Firefox crashes when I click help troubleshoot information, and it's not sending crash reports.

    Firefox crashes when I click help > troubleshoot information. It's also not sending crash reports. I really can't be any more specific or straightforward than I am being right now. I have reinstalled multiple times. I've tried the same thing in safe mode. Cache and history and cookies are cleared. Hardware Acceleration is disabled. All of it.

    Computer's clean, and this is my second clean uninstall and re-install of Firefox tonight.
    I'm not having this problem with Chrome.

  • Get an error when grant execute on dbms_lock to user?

    Hi all,
    i have to grant several privileges/roles to user X, it works fine if only one privilege/role is granted one time, but an error raised when i put them together in one grant command, does anyone have any ideas regarding this? thanks in advance.
    sqlplus sys/*****@*** as sysdba
    SQL> grant execute on dbms_lock to X;
    Grant succeeded.
    SQL> grant resource to X;
    Grant succeeded.
    SQL> grant execute on dbms_lock,resource to X;
    grant execute on dbms_lock,resource to X
    ERROR at line 1:
    ORA-00905: missing keyword
    SQL> grant resource,execute on dbms_lock to X;
    grant resource,execute on dbms_lock to X
    ERROR at line 1:
    ORA-01953: command no longer valid, see ALTER USER

    >
    SQL> grant execute on dbms_lock,resource to X;
    grant execute on dbms_lock,resource to X
    ERROR at line 1:
    ORA-00905: missing keyword
    SQL> grant resource,execute on dbms_lock to X;
    grant resource,execute on dbms_lock to X
    ERROR at line 1:
    ORA-01953: command no longer valid, see ALTER USER
    >
    It will help to read the documentation on grant statement.
    You can't grant privileges on two different objects or roles in one statement. However you can grant two or more privileges on same object in one statement.
    SQL> grant select,update on emp to X;

  • Grant Privilege to Role instead of Direct grant doesn't work

    Hi all
    My scenario is sas follow:
    create user a identified by a;
    create user b identified by b;
    grant connect,resource to a ;
    grant connect,resource to b ;
    conn a/a
    create table tbl( c1 number(10));
    conn system/sys
    create role roll;
    grant roll to b;
    conn a/a
    grant select on tbl to roll;
    conn b/b
    set role roll;
    create or replace procedure b.pr
    as
    v number(10);
    begin
    select a into v
    from a.tbl
    where a=0;
    end;
    show error
    Errors for PROCEDURE B.P:
    LINE/COL ERROR
    6/1 PL/SQL: SQL Statement ignored
    7/6 PL/SQL: ORA-00942: table or view does not exist
    This happen because i granted the SELECT privilege to user b through the role ROLL but if i granted the user b the SELECT privilege directly it work properly
    Why???
    And how could I grant the privilege from within a role, Because i don't want to grant it directly
    Thank in advance
    Bassil

    There is no other way. The owner of stored code must have been directly granted all necessary (used in code) select, insert, update, or delete privileges. The code owner cannot just have the referenced privileges granted to them via a role. There is no workaround, nor should there be as this is a security feature. Just because you have been granted insert or delete to another user's tables does not mean you should be able to grant that access to some other user. This is exactly what you do when you grant execute to stored code that referenced another user's objects.
    The referenced article is by Tom Kyte and there are few people who understand how to use Oracle to better effect than Tom. The same information can be found in the official documentation and is referenced by the article.
    You can write packages that use the privileges of the executing person. Perhaps for the specific problem you are writing the code to handle this is the route you want to take. See the manuals for the details.
    Note - If user A grants insert to user B on table_a then user B can write a procedure, proc_b, and grant execute to a role and anyone with the role can perform inserts into table_a via proc_b, without having any grants on table_a. You do not need to grant privileges on the objects referenced in stored code that runs as the code owner if this is what you are worried about. The users just need execute on the package, procedure, or function that performs the DML operations in this case and they can get that from a role.
    If you still do not understand you need to state exactly what it is you either do not understand or want to know how to do.
    HTH -- Mark D Powell --

  • Granting privilege through role not working for PL/SQL

    Version: 11.2.0.2
    In our shop, we don't grant privileges directly to a user, we grant it to a role and grant that role to the intended grantee.
    Granting privileges through a role seems to be fine with SQL Engine. But it doesn't work from PL/SQL engine.
    In the below example GLS_DEV user is granted SELECT access on SCOTT.pets table through a role called tstrole. GLS_DEV can select this table from SQL. But PL/SQL Engine doesn't seem to know this.
    Reproducing the issue:
    SQL> show user
    USER is "SCOTT"
    SQL> select * from pets;
    NAME
    PLUTO
    SQL> conn / as sysdba
    Connected.
    SQL> create user GLS_DEV identified by test1234 default tablespace TSTDATA;
    User created.
    SQL> alter user GLS_DEV quota 25m on TSTDATA;
    User altered.
    SQL> grant create session, resource to GLS_DEV;
    Grant succeeded.
    --- Granting SELECT privilege on scott.pets to tstrole and then grant this role to GLS_DEV.
    SQL> conn / as sysdba
    Connected.
    SQL>
    SQL> create role tstrole;
    Role created.
    SQL> grant select on scott.pets to tstrole;
    Grant succeeded.
    SQL> grant tstrole to GLS_DEV;
    Grant succeeded.
    SQL> conn GLS_DEV/test1234
    Connected.
    SQL>
    SQL> select * From scott.pets;
    NAME
    PLUTO
    ---- All fine till here. From SQL engine , GLS_DEV user can SELECT scott.pets table.
    --- Now , I am going to create a PL/SQL object in GLS_DEV which tries to refer scott.pets
    SQL> show user
    USER is "GLS_DEV"
    create or replace procedure my_proc
    is
    myvariable varchar2(35);
    begin
         select name into myvariable from scott.pets ;
         dbms_output.put_line(myvariable);
    end my_proc;
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE MY_PROC:
    LINE/COL ERROR
    6/2      PL/SQL: SQL Statement ignored
    6/41     PL/SQL: ORA-01031: insufficient privileges
    SQL>
    SQL> 6
      6*    select name into myvariable from scott.pets ;
    --- PL/SQL Engine doesn't seem to know that GLS_DEV has select privilege on scott.pets indirectly granted through a role
    --- Fix
    --- Instead of granting privilege through a role, I am granting the SELECT privilege on scott.pets to GLS_DEV directly.
    --- The error goes away, I can compile and execute the procedure !!
    SQL> conn / as sysdba
    Connected.
    SQL>
    SQL> grant select on scott.pets to GLS_DEV;
    Grant succeeded.
    SQL> conn GLS_DEV/test1234
    Connected.
    SQL>
    SQL> create or replace procedure my_proc
    is
    myvariable varchar2(35);
    begin
            select name into myvariable from scott.pets ;
            dbms_output.put_line(myvariable);
    end my_proc;  2    3    4    5    6    7    8    9   10
    11  /
    Procedure created.
    SQL> set serveroutput on
    SQL> exec my_proc;
    PLUTO
    PL/SQL procedure successfully completed.Has anyone encountered the same issue ?

    You really should start your own new thread for this question instead of resurrecting an old one, but to answer your question.
    There are two things going on here. First, there are a number of aler session commands that can be used by any user regardless of what privileges they are granted. Although I do not have the entire list at hand, things like nls_date_format and current_schema are available to all users, sort of like the grants to public in the data dictionary.
    Second, when you use execute immediate, the PL/SQL engine never really sees the statement, as far as the compiler is concerned it is just a string. It is only when the string is passed to the sql engine that permissions are checked, and there roles are not enabled.
    SQL> create role t_role;
    Role created.
    SQL> grant select on ops$oracle.t to t_role;
    Grant succeeded.
    SQL> create user a identified by a default tablespace users;
    User created.
    SQL> grant create session, create procedure to a;
    Grant succeeded.
    SQL> grant t_role to a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> select * from ops$oracle.t;
            ID DESCR
             1 One
             1 Un
    SQL> create function f (p_descr in varchar2) return number as
      2     l_num number;
      3  begin
      4     select id into l_num
      5     from ops$oracle.t
      6     where descr = p_descr;
      7     return l_num;
      8  end;
      9  /
    Warning: Function created with compilation errors.
    SQL> show error
    Errors for FUNCTION F:
    LINE/COL ERROR
    4/4      PL/SQL: SQL Statement ignored
    5/20     PL/SQL: ORA-00942: table or view does not exist
    SQL> create or replace function f (p_descr in varchar2) return number as
      2     l_num number;
      3  begin
      4     execute immediate 'select id from ops$oracle.t where descr = :b1'
      5                       into l_num using p_descr;
      6     return l_num;
      7  end;
      8  /
    Function created.
    SQL> select f('One') from dual;
    select f('One') from dual
    ERROR at line 1:
    ORA-00942: table or view does not exist
    ORA-06512: at "A.F", line 4John

  • Getting ORA-1013 when attempting to expand tables within connections

    Getting ORA-1013 when attempting to expand tables within connections on new install of Oracle SQL developer 3.1.06.
    Any ideas?

    Hi Steve,
    The ORA-01013 usually means a timeout or, more typically on this forum, an intentional user cancellation. Searching the forum, I do not see any prior references to your exact situation. Some recommendations:
    1. SQL Developer 3.1.0.6 was an early adopter release. Upgrade to the latest and greatest: 3.2.10.09.57
    2. Review this: Re: [SQL Developer 3.0.04] Cannot Drill Down
    3. If it is a true timeout, your privileges might make a difference. If you have access to the DBA views, SQL Developer does look-ups using those and performance is better.
    So for [3], having the SELECT_CATALOG_ROLE privilege may help. I even read of one case in this forum where the poster finally discovered his database's recycle bin had an issue and the DBA needed to do some clean-up to correct the performance issue.
    Hope this helps,
    Gary
    SQL Developer Team

  • ORA-19007 when coping a table with an xml type in it to a new schema in the

    ORA-19007 when coping a table with an xml type in it to a new schema in the same database.
    Hi all,
    When I copy a table with an xml type in it to a new schema in the same database I get an ora-19009.
    The setup is as follows I have a schema a with table TABLE_WITH_XMLTYPE where data is:
    CREATE
    TABLE TABLE_WITH_XMLTYPE
    FOLDER_ID NUMBER (10, 0) NOT NULL,
    SEARCH_PROPERTIES XMLTYPE ,
    CONSTRAINT TABLE_WITH_XMLTYPE PK PRIMARY KEY (FOLDERID) USING INDEX
    XMLTYPE COLUMN SEARCH_PROPERTIES XMLSCHEMA
    "http://xxxxxxx.net/FolderProperties.xsd" element "FolderProperties"
    VARRAY SEARCH_PROPERTIES."XMLDATA"."PROPERTIES"."PROPERTY" STORE AS TABLE
    PROPERTY_TABLE
    (PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX)) ORGANIZATION INDEX OVERFLOW
    Both schemas have the following xml schema registered as a local xml schema
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xxxxxxx.net/FolderProperties.xsd',
    SCHEMADOC =>
    '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true">
    <xs:element name="FolderProperties"
    type="FolderPropertiesType"
    xdb:defaultTable="FOLDER_SEARCH_PROPERTIES" />
    <xs:complexType name="FolderPropertiesType" xdb:SQLType="FOLDERPROPERTIES_T">
    <xs:sequence>
    <xs:element name="FolderID" type="FolderIDType" minOccurs="1" xdb:SQLName="FOLDER_ID"/>
    <xs:element name="Properties" type="PropertiesType" xdb:SQLName="PROPERTIES"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="PropertiesType" xdb:SQLType="PROPERTIES_T">
    <xs:sequence>
    <xs:element name="Property" type="PropertyType" maxOccurs="unbounded"
    xdb:SQLName="PROPERTY" xdb:SQLCollType="PROPERTY_V"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="PropertyType" xdb:SQLType="PROPERTY_T">
    <xs:sequence>
    <xs:element name="DateValue" type="DateType" xdb:SQLName="DATE_VALUE"/>
    <xs:element name="NumValue" type="NumType" xdb:SQLName="NUM_VALUE"/>
    <xs:element name="StringValue" type="StringType" xdb:SQLName="STRING_VALUE"/>
    </xs:sequence>
    <xs:attribute name="Name" xdb:SQLName="NAME" xdb:SQLType="VARCHAR2">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:minLength value="1"/>
    <xs:maxLength value="255"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="FolderIDType">
    <xs:restriction base="xs:integer"/>
    </xs:simpleType>
    <xs:simpleType name="DateType">
    <xs:restriction base="xs:dateTime"/>
    </xs:simpleType>
    <xs:simpleType name="NumType">
    <xs:restriction base="xs:decimal"/>
    </xs:simpleType>
    <xs:simpleType name="StringType">
    <xs:restriction base="xs:string" />
    </xs:simpleType>
    </xs:schema>',
    LOCAL => TRUE,
    GENTYPES => TRUE,
    GENTABLES => FALSE);
    END;
    when I try to do the following insert:
    insert into schemaB.TABLE_WITH_XMLTYPE ( FOLDER_ID, SEARCH_PROPERTIES)
    select FOLDER_ID, SEARCH_PROPERTIES from schemaB.TABLE_WITH_XMLTYPE;
    I’ll get an ora-19007.
    Can some one point me in the right direction how to solve this error.
    Thanks Roelof.

    Who did you create the second table, in other words, how did you COPY the table as you said...
    If you created the second table via a CTAS (create table as select) then you will have created a table that is not the same as the original one. AFAIK I have once created an enhancement request for this after discovering that JDeveloper, for example, creates a "copy" via a CTAS which creates the wrong structure. Double check via package DBMS_METADATA.
    SQL> set long 1000000
    SQL> select DBMS_METADATA('TABLE','TABLE_WITH_XMLTYPE','SchemaA') from dual;
    SQL> select DBMS_METADATA('TABLE','TABLE_WITH_XMLTYPE','SchemaB') from dual;If you have got two different tables, than Mark's solution should help.
    M.
    Edited by: Marco Gralike on Feb 15, 2009 11:16 AM

  • Error while granting privileges to new user

    hi all,
    I created new user and i tried to grant privileges to that new user by using ( SQL> CONNECT / AS sysdba;
    Connected.
    SQL> CREATE USER cdcproj IDENTIFIED BY cdcproj
    2 QUOTA UNLIMITED ON SYSTEM
    3 QUOTA UNLIMITED ON SYSAUX;
    User created.
    SQL> GRANT CREATE SESSION TO cdcproj;
    Grant succeeded.
    SQL> GRANT CREATE TABLE TO cdcproj;
    Grant succeeded.
    SQL> GRANT SELECT_CATALOG_ROLE TO cdcproj;
    Grant succeeded.
    SQL> GRANT EXECUTE_CATALOG_ROLE TO cdcproj;
    Grant succeeded.
    SQL> EXECUTE DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(grantee => 'cdcproj'); PL/SQL procedure successfully completed.
    SQL> GRANT ALL ON PL.PROJ_HISTORY TO cdcproj;
    Grant succeeded. ). All the commands worked except last command. It is giving error i.e (GRANT ALL ON PL.PROJ_HISTORY TO cdcproj; ) error is ( table / view not exists ).
    What i can do. Any help.
    Otherwise is there any other method to grant privileges.
    Thanks in advance.

    What is your Oracle version ?
    Are you sure the object PL.PROJ_HISTORY exists ?
    What is the output of (using the Oracle account that executes the GRANT):
    select * from session_roles;
    select * from session_privs;

  • FAQ: How do I troubleshoot audio issues when importing .MTS files?

    Hello.   The link FAQ: How do I troubleshoot audio issues when importing .MTS files?
    does not work, and i need the answer please. My imported MTS clips are not playing back audio because it seems that no audio imported with the video.   Thanks, Don.

    Hi there
    Audio plays when the object with the audio assigned appears. This is why you hear it when the Button appears.
    Try assigning the audio instead to the object that appears when you click the button. Perhaps the caption.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • How to grant privileges on all the tables in a schema

    Hi All,
    Can you tell me how to grant privileges on all the tables of a schema A
    to schema B.
    For Example:
    There are 200 tables in schema A, I wanted to grant select privilege on all the tables of a scheme A to schema B.
    Thanks in advance.

    note that USER is the user that will have the select priviledge
    the procedure includes views as well
    CREATE OR REPLACE PROCEDURE GRANT_ACCESS_ON_USER IS
    CURSOR c1 is select table_name from user_tables;
    CURSOR c2 is select view_name from user_views;
    tablename user_tables.TABLE_NAME%TYPE;
    viewname user_views.VIEW_NAME%TYPE;
    BEGIN
    tmpVar := 0;
    OPEN c1;
    loop
         fetch c1 into tablename;
         EXIT WHEN c1%NOTFOUND;
         EXECUTE IMMEDIATE 'GRANT SELECT on '||tablename ||' to USER';
    end loop ;
    close c1;
    OPEN c2;
    loop
         fetch c2 into viewname;
         EXIT WHEN c2%NOTFOUND;
         EXECUTE IMMEDIATE 'GRANT SELECT on '||viewname ||' to USER';
    end loop ;
    close c2;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END;
    /

  • Need help on  ORA-02074: cannot SET NLS in a distributed transaction

    Hi All,
    I am Writing a plsql Code like this
    DECLARE
    op_job_id NUMBER;
    op_object_version_number NUMBER;
    x_job_definition_id NUMBER;
    op_name VARCHAR2(1000);
    L_VERIFY_FLAG VARCHAR2(1);
    l_error_message VARCHAR2(2000);
    BG_ID NUMBER;
    lv_job_group_id APPS.per_job_groups.job_group_id@SYSTEM_LINK_VISMA%TYPE;
    CURSOR C1 IS SELECT * FROM EBS_PER_JOBS_STG;
    BEGIN
    FOR H1 IN C1
    LOOP
    BEGIN
    IF H1.BUSINESS_GROUP_NAME IS NOT NULL THEN
    SELECT BUSINESS_GROUP_ID,job_group_id INTO BG_ID,lv_job_group_id
    FROM APPS.PER_JOB_GROUPS@SYSTEM_LINK_VISMA
    WHERE DISPLAYED_NAME=H1.JOB_GROUP_NAME;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    L_VERIFY_FLAG := 'E';
    l_error_message := 'Entered Job Group Name is Wrong';
    END;
    -->> JOB GROUP ID <<--
    APPS.hr_job_api.CREATE_JOB@SYSTEM_LINK_VISMA
    (p_business_group_id => BG_ID
    ,p_date_from => H1.DATE_FROM
    ,p_approval_authority => H1.APPROVAL_AUTHORITY
    ,p_emp_rights_flag => H1.EMP_RIGHTS_FLAG
    ,p_benchmark_job_flag => H1.BENCHMARK_JOB_FLAG
    ,p_job_group_id => lv_job_group_id
    ,p_job_information1 => H1.JOB_INFORMATION1
    ,p_job_information2 => H1.JOB_INFORMATION2
    ,p_job_information3 => H1.JOB_INFORMATION3
    ,p_job_information4 => H1.JOB_INFORMATION4
    ,p_job_information5 => H1.JOB_INFORMATION5
    ,p_job_information6 => H1.JOB_INFORMATION6
    ,p_job_information7 => H1.JOB_INFORMATION7
    ,p_segment3 => H1.JOB_CODE --JOB_CODE
    ,p_segment6 => H1.JOB_NAME --JOB_NAME
    ,p_job_id => op_job_id
    ,p_object_version_number => op_object_version_number
    ,p_job_definition_id => x_job_definition_id
    ,p_name => op_name);
    dbms_output.PUT_LINE('OUTPUT JOB NAME CREATED : '||op_name);
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.PUT_LINE('Error Message Is: '||SQLERRM);
    END;
    i am running it in Another database Using database link connecting to Apps.
    when i am running it am getting the following Error:
    Error Message Is: ORA-02074: cannot SET NLS in a distributed transaction
    ORA-06512: at "APPS.HR_KFLEX_UTILITY", line 2423
    ORA-06512: at "APPS.HR_KFLEX_UTILITY", line 2380
    ORA-06512: at "APPS.PER_JBT_UPD", line 468
    ORA-02074: cannot SET NLS in a distributed transaction
    ORA-06512: at "APPS.HR_JOB_API", line 878
    Please help me on this, this is quite urgent to me.
    thanks
    sri

    Please see these docs.
    ORA-02074: Cannot SET NLS in a Distributed Transaction [ID 556391.1]
    Portal Used To Call PO_CHANGE_API1_S: ORA-20001: ORA-02074: Cannot SET NLS In A Distributed Transaction [ID 561246.1]Why are Concurrent Programs Calling FND_GLOBAL.APPS_INITIALIZE Using DBLinks Failing? [ID 466800.1]
    ORA-02074 when Executing set_nls over a DB Link [ID 132679.1]
    Thanks,
    Hussein

  • Problem with granting privileges

    We are creating a separate user for loading data into staging tables on our db and are having problems granting privileges. The original user is securities_developer and the new user is securities_loader. As securities_developer, I execute the following command:
    grant delete,update,insert,select on securities_work to securities_loader;
    The output indicates success, but when I switch to that user and perform 'select * from securities_work', the table isn't found. Using Oracle Enterprise Manager, I look up the table and it indicates that the above privileges have been granted. Am I missing something?
    version info:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE     11.2.0.1.0     Production"
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    Hi,
    Do you have a (public) synonym on your table securities_work ?
    Or, try to add the schema owner in your query like: 'select * from securities_developer.securities_work'
    Regards,
    Thierry

  • Grant privileges on DB View in HANA Trial

    Hello!
    I created DB View on my scheme. View uses table SNWD_BPA of EPMSAMPLEDATA schema. I created OData service with this View. I can browse content of metadata OData service without no issue.
    https://s3hanaxs.hanatrial.ondemand.com/.../BusinessPartners.xsodata/$metadata
    However, if I try to get to the element level like this:
    https://s3hanaxs.hanatrial.ondemand.com/.../BusinessPartners.xsodata/BusinessPartners
    I receive: exception  1: no.71000258  (ptime/query/checker/check_clause.cc:579)
        Not authorized NO exception throw location recorded. Stack generation suppressed.
    I executed successfully
    call "HCP"."HCP_GRANT_SELECT_ON_ACTIVATED_OBJECTS"
    But this doesn't help.
    Does anyone know what privileges should be assigned to user and how can this be done?

    I changed main idea of my OData service.
    First, I created service with direct access to SNWD_BPA of EPMSAMPLEDATA. I created role with select access to SNWD_BPA of EPMSAMPLEDATA. But I used the wrong order of parameters with procedure call HCP_GRANT_ROLE_TO_USER.
    Second time, I created view for access to SNWD_BPA of EPMSAMPLEDATA and changed Odata service. But view cannot be granted on trial hana cloud platform.
    Current solution is: Odata service is same as first time and correct granted role.

  • Error ORA-06502 When using function REPLACE in PL/SQL

    Hi,
    I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
    variable var_a is of type CLOB
    and the assignment statement where it gives the error is
    var_a := REPLACE(var_a, '^', ''',''');
    Can anyone please help!
    Thanks

    Even then that shouldn't do so:
    SQL> select overload, position, argument_name, data_type, in_out
      2  from all_arguments
      3  where package_name = 'STANDARD'
      4  and object_name = 'LPAD'
      5  order by 1,2
      6  /
    OVERLOAD   POSITION ARGUMENT_NAME                  DATA_TYPE                      IN_OUT
    1                 0                                VARCHAR2                       OUT
    1                 1 STR1                           VARCHAR2                       IN
    1                 2 LEN                            BINARY_INTEGER                 IN
    1                 3 PAD                            VARCHAR2                       IN
    2                 0                                VARCHAR2                       OUT
    2                 1 STR1                           VARCHAR2                       IN
    2                 2 LEN                            BINARY_INTEGER                 IN
    3                 0                                CLOB                           OUT
    3                 1 STR1                           CLOB                           IN
    3                 2 LEN                            NUMBER                         IN
    3                 3 PAD                            CLOB                           IN
    4                 0                                CLOB                           OUT
    4                 1 STR1                           CLOB                           IN
    4                 2 LEN                            NUMBER                         INI wonder what happened?

Maybe you are looking for

  • My purchased songs won't show up in my iTunes Library!

    This means ALL of my Purchased songs. I can't play or view them. I've reset my iPod and the Library already, and I'm still having this issue. HELP! :c

  • GTS 7.2 - Error with account assigned purchase order without material

    All, I am creating an account assigned purchase order without any material master in the feeder system (ECC 5.0) and it a standard SAP functionality. I am getting the following GTS related pop up message and documents are posted to technically incomp

  • Time Capsule (early 2009) since yesterday my wifi connection is slow

    hello, since yesterday my wifi connection is very slow. all my ios devices in the wifi network connect much slower than in 3g with sides and apps. my mbp is linked with the capsule with a cable. it worked fine for 2 years. any suggestions? thx shorty

  • How to reinstall a CS4 suite to windows 7 system

    I have purchased a CS4 suite and have downloaded from the website, which has been installed in my old computer (with windows XP system). Currently I replaced my old computer, my new computer is with a Windows 7 system. I have copied all the files I d

  • Migration 11.2.4 to 11.3

    Hi, I want to migrate my existing server to 11.3 qith the setup.exe -R command but the migration on ly took a few seconds then I receive that message: The MIGRATION of ZENworks Server is finished, but some serious errors occured during the migration.