Performance with having tables in different schema's

Hi all,
We have a requirement to segregate tables into different schema's based on the sources. But everything is going to be on the same instance and database.
Is there a performance hit (querying between tables) by having tables in different schema as apposed to having them in the same schema?
Thanks
Narasimha

Most likely there is bit of performance impact if your application refers the tables from different schemas. You need to use database link to access the other schemas. Even you schemas may in instance but when you use database link the network also comes into picture. even queries on same instance will routed through network connect and get the data. Distributed transaction also have issues some time. So as far as possible the distribution of objects should be avoided into diffrent schemas.

Similar Messages

  • Work with a table in different schema depending on the user group

    I have 2 groups of users user_group1, user_group2 and also two different schemas schema_group1,schema_group2 containing the same table names with a different content.
    Now, i have to write a stored procedure which takes user name as input and depending on which group the user belongs to, i want to work with table in that user_group schema.  i.e.(if user_group1 then "schema_group1"."table". if user_group2 then "schema_group2"."table" )
    i tried to set schema using dynamic sql but it seems that the schema is changing only after the end of the stored procedure.

    yes, i do maintain a table to map user groups with schema name.
    i have two tables:
    table-1: USERS(user_name, group_name)
    table-2: GET_SCHEMA(group_name, schema_name)
    // Just to make it simple(for testing purpose), i am directly assigning the schema_name inside the stored procedure.
    CREATE PROCEDURE "TEJA"."RETURN_SCHEMA_OF_USER" (IN IN_USER_NAME VARCHAR(30))
    LANGUAGE SQLSCRIPT
    AS
    BEGIN
         DECLARE VAR_USER_GROUP VARCHAR(20);
         --DECLARE VAR_SCHEMA_NAME VARCHAR(20);
         DECLARE SCHEMA_NAME VARCHAR(20);
         DECLARE SQL_STATEMENT VARCHAR(200);
         DECLARE VAR_TEMP VARCHAR(200);
         SELECT USER_GROUP INTO VAR_USER_GROUP FROM "TEJA"."USERS" WHERE USER_NAME =      IN_USER_NAME;
         --SELECT VAR_USER_GROUP AS USER_GRP FROM DUMMY;
         -- SELECT GROUP_NAME INTO VAR_SCHEMA_NAME FROM GET_SCHEMA WHERE GROUP_NAME =      VAR_USER_GROUP;
         -- Instead of above statement, i am directly assigning the schema_name below
         IF VAR_USER_GROUP = 'UNION' THEN
                SCHEMA_NAME := 'USER_UNION';
         ELSE
                SCHEMA_NAME := 'USER_CORPORATE';
         END IF;
         SQL_STATEMENT := 'SELECT * FROM "'||:SCHEMA_NAME||'"."USER_DETAILS"';
         --I have USER_DETAILS table in both the schemas.
         --SQL_STATEMENT := 'SET SCHEMA ' || :SCHEMA_NAME || ' ';
         --sets the schema after the stored procedure is executed.
         EXECUTE IMMEDIATE SQL_STATEMENT;
    END;
    This dynamic sql statement does the job for me, but i don't want to use dynamic sql in all my stored procedures. I need this kind of functionality in almost all of my stored procedures. So, i am looking for a better approach.  I really appreciate your valuable inputs.
    Thank you

  • Accessing tables from different schema in CDS and AMDP

    Hi All,
    We are working on a HANA system which has several schema replicated from SAP R/3/Non SAP systems. We have BW 7.4 SP9 deployed on the same system and accessing the HANA views using latest BW virtual objects such as Open ODS , Composite providers etc.
    We are also using the BW system for few ABAP based data processing developments. We are currently accessing HANA views in ABAP programs by creating dictionary views based on external HANA views.
    We would like to however use recent possibilities of CDS and AMDP for better life cycle management of ABAP based solutions. The open SAP course on this subject was of very good help. Thanks a lot "open SAP team" for that. I would however have few open questions,
    As I understand AMDP gives us full flexibility of writing sql procedures within ABAP development environment, but can we access tables from different schema into AMDP code. If yes, then sample code would help.
    If the answer of first question is yes, then how do we manage transports between development and production systems where the schema names would be different. Currently in open HANA developments, such transport is manged using Schema mapping.
    Can I also use different schema tables in CDS views.
    We are updating few tables in ABAP dictionary after applying processing logic in ABAP program as detailed in step 1. With the new approach using AMDP, can we directly update database schema tables which will give us an optimization advantage.
    New ABAP HANA program interfaces are quite promising and we would like to use them to optimize many data intensive applications.
    Thanks & Regards,
    Anil

    Hi Anil,
    I can only answer 1. and 2. (and would be interested into 3. as well):
    1.
    Yes you can access tables from a different schema and also HANA views. In this case no 'using' is needed.
    Examples:
        RESULT = SELECT
        FROM
              "SAP_ECC"."T441V" AS t,
              "_SYS_BIC"."tmp.package/AFPO" AS a.
        WHERE ...
    2. In this case, if you need schema mapping: You could use HANA (projection) views which just forward to a different schema, also see example.
    Best regards,
    Christoph

  • No Easy Way to Join on Tables from Different Schemas

    Hi,
    The company policy does not allow to join on tables from different schemas or use db links...
    I'm tasked to come up with a Perl script that does exactly that - allows for the SELECT statement to do several joins on 3 different schemas. In addition 1 of the schemas is on the different host altogether.
    Upping the privileges for my user and allowing db links is not an option...Can someone, please help me to understand on a conceptual level how would I use Perl and what logic would it have and what would it (perl) do?
    Thank you,

    Court in the wrong job... ;)
    It's like a librarian who is a hard rock artist maintaining the silence in the premises. ;)
    My dear friend, i don't think this is the right place for your requirement. This is the PL/SQL forum. If you have any problem related PL/SQL or SQL you can place that here.
    Regards.
    Satyaki De.

  • Read tables from different schemas in oracle

    Hi, I'm trying to write a code to run a query to get data from an Oracle server, the problem is that the query refers to multiple tables in multiple schemas... the regular way to do it in oracle (SCHEMANAME.TABLENAME) does not work in excel vba query and
    I cant find a way to so, any help will be really appreciated, below a sample code with one table from WWPP schema.....
    Const DB As String = "Driver={Microsoft ODBC for Oracle};" & _
                         "CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=1526))(CONNECT_DATA=(SERVICE_NAME=MyName)));" & _
                         "Uid=MyID;Pwd=MyPwd*;"
    Sub test()
        Dim cnt As ADODB.Connection, rst As ADODB.Recordset
        Set cnt = New ADODB.Connection
        Set rst = New ADODB.Recordset
        cnt.Open DB
        (I also tried this but didn't work) -> cnt.Execute "ALTER SESSION SET CURRENT_SCHEMA=WWPP"
        rst.Open "SELECT * FROM WWPP.SO_LIFE_CYCLE_BACKLOG_RP", cnt, adOpenDynamic, 2
        If rst.EOF = False Then
            Sheet1.Cells(2, 2).Select
            Selection.CopyFromRecordset rst
        End If
        rst.Close
    End Sub
    Oscar Marquez

    1) Posting the error number (i.e. ORA-00942) in addition to the error message is often quite helpful since that's generally far easier to look up and far less likely to get confused in translation.
    2) Are you using an invoker's rights stored procedure? Or a definer's rights stored procedure? If you're not sure, the default is definer's rights.
    3) How has YFS been granted access to the Y_PS table? My hunch is that it was granted access via a role, not via a direct grant. Privileges granted through a role would be available for ad hoc SQL queries, but those privileges are not available to a definer's rights stored procedure. A definer's rights stored procedure only has access to the privileges granted directly to the owner.
    If my hunch is correct, you'd either have to directly grant YFS access to the table(s) it needs to access in other schemas or you'd need to make the stored procedure use invoker's rights, which may have ripple effects down the line if users other than YFS are going to be running the procedure.
    Justin

  • Create a View from tables of different schemas

    hi all,
    can u pls give solution to create a View from tables of different schemas.
    i have to bring data from one DB Server A,
    which contains different schemas and tables in the schemas...
    i need to insert that data in another DBServer B.
    i made a procedure for this...
    but when the connection fails from A, then i could not get data...
    please suggest some solution..
    thanks,
    neelima

    I don't know what database system you use, but in the most I know it is done that way:
    SELECT
    A.COL1,A.COL2.....
    FROM
    SCHEMA_NAME.TABLENAME A,
    SCHEMA_NAME.TABLE_NAME B
    WHERE
    A.COL1 = B.COL2
    ...

  • Package Error!  join to tables in different schemas

    Hi
    I get an error whwn I want to put my query into package
    I have two tables in different schemas and I joined them and it works when I compile it
    but in the SP it doesn't works
    Is anbody help me? please
    Table1 in Schema1
    Table2 in Schema2
    TableID is the column which I join two tables (Table1.TableID=Table2.TableID)
    User1 has Select grant to both tables (it works when I run the query but in the sp which is in the package it doesn't work)
    Package1 in Schema1

    query is working
    but when I put that query in to package, Package is giving error like "table or view does not exist"
    Table1 in Schema1
    Table2 in Schema2
    TableID is the column which I join two tables (Table1.TableID=Table2.TableID)
    User1 has Select grant to both tables (it works when I run the query but in the sp which is in the package it doesn't work)
    Package1 in Schema1
    Select * from Schema1.Table1
    Inner join Schema2.Table2 on Table1.TableID=Table2.TableID
    is working in editor but
    CREATE OR REPLACE PACKAGE Schema1.PCKG_packagename AS
    PROCEDURE SP_procedurename
    Select * from Schema1.Table1
    Inner join Schema2.Table2 on Table1.TableID=Table2.TableID;
    END SP_procedurename;
    END PCKG_packagename ;
    is not working
    Must I give grant to Package?
    Edited by: 874779 on 25.Tem.2011 03:37
    Edited by: 874779 on 25.Tem.2011 03:51

  • Materialized view with tables in different schemas

    Hello,
    I want to create a materialized view with a table from a different schema in the SELECT statement. For materialized view I would like to apply the "REFRESH COMPLETE ON COMMIT" option.
    Here the code:
    CREATE MATERIALIZED VIEW S1.MV_EXAMPLE
    TABLESPACE TS1
    PCTFREE 0
    BUILD IMMEDIATE
    REFRESH COMPLETE ON COMMIT
    AS
    SELECT T.COLUMN1 COLUMN
    FROM S2.TABLE1 T
    I can't execute this SQL because I get an "insufficient privileges" error to this table:
    FROM S2.TABLE1 T
    FEHLER in Zeile 9:
    ORA-01031: Insufficient privileges
    User S1 has the following privileges:
    CREATE SESSION
    CREATE SNAPSHOT
    CREATE TABLE
    CREATE QUERY REWRITE
    SELECT ANY TABLE
    User S2 has the following privileges:
    CREATE SESSION
    CREATE SNAPSHOT
    CREATE TABLE
    CREATE QUERY REWRITE
    ALTER ANY SNAPSHOT
    Which privileges are missing?
    Thanks, Mathias

    Thanks Kamal for your answer!
    S1 has the grant select directly. But I solveld the problem. The system privilege "ON COMMIT REFRESH" was missing for S1. This has to be set if any of the tables are outside the owner's schema of the materialized view (ORACLE documentation - Data Warehouse Guide).
    But one thing is not clear to me yet and the ORACLE documentation doesn't give me an answer. I can set the refresh-attribute ON COMMIT on a materialized view containing only joins when a group by clause is set. If the group by clause is missing I can't! Why?
    Regards, Mathias

  • Analytic View with tables from different schema

    Hi,
    I'm curious if I make something wrong or if this is not possible:
    I want to use two tables each in a different schema. I can drop them into the DataFoundation, can connect them, assign them some measure. But activation fails due to insufficient privileges. When I use the tables from the same schema activation works well. With the insufficient privileges I would guess HANA cannot create a View (failed with the statement CREATE COLUMN_VIEW "_SYS_BIC"."USER/ANALYTIC_VIEW_NAME"....).
    Since I tried the same assignment with the System-User and failed I wonder what kind of permissions are required. Or is this generally not allowed (resp. prohibited)?
    If not allowed, could somebody give me a hint, why its not possible?
    If it is possible, what kind of rights are required to get it working?
    roland

    Hm', I have allowed SYS_REPO the rights to the table and was able to activate the view. But now I have the problem, that the DataPreview is not working (again insufficient privileges). What user has to have additional permissions for the JDBC-query?
    Do I have to take care more on the privileges for other things?

  • Code and core tables in different schemas

    Hi,
    My db version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    I would like to understand, the pros and cons of the following situation:
    We have a single application.
    The db design for this application has 44 tables out of which 28 are core tables related by PK and FK relationships. The remaining 16 are look up and reference tables which are not related to any.
    The team decided to place the 28 core tables in one schema A and the remaining 16 in another schema B within same database. (The reason for this is..since it is done in other projects lets do it here too).
    Now comming to the code (stored procs, functions, packages etc). The teams wants to place most of the code in the schema B that has the 16 ref tables. (the reason again being the same).
    What are the pros and cons doing this???
    Please advice.
    PS:
    I have googled and found sth on these lines:
    cons: 
    o harder to manage
    o harder to upgrade
    o harder to patch
    o harder to maintain
    o causes your shared pool size to increase 1,000 times (shared sql goes down the tubes)
    o takes more space
    o queries against the dictionary will be impacted
    o latching on the shared pool goes WAY up (latching = locks = serialization device =
    slows you down)
    pros:
    o none that I can think of.

    >
    I would like to understand, the pros and cons of the following situation:
    Yes I am straining to find more points (was not good at it though).
    >
    You just want to understand? Are you sure? Your thread reads more like you just want to do things your way and are looking for support.
    >
    The team decided to place the 28 core tables in one schema A and the remaining 16 in another schema B within same database. (The reason for this is..since it is done in other projects lets do it here too).
    Now comming to the code (stored procs, functions, packages etc). The teams wants to place most of the code in the schema B that has the 16 ref tables. (the reason again being the same).
    >
    My question to you is: what PROBLEM are you trying to solve? If the 'team' already uses this approach and there haven't been any substantive problems then why try to change things now? Why have you chosen to fight this battle?
    Your 'team' has already decided and now, after that decision, you want to argue about it with them? The time to present arguments for/against a given plan is BEFORE the decisions are made, not after. Once a decision is made you need to be a team player and implement that decision to the best of your ability.
    One thing I'm certain of. If you try to support your argument using things like that 'AskTom' link you posted any credibility you had will go out the window. That link, as you already hinted yourself, is not your use case at all. All it takes is for one of your 'team' members to point that out and everyone will pretty much stop listening to any other arguments you make.
    People are generally not going to 'change their ways' unless you can show them:
    a) there is something seriously wrong with the way they are now doing things or
    b) a new way of doing things provides some substantial benefits
    Choice 'a' above is where you need to start but you haven't provided ANY information in this post that you have identified any serious issues with the status quo.
    The main task for Oracle is to be able to FIND the objects being referenced. So, in my opinion, that is what you should focus on when looking for PRO/CON arguments.
    That is: What issues are there if an object being referenced is in a different schema than the session that needs to use the object?
    1. objects may need to be prefixed with the schema name
    2. public or private synonyms may need to be created/maintained to avoid having to deal with item #1 above
    3. new grants may be needed to implement/maintain the proper security
    4. new roles may need to be created to maintain proper security (see item #3 above)
    5. additional work will be needed to maintain the new roles in item #4 above
    6. PL/SQL code may not be able to reference the object or may reference the wrong object
    7. Roles are disabled in PL/SQL (see item #6 above) - this means that the new grants (see item #3) may need to be granted directly to the schema users that need access instead of to roles. That can make it harder to create and maintain a role-base security schema.
    If I were you I would spend my time on other more important thingsd. But if I chose to fight this particular battle then I would make a list of problems that occured in the past with the current method of doing things and also problems related to the above list of items and then show how many of those problems will 'disappear' if the new method is used.

  • How do I write into multiple target tables in DIFFERENT schemas?

    It is easy to have a mapping that writes into 2 or more tables it's results. I now need that all these tables are in different schemas!
    When I create a 2nd warehouse target with a 2nd location and configure this location to be a different schema on the database, validation tells me, that everything is okay.
    When I generate it, there are several warnings, when I execute it, it doesn't work :( It complains that it cannot find <something>.
    I'm sorry, I don't have the error-message at hand :(
    I've you got an idea, how I could have different schemas for my tables, please let me know!

    Art,
    Could it be that the target schema into which you install the runtime components does not have privileges on the tables in the other schemas? You have to have at least the right privileges (INSERT, UPDATE, DELETE) on the target tables in the other schemas in order for this to work. However, then there should be no reason, assuming your tables are in different modules related to different locations.
    Thanks,
    Mark.

  • Replication of tables in different schemas

    Hello,
    I have 2 schemas and would like to have tables (same structure), in the 2 different schemas, to be in sync.
    For eg:
    sample1.table_one
    sample2.table_one
    desc sample1.table_one is exactly the same as sample2.table_one
    I want both sample1.table_one and sample2.table_one to be in sync, when any changes are made to any one of them.
    Does Oracle 9i provide any mechanism for this or is the only obvious solution with PL/SQL and/or triggers.

    Zaid,
    If you have two identical identical tables, that contain the same data, you should just give grants to different applications based on the type of web applications and your business logic.
    Trying to replicate them and keeping in them in Sync is a tedious ( and wrong approach)
    which will will need a change (to the packages used to keep them in sync) everytime any of those table definition changes among many other problems..
    >
    With views the problem or limitation for me is that there are 2 web applications using each of the tables respectively. They have the ability to update the tables.
    This is why replication...
    >
    If you have Schema1.table1 and schema2.table1, is it not possible to change your web application code to just use one of these two schemas ? You can always write scripts to migrate the existing data from schema2 to schema 1.

  • How to copy data, table rows between tables in different schema

    how do I copy rows from one table in one schema into another table in another schema in same database?

    Hi,
    Give an Access to the respective table in Source Schema to Destinations Schema. If table does not exits in the destination schema use CTAS else Insert into..etc., with your select Query.
    - Pavan Kumar N

  • How to create directories with same name in different schemas

    I have two schemas on the same database.
    I am trying to create directories with same name, but different paths in both the schemas.
    When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    Is there any solution to create directories with same name, but different path in two different schemas on the same database.
    Thanks,
    Sridhar.

    Hi,
    >>When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    If you have removed the REPLACE clause of your create statement, then you would see that is not possible.
    SYSTEM> connect scott/tiger
    Connected.
    SCOTT> create directory mydir as '/tmp';
    Directory created.
    SCOTT> connect legatti/pwd
    Connected.
    LEGATTI> create directory mydir as '/tmp';
    create directory mydir as '/tmp'
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    LEGATTI> select owner,object_name,object_type,created
      2  from dba_objects where object_name='MYDIR';
    OWNER     OBJECT_NAME    OBJECT_TYPE         CREATED
    SYS       MYDIR          DIRECTORY           19/12/2007Cheers
    Legatti

  • Insert into tables in different schemas

    hi,
    I insert into few tables through stored procedures, now there is a scenario wherein,
    by passing parameters to the stored procedures i should be able to insert into table in another schema.
    Eg.,
    Table EMP in Schema Dev
    Table EMP in Schema Test
    MY stored procedures should insert into dev's emp or Test's EMP table based on the parameter.
    The procedures are combined as a package and will be run through CONTROL M scheduler with the help of environment files.
    Thanks in advance

    A) Double your procedures/packages and let Control-M run it in Test and in Production environment.
    B) Avoid dynamical calls. This will usually create problems later on. E.g. if column ename is dropped from table emp, your package will not invalidate. Furthermore each dynamic SQL has a potential risk for code injection if not used with binding. Imagine somebode calls this with v_schema = ' dual values (''hacked db''); insert into test'
    C) There is some ALTER SESSION command to switch the current schema. Maybe this helps.

Maybe you are looking for

  • HT5517 Is there a way to select multiple speakers from my ATV3?

    I have ATV3, an iPad2, a Sony Vaio laptop and another audio system connected to my WiFi network via an Airport Express. Via ATV I can only select one speaker / output at a time (i.e. EITHER Airport Express OR ATV).  When I have a party in the house (

  • HT1923 how to save all my itunes data to reinstall on a new hard drive

    i want to reinstall my windows 7///how do i keep my downloaded mobile applications , backups for Iphone etc...to be incorporated back to iTunes once I renstall windows & new install iTunes. I have a seperate temp hard drive setup where i have other w

  • Download a zip file with gui_download = CRC error

    Hello erverybody, I download a zip compressed file with gui_download (cl_gui_interface_services) in binary mode. When I try to open it, I have a crc error. Does anybody has any idea why? here the code:        TYPES: begin of t_zip,              text(

  • How to have full screen from a 3/4ths screen? 3/4ths happened accidently. How to avoid?     .

    How to change from the three-quarters display that I have now, to full screen display ? 3/4ths display was accidently done recently. Has happened before & Apple  people told me the fix, but have forgotten. Something simple. How to avoid in future ? T

  • G5 PowerPc vs G5 Intel

    Hi all, this is more of an "asking opinions" thing. With the new G5 Intels coming around the corner. Is there any point in acquiring the current G5 models or the ones before that? I'm just noticing alot of G5s being put up for sale, including the lat