Renaming View from another schema

Hi,
I've 2 schemas  namely  department  ,  hr
Now department schema is having one table EMP . And a view is created on that table with the name R_EMP
Schema Name :  department
Table Name  :  EMP
View Name   :  R_EMP
GRANT SELECT ON R_EMP  TO  HR ; 
In HR schema a synonym has been created on view R_EMP with the name R_EMP .
CREATE OR REPLACE SYNONYM hr.R_EMP for department.R_EMP
Schema Name :  hr
Synonym Name:  R_EMP
Now I want to rename the view name R_EMP  to V_EMP  from  HR schema only
So, I tried the folloiwng syntax in HR schema (All the operations should be done from this schema only )
[code]
RENAME department.R_EMP to department.V_EMP ;
Error:
ORA-01765: specifying table's owner name is not allowed
[/code]
How to change the syntax to make the statement work from HR schema .
Thank You .

Smile,
The questions is pretty much answered now. You might want to have a look at this as well.
How to rename a table in another user's schema
You can alter the session to set your current schema to the name of the schema where you want to rename the view and then do a direct rename.
Thanks,
Ishan

Similar Messages

  • Cant view objects from another schemas

    Hi everybody!
    I have a 10.1.2 Jdeveloper and a 9.2.4 Oracle database.
    I successfully created a database connection.
    With provided login I can access to tables from another schemas in SQL Worksheet, but I cant see any objects from those schemas in the connection tree.
    What's wrong?

    The Schemas are being filtered so that you only automatically see the schema for the connection that you logged on with. To change the schemas that are visible you need to :
    1) Select the connection name in the Navigator (you should see that it has a filter icon overlaid showing that it is being filtered)
    2) Invoke the context menu and select 'Apply filters'
    3) Shuttle over the other Schemas you wish to see and press OK
    Regards,
    Lisa Sherriff
    JDev QA

  • 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

  • How to call a view from another

    Hello Experts,
            I have embedded a view (let us call this view 'A') in standard homepage. This works fine. Now on click of a button on this embedded view I want to launch another view that is also created by me, in the same component in which I had created view A. But I do not know how to launch this second view
         Could you please tell me how to call/launch a view from another on click of a button?
    Regards,
    Prafful

    Hello Prafful,
    I guess by launching you mean substituting one view by another. It can be achieved by declaring a navigational link in the runtime repository from one view to another. You have to create an event handler on the button and outbound plug in your view using the wizard. Then, on the event handler you call an outbound plug where you trigger a navigation using this navigational link and the view A will be replaced by view B.
    A code which needs to be done in outbound plug:
    me->view_manager->navigate(
    source_rep_view = me->rep_view
    outbound_plug   = 'NAVLINKNAME'
    data_collection = iv_data_collection ).
    Best Regards,
    Yevgen

  • How to refer one view from another view?

    Hi,
    I have 2 views in my Adobe Flash Builder mobile app. I need to refer the first view in my second view.
    How to refer one view from another view? Or how to create a reference to a view wherever needed?

    I don't need any data from my first view. In a certain flow, I need to make my first view to be invisible.
    for eg., My First view is in portrait mode. I change the device to Landscape. In the landscape mode, I want to show a completely different view (second view).
    In this case, what happens is, I see my first view in Landscape mode for a second. Then the second view appears. When I change to Landscape mode, only the second view should be seen. I need to make my first view to be completely invisible in the OnOrientationChanging event of
    StageOrientationEvent
    As stage object and StageOrientationEvent works at application level, I need to know how to refer my first view object in the application level.
    private function onOrientationChanging(soe:StageOrientationEvent):void
          MyFirstView.Visible = False; ====> don't know how to refer MyFirstView here
    Is my question clear now?

  • Selection from Another schema by default without schema name qualifier.

    Hi
    Oracle10g release 2, LinuxOS
    i want my schema (User_1) to always select,insert, update, delete the objects from another schema (User_2) without passing full schema qualifier every time whenever i don't pass any schema name explicitly.
    i.e. if i pass the following guerry
    select * from table_a;
    the table of user User_2.table_a (User_2.table_a) will be queried by default instead of table (User_1.table_a)
    and the same implementation is also required in Functions , procedures, sequences etc.
    Wishes

    Three relatively easy options
    1) Create private synonyms in User_1's schema for each object in User_2's schema, i.e.
    CREATE SYNONYM table_a
       FOR user_2.table_a2) Create public synonyms for each object in User_2's schema. This will make it possible for all users to query user_2's objects without specifying the schema name
    CREATE PUBLIC SYNONYM table_a
       FOR user_2.table_a3) Change the current schema for the session (potentially in a login trigger)
    ALTER SESSION SET current_schema = USER_2There are other options that are a bit more complicated like using enterprise users with shared schemas. But most people are perfectly happy with one of these three.
    Justin

  • Selecting from another schema

    If I want to select table from another schema, I have to type
    select * from [username].table_name.
    What can I do inorder not to write shema name all the time.
    for instance:
    instead of writing
    select * from [username].table_name.
    select * from table_name.

    create synonym for the object in other schema:
    create synonym <syn-name> for schema.tablename;
    then use syn-name in place of schema.tablename in ur query
    like
    select * from syn-name;

  • SQL Report From Another  Schema

    Is there anyway to select a table from another schema?I have a default schema for my application but i want each user to use their own schema.
    I'm looking for something like #OWNER#.table_name but replacing #OWNER# with the name of another schema in the workspace.
    Kind Regards,
    BgUrsea
    APEX 4.0 10g XE

    Hello BgUrsea,
    you could achieve this by granting the needed privileges (e.g. select, insert, update, delete) on each table in the #OWNER#-schema to your applications parsing schema.
    If you can't use a direct mapping (e.g., you can't assign the schema name of a user as usernames for his application user), you probably need a mapping table in your parsing schema. Define an application item (e.g. "F_OWNER") and create a application computation that executes "On New Instance" and does something like
    SELECT schema
      FROM mapping_table
    WHERE owner=v('APP_USER');If you aren't sure you always have a mapping, you might think about an application process that not only computes the value but also handles the action to be performed in case there is no mapping for a user.
    But I suppose it could be easier to have a copy of you application for each user and assign the appropriate schema to each copy. That way, you don't need the mapping, you don't need to care about always using the #OWNER# when developing your application, and of course, no user can (not even accidently) access another users (or your default) schema.
    -Udo

  • Spatial query on view to another schema

    Hi,
    I am getting the following error on this query :
    select ufi from cadastre where
    sdo_filter(geometry,
    mdsys.sdo_geometry(2003,8311,NULL,
    sdo_elem_info_array(1,1003,3),
    sdo_ordinate_array(130.967,-12.510,131.000,-12.486))) = 'TRUE';
    ORA-13226: interface not supported without a spatial index
    Cadastre is a view of a table stored in another schema.
    This query works :
    select ufi from sdo_owner.parcel where
    sdo_filter(geometry,
    mdsys.sdo_geometry(2003,8311,NULL,
    sdo_elem_info_array(1,1003,3),
    sdo_ordinate_array(130.967,-12.510,131.000,-12.486))) = 'TRUE';
    I have an entry in user_sdo_geom_metadata for CADASTRE , do i also need an entry in user_sdo_index_info for the query to work.
    Does any one have any ideas ?
    James

    Dan,
    I have worked out why it happens. We have a parcel table that is made up of polygons and points. The points are parcel's that have no legal boundary or survey boundary, just a point where a house might be located.
    What i had forgotten was that i had created a function to convert these points into a polygon on the fly. This buffer function is called from the view.
    example
    create view cadastre
    as
    select
    ufi,
    parcel_key,
    buffer(geometry) "GEOMETRY"
    from sdo_owner.parcel;
    I am guessing that because the geometry is no longer geometry from a table but created geometry it does not have a spatial index associated with it.
    Here is the buffer function
    CREATE OR REPLACE FUNCTION buffer
    geometry MDSYS.SDO_GEOMETRY,
    layer_name VARCHAR2
    RETURN MDSYS.SDO_GEOMETRY
    AS
    temp_geom MDSYS.SDO_GEOMETRY;
    diminfo MDSYS.SDO_DIM_ARRAY;
    start_x FLOAT;
    start_y FLOAT;
    end_x FLOAT;
    end_y FLOAT;
    BEGIN
    SELECT u.diminfo INTO diminfo
    FROM user_sdo_geom_metadata u
    WHERE u.table_name = UPPER(layer_name);
    IF geometry.GET_GTYPE() = 1 THEN
    temp_geom := sdo_geom.sdo_buffer(geometry,diminfo,4,'units=m arc_tolerance=0.005');
    return temp_geom;
    END IF;
    IF geometry.GET_GTYPE() = 2 THEN
    temp_geom := sdo_geom.sdo_buffer(geometry,diminfo,4,'units=m arc_tolerance=0.005');
    RETURN temp_geom;
    END IF;
    IF geometry.GET_GTYPE() = 6 THEN
    temp_geom := sdo_geom.sdo_buffer(geometry,diminfo,4,'units=m arc_tolerance=0.005');
    RETURN temp_geom;
    END IF;
    RETURN geometry;
    END;
    James

  • To kill session in one schema from another schema

    Hi Team,
    I got a problem like a table from one of my schema has been locked. I am getting 'ORA-00054: resource busy and acquire with NOWAIT specified' error when trying to delete rows from that table or even when trying to truncate that table.
    Let the table be 'T1' present in schema 'VIEW'
    I tried to kill the session which is active for that schema by below query
    select sid,serial#,status from v$session where username='VIEW' and STATUS = 'ACTIVE';
    alter system kill session '681,2586';
    But i couldn't do the above as i don't have DBA privilege for that. But i have DBA privilege for another schema let it be 'ADMIN'
    Now how can i kill the session in schema 'VIEW' from schema 'ADMIN'
    can any one get me solution.
    Thanks in Advance
    11081985

    I got a problem like a table from one of my schema has been locked. I am getting 'ORA-00054: resource busy and acquire with NOWAIT specified' error when trying to delete rows from that table or even when trying to truncate that table.
    Before you do anything why don't you actually find out WHY that table has been locked.
    You generally should NOT be killing sessions without knowing what is causing the problem to begin with.
    Then you also need to determine if you should use KILL SESSION or instead use DISCONNECT SESSION and well as whether the use of IMMEDIATE is appropriate.
    Each of those choices acts differently. Many people use KILL when they should really use DISCONNECT.
    See DISCONNECT SESSION Clause and KILL SESSION Clause in the ALTER SESSION chapter of the SQL Language doc
    http://docs.oracle.com/cd/E11882_01/server.112/e17118/statements_2014.htm#i2282145

  • Constraints From another schema

    Hi Guys,
    I have a table referral_contacts which has a column customer_id.This col is coming from a synonym whose base table is in another schema.
    So the current requirement is to establish the referential constratint from that table .I think there is no way to add constraint from a synonym whose base table is in another schema.Is there any method to achieve this without crating the same table .
    Any suggestions,coments are highly appreciated.
    Thanks,
    Prafulla

    Hi Prafulla
    It will be very tough for maintenance in long term if you create cross-reference constraints across schemas. That won't be a good design unless the same application owns both schemas. If each schema is used by different application and that only the second schema is populated with data realtime which is needed by the other application then you can create a new table and refresh it from the other schema in real time as well. You can check Materialized views (fast refresh, incremental refresh, using rowid, etc) for this purpose or you can also look at various other options (using trigger on the second schema to populate the new table in your schema and keep this in sync with that).
    Just for your information, Materialized views is a feature of EE. Tell us more about your environment

  • Can't see DDL of views from other schemas in Developer?

    Hi,
    I've seen elements of this problem in other threads but this problem of course has it's own twist.
    I can see other schema's objects EXCEPT VIEW DDL.
    I have given a user every role and priv that I can and they still can't see the view ddl of another schema. They can see procedures, functions etc. just not the view. I've found that if I use the user that created the users I can see the DDL of all subordinate users. Users created under that schema can not see each others views no matter what rights are given. Interestingly enough sometimes when I look to display view DDL it will flash the DDL briefly before blanking the screen. very frustrating. All the Toad fanboys are crowing about how they couldn't possibly use a tool that doesn't allow them to see other view source.
    I have also looked for settings in the preferences but could find none.
    Is this a bug? It seems like one to me.
    Any help is greatly appreciated.
    Thanks
    Mark

    We have a bug logged for this.
    Sue

  • Opening a view from another view of the same window in diff Browser.

    Hi Experts,
    My requirement is to open a view (say view 2) from another view (say view 1) with click of a button in a different browser, both the views are embedded into the same window, and also i have to pass some data from view1 to view2, based no the input data, i am displaying some information. Also both views belog to the same component.
    Some pointers on this would be of great help.
    Regards,
    Ashish.

    You would need to open another window.
    See if_wd_window and if_wd_window_manager.
    Call the GET_API to get a handle to window manager.
    The new window can show V2.
    The original Window with 2 views,
    must fire plug to navigate v2 to empty view to hide it from Window1.
    The to Views talk to one another via WDC Controller.
    View 2 calls WDC controller methods.  The WDC controller the fires Event.
    View 1 can listen to this event with a method of type event handler.
    View 1 can for example react to button on View 2 and close WINDOW 2.
    Good luck
    Phil.

  • Create stored procedure with table from another schema throws PLS-00201

    Oracle 10g. I'm new to procedures, so maybe I'm missing something obvious.
    Schema owner ABC has table T2001_WRITEOFF. The SYSDBAs granted SIUD to Some_Update_Role, and granted that role to developer user IJK. User IJK then created a private synonym T2001_WRITEOFF for ABC.T2001_WRITEOFF. This worked with normal SQL DML commands. 
    When I try to create a simple procedure as follows, it throws PLS-00201 identifier 'T2001_WRITEOFF' must be declared, and points to the 2nd line.
    create or replace procedure woof1(
      fooname in T2001_WRITEOFF.territory%TYPE,  <=== error points here
      bardesc IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
    BEGIN
       INSERT into T2001_WRITEOFF
       VALUES ( fooname, bardesc);
    END woof1;
    What am I doing wrong?
    Thanks
    JimR

    Hi,
    The reason I've heard has to do with knowing when a procedure becomes invalid due to privileges being revoked.  Any time a grant to a role is revoked, you would have to check all procedures that depended on that role to know if they were still valid.  Even worse, since roles can be granted to other roles, every time a role is revoked from another role, you would have to check all procedures that depended on anything to see if they were still valid.
    Oracle 11 behaves the same as earlier versions in this regard, and I don't expect this to change.
    This whole thread applies only to AUTHID DEFINER stored procedures (which is the default).  If you can make the procedure AUTHID CURRENT_USER, then you can run it with privileges granted through roles.  Usually, however, you really want AUTHID DEFINER, and granting the necessary privileges directly to the procedure owner (or to PUBLIC)  isn't too hard.

  • Exporting views from a schema

    Hi Gurus,
    We have a problem while creating a replica of a remote DB in local.
    We were able to export all DB objects except views.
    As they are critical for making the local DB 'complete', we are looking for a solution.
    We have tried the below query for getting the definition for a single view on a schema, but the query is taking too much time, even if run on the server.
    Select dbms_metadata.get_ddl('VIEW','<VIEW NAME>') from dual
    Please suggeest us a solution for the same.
    NOTE: Unfortunately we don't have any advanced tools and we are just relying on the Oracle SQL developer, even for developement.
    Thanks & Regards
    RK Veluvali

    What error are you getting when you run datapump expdp? If all you want it views you could run
    expdp user/password include=views schema=schema_list ...
    Please post the version you are using and the errors.
    Thanks
    Dean

Maybe you are looking for