Altering index unuseable from a different schema.

I'm sure I'm overlooking something.
I was recently tasked with taking an existing ETL process that was in several different schemas and centralize it so the controlling procedures and functions are all in one schema, and the tables that are being loaded are in various schemas.
We're using a dirrect load, with insert (/* append*/) which is much fast than any other method we've found to load the tables. The trouble I'm having is in disabling the indexes. It's used to be that the procedure that altered the indexes was owned by the same schema that owned the indexes. That was working fine.
So,
Schema 'A' owns the table and indexes.
Schema 'B' owns the procedure that will alter the indexes to set them to unuseable.
Schema B has been granted GRANT ALTER, INSERT, SELECT, UPDATE, DELETE to all tables in Schema 'A'
I am logged in a Schema 'B' and I run the following command...
ALTER INDEX A.PROC_DETAILS_ENC_ID_IDX UNUSABLE
I get ....
Index altered.
However if I run the same thing in a function, I get ...
ORA-01418: specified index does not exist
That seems odd to me that I can run it from toad, but not in a function?

user12221955 wrote:
That seems odd to me that I can run it from toad, but not in a function?Check role-based vs direct grant privileges. PL/SQL does not like role-based privileges and tends to ignore them while running. Directly granted privileges are not so affected. Directly grant the privileges you want to the PL/SQL procedure owner.

Similar Messages

  • How can i import tables from a different schema into the existing relational model... to add these tables in the existing model? plss help

    how can i import tables from a different schema into the existing relational model... to add these tables in the existing relational/logical model? plss help
    note; I already have the relational/logical model ready from one schema... and I need to add few more tables to this relational/logical model
    can I import the same way as I did previously??
    but even if I do the same how can I add it in the model?? as the logical model has already been engineered..
    please help ...
    thanks

    Hi,
    Before you start, you should probably take a backup copy of your design (the .dmd file and associated folder), in case the update does not work out as you had hoped.
    You need to use Import > Data Dictionary again, to start the Data Dictionary Import Wizard.
    In step 1 use a suitable database connection that can access the relevant table definitions.
    In step 2 select the schema (or schemas) to import.  The "Import to" field in the lower left part of the main panel allows you to select which existing Relational Model to import into (or to specify that a new Relational Model is to be created).
    In step 3 select the tables to import.  (Note that if there are an Foreign Key constraints between the new tables and any tables you had previously imported, you should also include the previous tables, otherwise the Foreign Key constraints will not be imported.)
    After the import itself has completed, the "Compare Models" dialog is displayed.  This shows the differences between the model being imported and the previous state of the model, and allows you to select which changes are to be applied.
    Just selecting the Merge button should apply all the additions and changes in the new import.
    Having updated your Relational Model, you can then update your Logical Model.  To do this you repeat the "Engineer to Logical Model".  This displays the "Engineer to Logical Model" dialog, which shows the changes which will be applied to the Logical Model, and allows you to select which changes are to be applied.
    Just selecting the Engineer button should apply all the additions and changes.
    I hope this helps you achieve what you want.
    David

  • Problem while executing my package from a different schema

    Hi,
    I developed a package.
    Now when i try to execute my package( which is in Schema1) from a different schema(Sc2) in the same database(9.2.0.1)
    i.e. execute <Sc1>.<package_name.Package_main_proc>;
    I'm able to execute the package successfully.. but .. my package is deleting all records in all the tables used by the package !!
    If I run the same package from my schema(Sc1).. everything is working fine.
    i.e. its deleted only unwanted records after executing the whole package.
    Can anyone pls help me.
    Regards
    Jack

    Guido,
    I'm sorry for asking a really vague question.
    I included all the dbms_output.put_line() in my code. As i executed in my schema. I couldnt find any error.
    So now, instead of calling my package from Sc1.
    I compiled my package in Sc2( I dint get any errors) and then executed it.
    Even now data is deleted from the tables.
    So now i tried thru another schema(SC3)..
    again compiled it and executed it.. now everything is working fine.
    So to my understanding i just there is some dependency is Schema 2. But i'm not able to figure it out as i'm not getting any error.
    Am i going is right direction. If not please correct me .
    Thanks

  • JDBC Lookup - Import table data from a different schema in same DB

    Hi XI Experts,
    We are facing an issue while importing a Database table into the external definition in PI 7.1.
    The details are as below:
    I have configured user 'A' in PI communication channel to access the database. But the table that I want to access is present in schema "B". Due to this, I am unable to view the table that I have to import in the list available.
    In other words, I am trying to access a table present in a different schema in the same database. Please note that my user has been given all the required permissions to access different schema. Even then, I am unable to access the table in different schema.
    Kindly provide your valuable suggestions as to how I can import table which is present in another schema but in the same Database.
    Regards,
    Subbu

    If you are using PI 7.1, then you can do JDBC Lookup to import JDBC meta data (table structures from DB). Configure a jdbc receiver communication channel where you specify username and password which has permission to access schema A and Schema B of database. Specify database name in the connection string. Then you might have access to import both schema.
    Please refer these links
    SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups
    How to use JDBC Lookup in PI 7.1 ?

  • How to restore a single table from a DP Export from a different schema?

    Environment:
    Oracle 11.2.0.3 EE on Solaris
    I was looking at the documentation on DP Import trying to find the correct syntax to import a single table from a DP Export of a different schema.
    So, I want to load table USER1.TABLE1 into USER2.TABLE1 from a DP Export.
    Looking at the REMAP_TABLE options:
    REMAP_TABLE=[schema.]old_tablename[.partition]:new_tablename
    OR
    REMAP_TABLE=[schema.]old_tablename[:partition]:new_tablenameI can't see where to specify the target schema name. The examples had the new table name residing in the same schema with just a new name.
    I looked at the REMAP_SCHEMA but the docs say that will import the entire schema into the new schema and I only want one (1) table.
    Any suggestions are most welcome!
    -gary

    I thought I tried that combination and it seemed to me that the REMAP_SCHEMA somehow over-rode the TABLES= parameter >and started loading all the objects.If it does fail (and it should not) then please post the details here and I will try to see what is happening.
    Let me get back into the sandbox and try it again. I admit I was in a bit of a hurry when I did it the first time.We are all in a hurry, no worries. If it fails, please post the details and the log file.
    Does it make any sense that one parameter would override another?No, this should never happen. We have tons of checks to make sure the job can't have multiple meanings. For example, you can't say
    full=y schemas=foo --- Which do you want, a full export or a list of schema exports, etc.
    Your suggestion was the first thing I thought would work.This should work. If not, please post the log file with the command and the results.
    Dean
    Thanks again for the help and stay tuned for my new attempt.
    -gary

  • How to export and import dependent tables from 2 different schema

    I have a setup where schema1 has table 1 and schema 2 has table2. And table 1 from schema1 depends upon table 2 from schema 2.
    I would like to export and import these tables only and not any other tables from these 2 schemas with all information like grants,constraints.
    Also will there be same method for Oracle 10g R1,R2 and Oracle 11G.
    http://download.oracle.com/docs/cd/B12037_01/server.101/b10825/dp_export.htm#i1007514
    Looking at this For table mode it says
    Also, as in schema exports, cross-schema references are not exported
    Not sure what this means.
    As I am interested in only 2 tables I think I need to use table mode. But if I try to run export with both tables names, it says table mode support only one schema at a time. Not sure then How would the constraints would get exported in that case.
    -Rohit

    worked for my 1st time I tried
    exp file=table2.dmp tables="dbadmin.temp1,scott.emp"
    Export: Release 10.2.0.1.0 - Production on Mon Mar 1 16:32:07 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Username: / as sysdba
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P1 character set (possible charset conversion)
    About to export specified tables via Conventional Path ...
    Current user changed to DBADMIN
    . . exporting table                          TEMP1         10 rows exported
    EXP-00091: Exporting questionable statistics.
    Current user changed to SCOTT
    . . exporting table                            EMP         14 rows exported
    EXP-00091: Exporting questionable statistics.
    EXP-00091: Exporting questionable statistics.
    Export terminated successfully with warnings.

  • How to get a rowcount from two different schema in two different databases?

    Hello,
    I want to count of rows in each table in a schema say test, of DEV1 database to another schema say test of DEV2 database. both have same schema data in both the databases. my output should look something like this.
    Tablename
    database name DEV!, schema name test , tablename: count
    database name DEV2, schema name test , tablename: count
    can someone help me please.
    Thanks a lot

    Give this a try in dba1 - assuming there is a db link in dba1 to dba2:
    select 'DBA1', count(*) from table
    union all
    select 'DBA2', count(*) from table@dba2
    Note that if these are large tables, you may want to gather stats on the two tables (IMPORTANT) and then do
    select 'DBA1', num_rows from all_tables where table_name = 'TABLE'
    union all
    select 'DBA2', num_rows from all_tables@dba2 where table_name = 'TABLE'
    If you don't gather stats - the num_rows column in all_tables will reflect the number of rows that were present when stats were last gathered and will not reflect any inserts/deletes that have taken place since.
    The "union all" clause differs from "union" in that "union all" shows every matching result from both halves of the union - whereas union will only show each unique result once.
    Hope this helps!

  • Can we send a message to Websphere from two different schema?

    Hi,
    I have two schema in my test environment and i send a AQ message to WebSphere from one of them.
    Now i'm going to apply all the changes from this schema to the other one and then two messages will go to the same destination in IBM WebSphere!
    Do you think i might face a problem in this way or i should disable the previous one?
    Regards
    /Hesi

    Hello,
    it surely depends on your setup logic for the content of your target MQ messages. From the point of AQ there is no problem.
    Your two AQ queues don't know anything from each other. You have to check if the messages can be arrive twice at
    your destination MQ queue.
    Kind regards,
    WoG

  • 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

  • MapViewer metadata problem - accessing spatial data in a different schema.

    I have a MapViewer application that uses data from three different schemas.
    1. Dynamic Themes come from schema A.
    2. Static Themes come from schema B.
    3. A newly added static theme in B whose data comes from schema C.
    The mapviewer datasource points to schema B where the static themes, data and metadata are defined while the dynamic themes have their own datasource specified as part of addJDBCTheme(...).
    To get the newly added map to work I've had to add a view in schema B that points to C instead of referencing directly the table and I've had to add the metadata twice, once for schema B and once for schema C.
    If I put the metadata in just one of the two schemas I get the following errors.
    08/11/21 13:58:57 ERROR [oracle.sdovis.ThemeTable] cannot find entry in ALL_SDO_GEOM_METADATA table for theme: AMBITOS_REST
    08/11/21 13:58:57 ERROR [oracle.sdovis.ThemeTable] java.sql.SQLException: Invalid column index
    OR
    08/11/21 13:53:39 ERROR [oracle.sdovis.theme.pgtp] java.sql.SQLException: ORA-29902: error in executing ODCIIndexStart() routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    It's not a big deal but I'd like to know if anyone else has has similar problems.
    Saludos,
    Lew.
    Edited by: Lew2 on Nov 21, 2008 6:42 AM

    Hi Lew,
    if you are using a recent version (10.1.3.1 or later) there is no need to use a view and to create the metadata in both schemas.
    You need to grant selection on tables between the schemas.
    You can try the following. Assume you have the MVDEMO schema (from MapViewer kit) and SCOTT schema.
    1) grant select on MVDEMO Counties table to SCOTT
    SQL> grant select on counties to scott;
    2) Now you are ready to create a predefined theme in schema SCOTT using the MVDEMO Counties table.
    - Open MapBuilder and loads the SCOTT schema.
    - On the Data navigator (bottom left tree), go to Geometry tables and you should see the MVDEMO node and the COUNTIES node inside it.
    - Start a wizard to create a geometry theme based on this Counties table.
    - At the end you should see that the base table name is MVDEMO.COUNTIES. Therefore MapViewer will use the metadata in MVDEMO schema and there is no need to replicate it in SCOTT schema.
    Joao

  • 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

  • Stored Procedure executes on two different schemas in Oracle 8i

    Can I Create a Stored Procedure that access table from two different schemas?
    For Example I have created this Stored Procedure on SCHEMA_ONE
    CREATE OR REPLACE PROCEDURE SP_DEMO IS
    BEGIN
    INSERT INTO SCHEMA_ONE.COUNTRY_ONE(COUNTRY_NAME)
    SELECT COUNTRY_NAME
    FROM SCHEMA_TWO.COUNTRY_TWO
    END SP_DEMO;
    and when I execute it I am getting error message as :
    Error: PLS-00201: identifier 'SCHEMA_TWO.COUNTRY_TWO' must be declared
    is that possible? If yes then what I need to do for that?
    Please assist me.

    hi john
    How are you?
    please have a view there and correct me if m wrong.
    insufficient privileges
    Khurram Siddiqui
    [email protected]                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Using a schema from a different Logical Data Service

    Is it possible to use a schema from a different Logical Data Service in a new Logical Data Service? I want to maintain just one version of the schema.

    when I try and associate a schema type the 'Select Schema Type' dialog appears. On there the scope is set to project. Next to it is 'All projects', is there a way I can get that ungreyed?I don't think so. I assume that is a remnant from ALDSP 2.x when we had the notion of an ALDSP application that contained multiple ALDSP projects and there was visibility across projects (actually just folders) in the same application.
    can I use a schema associated with another dataspace projectNo. The contents of a dataspace are not accessible from outside the the dataspace other than what is provided by the APIs. And although the schemas could be accessed via catalogservices, this isn't a standard protocol (like http://) and therefore schema processors wont' be able to use them.
    You could host your schemas in a web-application and expose them via http. Create a Dynamic Web Project and put your schemas where the content gets served from (i.e. alongside index.html), and then they would be accessible via http://<yourserver>:<port>/yourWebApp/yourSchema.xsd. All the schemaLocation in the imports would need to be relative. It would probably be easier to create your schema-hosting application first, then build your dataservices.

  • I load a package into SYS schema but cant resolve references made from a different sc

    I loaded javamail-1.2 (and associated dependencies) into the SYS schema, just because it has classes under the same package root "javax".
    If I try to load a second class having an import like "javax.mail.*" into a schema other than SYS, I get a message "can't find xxx".
    How can I make the SYS new classes visible to a different schema?
    Thanks for any help.

    1) A WHEN OTHERS exception handler that does not re-raise an exception is almost certainly an error. In your case, you are writing the error message out via DBMS_OUTPUT, but unless your front end happens to try to read and display the DBMS_OUTPUT buffer, the error will be ignored. You realistically want to remove that exception handler.
    2) Creating an index will not raise a NO_DATA_FOUND if there is no data in the table, so that exception handler is superfluous.Thank you very much, now that I removed that Exception it is telling me insufficient rights.
    3) If you want User A to be able to create an index in User B's schema, User A would need to be granted the CREATE ANY INDEX privilege (directly, not via a role). If you are getting a permissions error creating the index after removing the incorrect exception handlers, that is likely the problem. If you are getting a permissions error dropping the index after removing the incorrect exception handlers, you would need to ensure that User A has been granted the DROP ANY INDEX privilege.I thought that since I had specifically granted the INDEX privledge to SchemaA on a specific table in SchemaB that Schema A would be able to drop and create indexes on that specific table. However.. having just looked again at the documentation it would seem that I would need to be able to do exactly as you say and have the ANY to be able to create it in another schema.
    4) Since the various ANY privileges (CREATE ANY INDEX, DROP ANY INDEX, etc) are rather powerful and not restricted to a particular schema, is there a logical reason not to put this code in Schema B to begin with?Nothing in particular other than attempting to keep it all with the "parent" schema so that the select into's are run from the parent and populate the child (schemab). I guess I can have Schema A call the package in schema B and execute it however will that execute as Schema A or B?
    Thanks for such a fast and detailed response

  • Can any body explain me this query?   select 'alter index '||index_name||' monitoring usage' as index_monitor from user_indexes where index_name='EMP';

    Initially i've a put an index of emp table in monitoring state..
    later i've got this query
    select 'alter index '||index_name||' monitoring usage' as index_monitor from user_indexes where index_name='EMP';
    can any body explain me what is the meaning of this query...
    and how do that query in the strings of projection area works....
    i'm totally confused
    thank you in advance.

    This is referred to as SQL generating SQL.  It is most useful when you  need to generate SQL statements for all indexes or indexes for one user.  After generating the text you then would execute it in SQLPlus or the tool of your choice.  If you combine this with a spool statement, SPOOL MyGeneratedScript.SQL you can run it with @MyGeneratedScript in SQLPlus.  I combine this into a script which generates the file, calls the editor so you can look it over and then executes it.  Here is an example of moving indexes to a different tablespace.
    -- UTL_Move_Indexs_To_New_TableSpace_Script.SQL
    /* This script will grab all the tables out of the specified source tablespace
    ** and move them into the specified target tablespace.  Ensure the the target
    ** exists and has sufficient room.  You must be logged in as the table owner.
    ACCEPT v_source_tablespace_name PROMPT 'Enter source tablespace name: '
    ACCEPT v_target_tablespace_name PROMPT 'Enter target tablespace name: '
    SET HEADING OFF
    SET FEEDBACK OFF
    SET TERMOUT OFF
    SET ECHO OFF
    SPOOL _move_index.SQL
    SELECT    'ALTER INDEX '
           || ndx.owner
           || '.'
           || ndx.index_name
           || CHR (10)
           || 'REBUILD '
           || CHR (10)
           || 'TABLESPACE '
           || UPPER ('&v_target_tablespace_name')
           || ';'
             sql_statement
    FROM   dba_indexes ndx
    WHERE      ndx.tablespace_name = UPPER ('&v_source_tablespace_name')
           AND ndx.index_type <> 'LOB'
    ORDER BY ndx.owner,
             ndx.index_name;
    SPOOL OFF
    --Edit the move script
    EDIT _move_index
    --Reset parameters.
    SET TERMOUT ON
    PAUSE Hit Ctrl+C to ABORT, any key to CONTINUE,
    -- Run the move script
    SPOOL  Move_Indexs_To_New_TableSpace.LOG
    @_move_index
    SPOOL OFF
    --Reset parameters.
    SET TERMOUT on
    SET FEEDBACK on
    SET HEADING on
    Marcus Baocn

Maybe you are looking for

  • Itunes could not connect to iphone timed out

    after connecting phone to iTunes  I get this itunes could not connect to iphone timed out

  • Bug when using applications when the screen is locked

    Hi i've got a problem when i updated iOS from 8.0. When i want to open camera and another applications in control centre my iphone with iOS 8.1.3 at first switch application on and than my screen become fully dark. I fix it by restarting, but then af

  • BW to XI Proxy

    Hi ,   I have completed the BW to XI Proxy scenario and executed the process chain in BW and it comes up with a successful message with the message GUID. But I do not see the message in XI. Any thoughts. Joe Vellaiparambil [email protected]

  • Post Workflow - Storage Calculation

    I'm producing a documentary set to start shooting in September. I'm currently working on picking a camera and considering the post workflow at the same time. I'm trying to calculate the amount of storage space needed. I'm either shooting HDV (from a

  • Help with backing up files, Toast, restoring comp to factory settings, etc.

    Hello! My computer (iBook G4, Panther, 10.3.9) has been acting a bit buggy lately, and I have way too much clutter and confusion (I have had this laptop for about three years now and when I first got it I wasn't really organized as far as computers g