Oracle Unix 9 - slow granting Schema object to User

I have a problem. I can't figure out why granting schema object to users take longer time. here is my codes:
DECLARE
alert_button     NUMBER;
CURSOR Teller_Cur IS SELECT * FROM TELLER_M;
BEGIN
     alert_button := Show_Alert('AlertOK');
     IF alert_button = ALERT_BUTTON1 THEN           
          FOR Teller_Rec IN Teller_Cur LOOP
     Message('Setting table access for ' || Teller_Rec.Teller_ID || ' in progress, please wait....', No_acknowledge);
          IF :DTABLE IS NOT NULL THEN
          -- Granting Schema object to new User
          IF SUBSTR(:DTABLE, 1, 4) = 'TEMP' THEN
          Forms_DDL('GRANT SELECT, INSERT, UPDATE, DELETE ON ' || :DTABLE || ' TO ' || Teller_Rec.Teller_Id || '');
          ELSE     
     IF Teller_Rec.SELECT_ACCESS = 'Y' THEN
     Forms_DDL('GRANT SELECT ON ' || :DTABLE || ' TO ' || Teller_Rec.Teller_Id || '');
     END IF;
IF Teller_Rec.INSERT_ACCESS = 'Y' THEN
Forms_DDL('GRANT INSERT ON ' || :DTABLE || ' TO ' || Teller_Rec.Teller_Id || '');
END IF;     
          IF Teller_Rec.UPDATE_ACCESS = 'Y' THEN
Forms_DDL('GRANT UPDATE ON ' || :DTABLE || ' TO ' || Teller_Rec.Teller_Id || '');
          END IF;      
          IF Teller_Rec.DELETE_ACCESS = 'Y' THEN
Forms_DDL('GRANT DELETE ON ' || :DTABLE || ' TO ' || Teller_Rec.Teller_Id || '');
END IF;      
          END IF;
     -- Creating Synonyms in new User schema
          Forms_DDL('CREATE SYNONYM ' || Teller_Rec.Teller_Id||'.'|| :DTABLE || ' FOR ' || :DTABLE ||'');
ELSE
                         -- for stored procedure:
          Forms_DDL('CREATE SYNONYM ' || Teller_Rec.Teller_Id||'.'|| :DSTOREDP || ' FOR ' || :DSTOREDP ||'');
     Forms_DDL('GRANT EXECUTE ON ' || :DSTOREDP || ' TO ' || Teller_Rec.Teller_Id || '');
END IF;
     END LOOP;     
     Message('Setting table access completed!!!', No_acknowledge);
     END IF;
END;
If i use oracle 8.1.7 locally, it doesn't take than 5 minutes to grant access. But whereas to Oracle 9.0.1 (through network) is taking more than 20 minutes.
If anyone knows, do help me.
Thank you.

The problem is not the difference between the database versions I think; it's the location of the Server.
Take a look what one call of forms_ddl causes network traffic. you have this traffic for each call of forms_ddl. On the Local Server this might not be so much of a problem but with the network between it I this is much slower...
Try to bundle up your statements or even better put the whole stuff in a database procedure to do it via one call. I speeded up creating grants and synonyms from 10 minutes via forms_ddl to 3 minutes using database procedure.
The only limitation is that your messages won't display for each user.
regards

Similar Messages

  • Grant schema-level privileges to a Oracle  user

    Hi Experts,
    Do we have easy way to grant all objects to user (select only) in one schema?
    Thanks for help!
    Jim

    Thanks for help.
    actually, this is a group user account as
    CREATE USER user
    IDENTIFIED BY appuser
    DEFAULT TABLESPACE users
    QUOTA 10M ON example
    TEMPORARY TABLESPACE temp
    QUOTA 5M ON system
    PROFILE scapp_user
    Do you need to assign quota and profile?
    Also you need to access all data in database that i was told. this account should be grant a right to run view and procedures?
    do i need to go to all_object to find it?
    thanks for your suggestion in detail.
    JIm

  • Accesing windows files using oracle unix external tables.

    Hi, I'm trying to access files on windows2k using oracle external tables on unix:
    Oracle server on unix: oracle ver. is 9.2.0.6 and OS is 5.8 Generic_117000-03 sun4u sparc SUNW,Sun-Fire
    1. Created dir object on oracle unix pointing to windows path
    2. created user
    3. Assigned read and write privs on dir to user
    4. created external table using dir step 1
    5. select on external table
    When I FTP the files into unix and recreate dir object, it works, but if I point dir object into windows path, it fails.
    Is possible to do this?
    Tks
    GAP

    Hi
    The directory object must be accesible to your Database server, so if the Database is in unix you must create the directory in unix.
    I don´t know software that allow unix systems to see a windows file system. Maybe windows can see unix from a samba server or NFS.

  • Grant permission to all objects of a schema to apps user(Oracle 10g)

    Dear Fiiends,
    I would like to grant permission on all objects of a particular schema to apps user(Oracle 10g).How do I do it?
    (ex)grant all on <schemaname>.<objectname> to apps with grant option.
    This is the permission i want to give but i can't do it for all objects one by one so how do i do it in a single command.
    Regards,
    Arun

    You can't do it in a single command. You have to give object-by-object privileges (you could grant something like SELECT ANY TABLE, but that applies to every schema in the database and is generally a rather bad idea). You can, however, use a bit of dynamic SQL to do the job, i.e.
    FOR x IN (SELECT * FROM user_tables)
    LOOP
      EXECUTE IMMEDIATE 'GRANT ALL ON schema_name.' || x.table_name || ' TO apps WITH GRANT OPTION';
    END LOOP;You can do the same with other object types, hit DBA_TABLES rather than USER_TABLES if you don't want to run this as the object owner, etc.
    Justin

  • I need to create schema objects like OE,HR,SCOTT in existing ORACLE DATABASE INSTANCE

    I have oracle 9i installed and running.
    I need to create in existing Oracle Instance only few more schema.
    In instance we have schemas like SCOTT,OE,HR etc.,........
    How do I create my own schema object say PRODUCTS so that I can assign the required tables.
    has anyone has points and tips....
    please do send me the information
    thanks & regards
    Prakash

    Pl do not post duplicates - continue the discussion in your original thread - Re: Exp/Imp Database (DATA PUMP)

  • Access schema objects without having to specify the user.

    I've just created a role in a schema and assigned some priveleges.Then I created a user and granted the role to it. But as the newly created user is not the owner of the schema when I say a simle select query like this:
    SELECT EMLOYEENAME FROM EMPLOYEES
    I get "table or view does not exist" error. Is there a way I can wirte refer to objects in this schema without having to indicate the owner. So instead of writing SCOT.EMPLOYEES I want to write just EMPLOYEES.

    >
    I get "table or view does not exist" error. Is there a way I can wirte refer to objects in this schema without having to indicate the owner. So instead of writing SCOT.EMPLOYEES I want to write just EMPLOYEES.
    >
    Create a public synonym for the object.
    CREATE PUBLIC SYNONYM EMP32 FOR SCOTT.EMP;Then you do not need to specify the schema.
    --- edited to add doc reference
    See CREATE SYNONYM in the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_7001.htm
    >
    CREATE SYNONYM Purpose
    Use the CREATE SYNONYM statement to create a synonym, which is an alternative name for a table, view, sequence, operator, procedure, stored function, package, materialized view, Java class schema object, user-defined object type, or another synonym. A synonym places a dependency on its target object and becomes invalid if the target object is changed or dropped.
    >
    Edited by: rp0428 on Apr 5, 2012 10:56 PM

  • How to restrict a schema owner from granting privileges to other users.

    How can we restrict a schema owner from granting privileges to other users on his objects (e.g. tables). Lets say we have user called XYZ and he has tables in his schema TAB1, TAB2 an TAB3. How can we restrict user XYZ from granting privileges on TAB1, TAB2 and TAB3 to other users in the database. Is it possible in Oracle 10g R2? Any indirect or direct way to achieve this? Please help on this.
    Thanks,
    Manohar

    Whenever someone is trying to prevent an object owner from doing something, that's generally a sign of a deeper problem. In a production database, the object owner shouldn't generally have CREATE SESSION privileges, so the user shouldn't be able to log in, which would prevent the user from issuing any grants.
    As a general rule, you cannot stop an object owner from granting privileges on the objects it owns. You can work around this by creating a database-level DDL trigger that throws an exception if the user issuing the statement is XYZ and the DDL is a GRANT. But long term, you probably want to get to the root of the problem.
    Justin
    Edited by: Justin Cave on Nov 6, 2008 9:52 PM
    Enrique beat me to it.

  • Access to schema objects

    Guys,
    I am on 10g R2 and have this requirement.
    We refresh our QA environment from PROD every day ( exp/imp and schema refresh ). App team now have a requirement where by they want to create few objects including tables every day and load those tables with static data. This in a way doesn't need to be refreshed every day.. So, could place this in another schema. But we do not want to grant access on that schema to the user.
    Alternatively, we can get them to send the us a script, that can be run as POST refresh script on completion of the refresh. But this would mean that any changes to the script will involve us copying the file, which could be a hassle.
    I am wondering, if there is better way to handle this.. BTW, the app team do not have access to the database host and we don't plan to grant it either..
    What is the best alternative ?

    You can use DBMS_METADATA and EXECUTE IMMEDIATE
    SQL> create user u1 identified by u1;
    User created.
    SQL> create or replace type u1.type1 as object (a number, b date);
      2  /
    Type created.
    SQL> declare
      2  stat varchar2(32000):= dbms_metadata.get_ddl('TYPE','TYPE1','U1');
      3  begin
      4    execute immediate replace(stat,'"U1".','');
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL> desc type1
    Name                                                        Null?    Type
    A                                                                    NUMBER
    B                                                                    DATEYou can loop on all schema objects selected from dba_objecs to manage all objects with a single statement:
    SQL> create function u1.f1 return number is
      2  begin
      3    return 0;
      4  end;
      5  /
    Function created.
    SQL> declare
      2  stat varchar2(32000);
      3  begin
      4    for r in (select object_type, object_name from dba_objects where owner='U1') loop
      5      stat := dbms_metadata.get_ddl(r.object_type,r.object_name,'U1');
      6      dbms_output.put_line(stat);
      7      execute immediate replace(stat,'"U1".','');
      8    end loop;
      9  end;
    10  /
      CREATE OR REPLACE TYPE "U1"."TYPE1" as object (a number, b date);
      CREATE OR REPLACE FUNCTION "U1"."F1" return number is
    begin
      return 0;
    end;
    PL/SQL procedure successfully completed.
    SQL> desc f1
    FUNCTION f1 RETURNS NUMBER
    SQL> desc type1
    Name                                                        Null?    Type
    A                                                                    NUMBER
    B                                                                    DATEMax
    [My Italian Oracle blog| http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

  • Grant details required for user and schema

    Hi
    I have Oracle version - 10.2.0.4.0
    We have Schema A (Lot of objects exist) and User B (No objects exist - acts as application user to access objects in other schema).
    I have listed below doubts.
    1) I want to know the method to find the list of users have access to objects in Schema A and privileges granted for the objects in Schema A
    2) I want to know the method to find the list of grants provided to the schema objects to the user B

    user1368801 wrote:
    Thanks ajallen.
    It really helped me.
    one more question. I think DBA_TAB_PRIVS gives details for tables only right.
    What about other objects like procedures, views etc. Go back to the Reference Manual and re-read the description of DBA_TAB_PRIVS. Re-read the specific description of TABLE_NAME.
    >
    Actually I am exporting 3 schemas (A,B,C) from production and importing them to test environment (A1, B1,C1) using fromuser and touser option.
    Now I have to properly remap all the privileges, grants, synonyms etc.
    There are so many objects and I am wondering how to remap properly.
    It may be simple, as a newbie, your direction will be more helpful

  • Export Schema Objects

    I have Oracle XE in dev machine with objects (tables, sequences, views indexes etc) in a chaluwa schema. We want to test on a mock production machine with Oracle Enterprise Manager 11g (just downloaded it). First how do I use the XE interface (not code like in the link in the previous post) to export these objects.
    So far, I used XE's DDL creation utility to generate the code, I tried to run this code on an empty test schema in my dev machine to see if the DDL statements will replicate / reproduce the objects from the chaluwa schema, but I got errors. The DDL statements where not arranged in sequence, a foreign key field been created in a table was referencing a table not yet created. I wouldn't want to start tampering with the DDL code to rearrange it. In XE, I could make a schema by creating a new user, I 'v not been able (at least so far) to do this (create a schema) on the mock production machine running Oracle Enterprise Manager 11g.
    so the issues are :
    1. need to export the objects from chaluwa schema in the Oracle XE in my dev machine.
    2. create a schema on the mock production machine running Oracle Enterprise Manager 11g where I will put the exported objects from step 1.
    3. put the objects into the schema created in step two.
    Sorry if my questions were stupid, I really need your help. Cheers

    Hi,
    I have two XE at different machines, one in my office PC(production), and another at my laptop(dev), I use a lot of the datapump utility at XE, and it is great.
    And it is very simple to use, and it does have much more options of usage than my simple one, but my one works
    In case I would like to export all my data at machine1 to machine 2(and the schema name is chaluwa
    1. on machine1
    I create a directory by the OS at my machine1, like 'c:\chaluwa_080914'
    then I go to the sql command line(sql plus),
    sqlplus / as sysdbasql> create or replace directory anyname as 'c:\chaluwa_080914';
    sql> directory created.
    sql> grant read, write on directory chaluwa_080914 to chaluwa;
    sql> grant successed
    sql> exit;
    --- now you are back to the windows command line again
    c:\Document and Settings\peteryzhang> expdp system schemas=chaluwa directory=chaluwa_080914
    password: ******
    and then they will export all stuffs to the export file, the default name will be export and a log file.
    copy the directory(with its data exported) chaluwa to machine2;
    2. import the file you just exported to another database
    at the machine 2 , copy the chaluwa_080914 to a place, like 'd:\chaluwa_080914'
    and then go the sqlplus
    connect as sysdba
    sql>create user chaluwa identified by password default tablespace USERS(note: better the use the same tablespace as from machine 1).
    sql> user created.
    sql> grant connect, resource, dba to chaluwa ( that is what I usually use, maybe you not need the dba role, but you need some more proviliges for successfully import the export file, like, it depends, but, let's say, if you don't any right to create triggers, you cannot import triggers to it, it will fail)
    sql> success
    sql> create or replace directory chaluwa_080914 as 'd:\chaluwa_080914';
    sql> directory created.
    sql> grant read, write on directory chaluwa_080914 to chaluwa;
    sql> success;
    sql> exit;
    c:\document and settings\hostname>: impdp system schemas=chaluwa directory=chaluwa_080914
    and then the password.
    and at that, you will be successfully import the schema, and there's only one error, the user is already created, but it is Ok, fine.
    if you want to import the file into a different schema, you can do that, and if you need to import the file into a different tablespace, you can do that, there's some options,
    you can reference the doc at the*Xe two day DBA guide* and oracle database utilities:
    two day DBA
    http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25107/impexp.htm#BCEEDCIB
    Oracle Database Utilities
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/part_dp.htm#i436481
    Peter
    Edited by: PeterCN on Sep 15, 2008 10:05 AM

  • Could not get schema Object:java.sql.SQLSyntaxErrorException ora-904

    All of a sudden I get
    Could not get schema Object:java.sql.SQLSyntaxErrorException: ORA-00904: "SYS"."O"."NAME": ongeldige ID
    when doing anything in the tables tree in the connections pane
    The only thing I set recently is pga_aggregate_target
    Environment
    Oracle 11.2.0.1
    OS Windows Vista Ultimate sp2
    Sql developer 2.1.1.64.39 with its own JDK
    As the download links on OTN are broken I can not upgrade, and I'd rather not work in command line sqlplus.
    Help!!!
    Sybrand Bakker
    Senior Oracle DBA

    My copy of sqldeveloper isn't located in that directory. Would that matter?
    In the mean time I have disabled filtering the tables node. Opening the tables node doesn't result in exceptions anymore.
    Now, when I click on any table in that node I get 4 identical ora-904 error messages for sys.o.name for any table.
    Apparently it is querying either the all_objects view and it thinks it is querying sys.obj$.
    I didn't yet enable sql_trace for the session, I'm more or less giving up on sqldeveloper. I can not use the space bar in any datagrid, sqldeveloper has always been extreemly unresponsive when navigating the schema browser (as opposed to Toad), etc, etc. Too bad I bought Sue Harpers book, but I think I will be de-installing sqldeveloper soon.
    Sybrand Bakker
    Senior Oracle DBA

  • Schema And Schema Objects

    MySQL is a database server that can have several 'databases' each with it's own connection params, privileges, users and objects (tables, views etc). Oracle however has the structure of a 'single database' with 'categorized' objects (if I am correct), that is a database with one or more schemas (usually mapping to users) each containing objects (tables, views etc). If I want to build an application on oracle (I am using Oracle XE) that has several subsystems or modules (HR, Finance, Operations etc) and I want the subsystems to have their own boundaries (like their own database in MySQL, or their own schema in Oracle) containing only relevant objects but interconnected by the usage of the application (the application creates value or functionality across these subsystems), how do I go about structuring my database to handle this, since schemas map to users.
    Putt another way, since I'll be working with a user account (a schema) can I have schemas within this account / schema to contain objects for the modules. Wherever the 'module schemas' are, how do I interact with them collectively with my login account which I will use as the database connection within the application.
    I don't know if this is the best way to go about it, but my project requirement has changed to one that should have clearly defined modules having similar structures in the database that can be scaled up to their own database in a database server or each in it's own database server.

    I did not mention this, but I also already tried that without success. Whether 'DEPARTMENT_VIEW' or 'DEPARTMENTVIEW', I still get 'no data found'. I did not expect to succedd with 'DEPARTMENT_VIEW' just like that, because it is the name of the view in the other schema (HR) hence I made the synomyn 'DEPARTMENTVIEW' pointing to it, which hasn't worked either.
    I tried this query :
    "SELECT table_name FROM user_tab_columns"
    I could see only the tables defined in my schema. This makes me wonder how I can run a query against 'USER_TAB_COLUMNS' for a SYNONYM as the table_name, when 'USER_TAB_COLUMNS' has no entry for any of my SYNONYMS in the first place ??
    Based on what Ignacio Ruiz said :
    'you need to query ALL_SYNONYMS if you want to resolve DEPARTMENTVIEW'I tried this query :
    "SELECT table_owner, table_name FROM ALL_SYNONYMS WHERE synonym_name = 'DEPARTMENTVIEW'"
    and got the record, but I don't know how to merge this result to a query on 'USER_TAB_COLUMNS' to get the
    column_name, data_type, data_length, data_precision, data_scale, nullable etc for the said 'DEPARTMENTVIEW'.
    Please what else can I try. Thanks alot.

  • Oracle JDeveloper 10.1.3 Toplink Objects from Table Bug.

    i try this with updates and without them.
    toplink bug or toplink Wizzard Bug: I have create a conection to data base(MySQL) I use mysql-connector and everything works... i see the tables then i try to create "TOplink objects from Table " , choose connection ,for Schema i choose "none". When i choose AutoQuerry it shows the columns i add columns , I choose OK. When it ask for a name for the package i give him mypackage, when it ask for class name i also choose my package.Users(the table is Users) after which i have the following exception in MessageBox:
    "oracle.jdeveloper.cm.ds.db.InvalidNameException : Object must have a name."
    on details i get :
    oracle.toplink.addin.mappingcreation.MWProjectCreationException: oracle.jdeveloper.cm.ds.db.InvalidNameException: Object must have a name.
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:277)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:196)
         at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:416)
         at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: oracle.jdeveloper.cm.ds.db.InvalidNameException: Object must have a name.
         at oracle.jdeveloper.cm.ds.db.validators.AbstractValidator.validateName(AbstractValidator.java:54)
         at oracle.jdeveloper.offlinedb.validators.OfflineSchemaValidator.validateName(OfflineSchemaValidator.java:29)
         at oracle.jdeveloper.cm.ds.db.validators.AbstractValidator.validateObject(AbstractValidator.java:187)
         at oracle.jdeveloper.cm.ds.db.validators.AbstractValidator.validateObject(AbstractValidator.java:122)
         at oracle.jdeveloper.cm.ds.db.AbstractDBObjectProvider.validateObject(AbstractDBObjectProvider.java:822)
         at oracle.jdeveloper.cm.ds.db.AbstractDBObjectProvider.validateSchema(AbstractDBObjectProvider.java:858)
         at oracle.jdeveloper.offlinedb.OfflineDBObjectProvider.createSchema(OfflineDBObjectProvider.java:1954)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.updateOfflineDBandMWDatabaseWithTablesToMap(MappingCreatorImpl.java:450)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:242)
         ... 4 more
    in the messege log i get :
    Starting Java object generation...
    Creating offline database objects...
    A problem was encountered creating offline database objects.
    Aborted Java object generation.
    Message was edited by:
    JOKe
    Message was edited by:
    JOKe

    I have tried this out in the EA release of JDev, and have reproduced the problem you reported. However, trying out the latest development build, the problem does not occur, so this bug has been fixed. You'll pick up this fix when we next release the software on OTN.

  • How grant all the privilege of a specific schema to a user?

    How grant all the privilege of a specific schema to a user?
    I already create a new schema and import the neccessary data for that schema.
    Now I want to assign all the privilege for that schema to user HR (let user HR become the owner of that schema). How to deal with it?
    Edited by: qkc on May 13, 2011 10:45 AM

    qkc wrote:
    How grant all the privilege of a specific schema to a user?
    I already create a new schema and import the neccessary data for that schema.
    Now I want to assign all the privilege for that schema to user HR (let user HR become the owner of that schema). How to deal with it?
    Edited by: qkc on May 13, 2011 10:45 AMThere is no way - by definition - that one user can "become the owner" of another schema. A schema is, by definition, the collection of objects that belong to one owner.
    but perhaps that is just semantics in the context of what you really want.
    use sql to build sql:
    spool doit.sql
    select 'grant select on someuser.' || table_name || ' to someotheruser;'
    from dba_tables
    where owner = 'SOMEUSER';
    spool off

  • Using XSDBuilder to build XML Schema objects

    I want to parse an XML document using an XML Schema Definition that I provide explicitly to the parser, rather than one identified in the document being validated. It appears that I can create an XML Schema object using XSDBuilder, and give it to the XML parser using XMLParser.setXMLSchema(). The problem is that XSDBuilder.build() wants an XSD system ID that is a file, and I want to retrieve XSD documents from non-file-based stores. Ideally, I'd like to give the builder a stream containing the XSD, or barring that, provide a custom entity resolver that it can use. Any ideas how to go about doing that? Or am I going about this the wrong way?
    Thanks for any advice,
    markl
    null

    Hi,
    I didn't test it wit XML Schema, but any parser that finds a system ID should call an implementation of EntityResolver that returns an InputSource for the system ID.
    An InputSource is a wrapper around an InputStream and its url and it ssystemID.
    An example for sun's parser is on http://www.s-line.de/homepages/gerd_castan/java/resolve.html
    (I "tested" this code also with oracles DTD and Schema parser. This means that I used this code for oracle, too, but I didn't go through the debugger to see what it does.)
    Cheers,
    Gerd

Maybe you are looking for