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/]

Similar Messages

  • Cancelling the privaleges of the user accessing the schema objects ???

    Hi,
    I have given privilages to the user to access my schema objects(tables). Can i cancell the privilages of the user of accessing my schema objects(table) which i granted them ???
    Thank you !!!

    Hi,
    If you gave a privilege or role to a user using GRANT, you can take it away using REVOKE.
    For example:
    REVOKE  SELECT ON my_table FROM user_name;un-does the privilege given by
    GRANT  SELECT ON my_table TO user_name;

  • Access other schema object from connection

    Hi;
    from the dbconnection, how can I access other schema object?
    Thanks

    Hi,
    I don't know if I understand correctly but if you mean the scenario you connect to the database as SCOTT and you want to map table EMPLOYEES from HR schema, you can do it within wizard and in read only view object you
    use schema name as prefix like select * from HR.EMPLOYEES. If you mean something else please describe it more.
    regards,
    Branislav

  • Access another schema object

    In my application,there is a database connection to a schema and and I have created entities and views from the available tables in that schema.According to my requirement, I need to access a table from a different schema.
    How can I do that?
    Please help
    Regards
    SK

    Specify the schema prefix in the SELECT query.
    SELECT * from OE.CATALOG

  • Grant privilage to access diff database objects

    How can we grant access to user1 from db1 to access user2 schema objects in db2 database ? Well, the user1 needs to perfrom insert, update and delete on db2's user2 schema.
    hare krishna
    Alok

    You may create a new schema on DB1 and create all synonyms with appropriate privileges for all the tables which need access.
    Create a database link from DB2 to access this new schema.
    This way you will be protecting other objects from getting modified from DB2.

  • Grant schema to be able to access another schema"

    how can i grant another schema to be able to access another schema
    Edited by: adf009 on 2013/02/15 5:07 PM

    adf009 wrote:
    i want to access one schema object through another schemaGRANT SELECT ON SCHEMA_A.EMP TO SCHEMA_B.
    It's in the SQL Reference Manual.

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • Grant access to all object/tables in other schemas to a user

    Is there any and simple way to grant access to all object/tables in other schemas (more than one) to a scheme/user?
    Thanks.
    Tarman.

    HI.
    grant SELECT ANY TABLE,delete any table, insert any table to user; Giving this delete,insert ANY TABLE privilege to a user can be dangerous and the use can mislead it. Its better to create a dynamic script and then grant it.
    E.g Suppose you want to give select,inert,delete,update privileges to user A on user B's object.
    sql> spool grants.sql
    sql> select 'grant select,insert,update,delete on '||owner||'.'||table_name||' to A;' from dba_tables where owner='B';
    sql>@grants.sqlHTH
    Anand

  • 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

  • Creating a Report based on different schema objects

    Hi,
    I have a situation in creating Reports for my database performance.
    Let me explain my requirment.
    There are 2 schemas in my database called X, Y
    X owns all the performance related data. But Y has read access on X objects.
    Now in APEX I have a developer DEV1 is mapped to database schema Y through WS1.
    I cannot map DEV1 to database schema X for security reasons.
    When I am trying to create a report as DEV1, it is allowing me to create based on the objects owned by schema Y.
    However it is not allowing me to create a report based on objects owned by X though Y has SELECT privileges on X's objects.
    Can any one help in this?
    Regards
    Balaji

    This is the query which I am using to build a report
    SELECT
    rollup_timestamp "Date",
    max(decode(target_guid,'199F0B201A3D71A63040BADFAA4F9E90',average,0)) host1,
    max(decode(target_guid,'3FB1329F59339C07E11304B69DC4E594',average,0)) host2
    FROM "sysman.MGMT$METRIC_DAILY"
    WHERE
    (target_guid='199F0B201A3D71A63040BADFAA4F9E90'
    or
    target_guid='3FB1329F59339C07E11304B69DC4E594')
    AND
    metric_name='Load'
    AND
    metric_column='memUsedPct'
    AND
    rollup_timestamp >= to_date('01-10-2009','dd-mm-yyyy') and rollup_timestamp <= sysdate
    GROUP BY rollup_timestamp
    ORDER BY "Date"
    And for your previous question I couldn't even create a page.
    Regards
    Balaji
    Edited by: user7290747 on 6/01/2010 16:17

  • Why two different users from same login group not able to access the database object(stored procedure)?

    I have SQL login group as "SC_NT\group_name" in server. There are multiple users using this login group to access database objects. User "A" can able to access db object(stored_procedure_1) from .net application. But when user "B"
    tried to access same db object(stored_procedure_1), its showing like
    Error: The EXECUTE permission was denied on the object 'stored_procedure_1', database 'test',schema 'dbo'. 
    Both the users are using windows authentication for access the objects. Could you suggest me the way to resolve this?
    Venkat

    Thanks for your response
    Erland Sommarskog....
    my stored procedure "stored_procedure_1"
    does not has any granted permissions to execute. But still user A
    able to execute the sp from UI, where user B not able to do it.  If any permission provided for a particular object, then only it will display in the above query whatever u have given.  
    Any other possibilities??
    Venkat G

  • Query in Stored Procedure accessing another schema

    Hi - this is going to sound kind of strange and even i can't come up with an explanation. My JDK 1.1.7 applet uses a type 4 JDBC thin driver (i think v 8.04.06) to access an Oracle 7.3.4 database. We also have a link with full grants and synonymns to another Oracle schema in an Oracle 8 database. Has never been a problem - we can access anything we need to through queries or stored procedures from either of these databases.
    So, i have a new stored procedure that needs to be called through JDBC that queries a table in the Oracle 8 database. For some reason, whenever i execute this stored procedure from java it hangs on this query and the instance needs to be restarted. If i execute that same stored procedure from SQL Plus, it runs fine.
    I tried a little test. I put a straight query in my java code that goes directly to that table (no stored procedure involved). It runs great through java!
    is this weird or what? my dbas have checked out all privelages and it seems that i have access to everything i could possibly need.
    If anyone has any suggestions i would love to hear them.
    thanks for your help...
    Lori - [email protected]
    null

    You can only access an object in another user's schema if you either:
    (a) Specify the 'other' schema name explicitly: SCHEMA.OBJECT
    (b) A synonymn has been created to access the object: CREATE SYNONYM OBJECT FOR SCHEMA.OBJECT.
    The user requiring the synonym should create it, or the user owning the object can create a PUBLIC synonym, if they have the authority.
    To check my hypothesis, try typing 'DESCRIBE procedure_name' from SQL*Plus as both users.

  • Grant access to schema

    Can some give me a script to do the following:
    I have a schema name ABC and I want to give a user XYZ read access to all objects in the ABC schema. ie (TABLES, VIEWS. SWQUENCES etc)

    Hi,
    user8822168 wrote:
    Can anyone share some light on this
    select 'grant select on '
         || owner
         || '."'
         || object_name
         || '" to ABC'
    from      ALL_objects
    where      object_type in ('TABLE','VIEW','SEQUENCE')
    AND      owner IN ('XYZ', 'PQR')
    I run the above sql and it exeute without error and it shows that the grant was given to "ABC", but when I login as ABC I cannot see any of the objects that belongs to XYZ or PQR.
    I did use XYZ.object_nameThat looks like the correct way to build a GRANT statement.
    Post the complete procedure, including the EXECUTE IMMEDIATE statement that runs the statement built by the query above.
    Please don't post unformatted code. Type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Do I need some special previlege to grant select access to ALL ('TABLE','VIEW','SEQUENCE') at once As far as I can tell, you're not granting privileges on all objects at once; you're granting privileges on one object at a time (if at all; I haven't seen your EXECUTE IMMEDIATE statement).  There may only be a couple of milliseconds between the GRANT statements, but each one is for only one object.
    I even try to use one owner at a time by login as the schema owner but it did not work.Before XYZ can grant privileges on PQR's objects, PQR must grant the same privileges to XYZ WITH GRANT OPTION.
    I suggest you not try to do this; instead, have XYZ run the procedure just to grant privileges on XYZ's objects, and have PQR run it to grant privileges on PQR's objects.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SAP HANA Security - Best Practice for Access to Schemas??

    Hi,
    Currently we don'y have a defined Security model in HANA Studio.Neither there is no defined duties of a BASIS / Security / Developers.
    I want to understand what best practices are followed at other customers for defining security for Schema.
    1. Who should be creating the schema for Developers / Modelers?
    2. Should we use our own ID's to create/maintain these Schema or a Generic ID?
    Right now, when developers log in to Studio, by default they are assigned to their own schema (User ID) and they create objects under that.
    We(Security team), face issues when other developers need access to schema of another user as they want to develop objects under schema of different user
    Also, who should be owning the "SYSTEM" user ID and what steps needs to be done whenever a new schema is created.
    Thanks for the help in advance.

    Hi,
    I created a project (JDeveloper) with local xsd-files and tried to delete and recreate them in the structure pane with references to a version on the application server. After reopening the project I deployed it successfully to the bpel server. The process is working fine, but in the structure pane there is no information about any of the xsds anymore and the payload in the variables there is an exception (problem building schema).
    How does bpel know where to look for the xsd-files and how does the mapping still work?
    This cannot be the way to do it correctly. Do I have a chance to rework an existing project or do I have to rebuild it from scratch in order to have all the references right?
    Thanks for any clue.
    Bette

  • Track the qeries that accessed a particular object during a time period

    HI,
    I have a list of objects on my schema and i need to track the list of sql queries by different users that accessed by object during this time period.
    i haven't enabled any auditing yet.
    is there any way i can get that list of queries and their schemas that accessed those particular objects during a particular time period.
    Can someone guide me please.
    Thanks in advance.
    Philip.

    Too bad you don't have a version number. Oracle functionality changes from version to version and in some versions you can do this and in some you can not.
    Look here for one way to accomplish the task:
    http://www.psoug.org/reference/dbms_fga.html
    Here for another:
    http://www.psoug.org/reference/audit_vault.html
    Here for another:
    http://www.psoug.org/reference/dbms_logmnr.html
    Consider posting more information when asking questions in the future.

Maybe you are looking for