Transform the schema name with APPLY_DML_HANDELER

Hello:
I have referred following notes, but I was trying to transform the schema name from schema_name_A to Schema_name_B in APPLY_DML_HANDELER, which does not seem like working.
264035.1 How To Transform Schema Name In Streams
309575.1 How To Transform A Schema Name In Streams for DML and Simple DDL Operations
313766.1 Streams Heterogeneous Apply To SQL*Server
Please confirm, if what I am trying to do it doable or not? Below is handler code.
CREATE OR REPLACE PROCEDURE APPLY_DML_HANDLER(in_any_data IN SYS.ANYDATA) IS
v_in_lcr SYS.lcr$_ROW_RECORD;
v_in_lcr_status PLS_INTEGER;
BEGIN
v_in_lcr_status := in_any_data.GETOBJECT(v_in_lcr);
v_in_lcr.set_object_owner('CSRREP');
v_in_lcr.EXECUTE(TRUE);
END;
All gets compiled good and runs, but dba_apply_errors shows Ora-23416.
Thanks,
Rohit

Hi Rohit,
ORA-23416: table "string"."string" does not contain a primary key constraint
Cause: The master table does not constaint a primary key constraint or the primary key constraint has been disabled.
Action: Create a primary key constraint on the master table or enable the existing constraint.
It is doable. I've done already done that in 9i. Be conscious that that kind of handler is executed for each LCR. So, that's highly paid.
I think there are new features to do it in a better way in 10g but I haven't tried it yet.
I had a bug somewhat similar that I fixed doing the following:
dbms_rule_adm.grant_object_privilege(
privilege => SYS.DBMS_RULE_ADM.EXECUTE_ON_RULE_SET,
object_name => v_ruleset_name,
grantee => v_new_owner
);

Similar Messages

  • Using dbms_datapump package to export the schema with the schema name as pa

    Hi,
    I am using the pl/sql block to export schema using dbms_datapump package,Now I want to pass the scheme name as the parameter to the procedure and get the .dmp and .log files with the schema name included.
    CREATE OR REPLACE PROCEDURE export
    IS
    h1 number;
    begin
    h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'export1', version => 'COMPATIBLE');
    dbms_datapump.set_parallel(handle => h1, degree => 1);
    dbms_datapump.add_file(handle => h1, filename => 'EXPDAT.LOG', directory => 'DATA_PUMP_DIR', filetype => 3);
    dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0);
    dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''CHECKOUT'')');
    dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS');
    dbms_datapump.add_file(handle => h1, filename => 'EXPDAT%U' || to_char(sysdate,'dd-mm-yyyy') || '.DMP', directory => 'DATA_PUMP_DIR', filetype => 1);
    dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
    dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
    dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
    dbms_datapump.detach (handle => h1);
    exception
    when others then
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    end;
    Thank you in advanced
    Sri

    user12062360 wrote:
    Hi,
    I am using the pl/sql block to export schema using dbms_datapump package,Now I want to pass the scheme name as the parameter to the procedure and get the .dmp and .log files with the schema name included.
    OK, please proceed to do so
    >
    CREATE OR REPLACE PROCEDURE export
    IS
    h1 number;
    begin
    h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'export1', version => 'COMPATIBLE');
    dbms_datapump.set_parallel(handle => h1, degree => 1);
    dbms_datapump.add_file(handle => h1, filename => 'EXPDAT.LOG', directory => 'DATA_PUMP_DIR', filetype => 3);
    dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0);
    dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''CHECKOUT'')');
    dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS');
    dbms_datapump.add_file(handle => h1, filename => 'EXPDAT%U' || to_char(sysdate,'dd-mm-yyyy') || '.DMP', directory => 'DATA_PUMP_DIR', filetype => 1);
    dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
    dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
    dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
    dbms_datapump.detach (handle => h1);
    exception
    when others then
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    end;
    EXCEPTION handler is a bug waiting to happen.
    eliminate it entirely

  • How can I map the composite_dn name with a composite in run time

    Hi All,
    I want to craete a report on number of total business and system faults with the help of Information Publisher in OEM 12c Cloud Control. I am fetching data from the table composite_instance_fault present in SOAINFRA schema. Below os my SQL statement:-
    select error_category,count(error_category) from prefix_SOAINFRA.composite_instance_fault where composite_dn=??EMIP_BIND_TARGET_GUID?? group by error_category
    Now I want to know that how can I map the composite_dn name with a composite in run time. When we fetch data from the repository we used to map target in rumtime by using ??EMIP_BIND_TARGET_GUID?? but here as I am not fetching data from repository, how can I map target in run time.
    On executing the above SQL statement its returing an empty table without any data.
    Please guide!!
    Thanks in Advance!!

    Hi,
    try something like this.
    Mike
    Attachments:
    Unbenannt 5_LV80.vi ‏12 KB

  • How to parameterize the schema name in APEX

    Hi,
    How to parameterize the schema name in APEX , in order to access different tables from the respective schema.
    For example:-
    select NAME display_value, CODE return_value
    from paramSchema.DESC_LIST WHERE SELECTION_FLG = 'Y'
    order by 1
    in the above code, paramSchema will be replaced with the actual schema name duing runtime. I tried doing so by some hidden fields on page, but it didn't worked out.
    I took the schema name from the respective server as per the IPof the server.
    stored in a hidden field named as schema.
    And replaced the same in place of schema name. But no luck.
    select NAME display_value, CODE return_value
    from :schema.DESC_LIST WHERE SELECTION_FLG = 'Y'
    order by 1
    Please help me in shorting it out.
    Thanks,
    Anuradha

    Hi
    In order to do that, you would need to use dynamic SQL by changing the report type to PL/SQL Function Body Returning SQL Query and have code along the lines of
    DECLARE
    l_sql VARCHAR2(32767);
    BEGIN
    l_sql := 'select NAME display_value, CODE return_value
    from '||:schema||'.DESC_LIST WHERE SELECTION_FLG = 'Y'
    order by 1';
    RETURN l_sql;
    END;However, by doing this, you lose alot of flexibility. The other options would be...
    To have seperate report regions that are conditional on the value of the variable.
    To use a WITH clause at the tope of the query like...
    WITH src_data AS
    (SELECT * FROM schema1.my_table
    WHERE :schema = 'schema1'
    UNION ALL
    SELECT * FROM schema2.my_table
    WHERE :schema = 'schema2')
    SELECT *
    FROM src_dataOther than that you could look at using synonyms and doing something similar.
    Hope this helps.
    Cheers
    Ben

  • What is the schema name for service part planning module

    Hi Experts,
    i need the following info
    1. what is the schema name for SPP module
    say for example we call ASCP as MSC, in similar passion what is the name given to SPP.
    2. I have searched for the table details in etrm site ( in R12.1.1 ) but it is not available, can anyone help me out to get the table details in SPP ?
    Thanks for your valuable time.
    Bye
    Babu

    Thanks Bob for your clarification.
    Do you have any idea, which are all the table that got linked with SPP in the MSC schema ?
    If we have any separate link in metalink, pls share that link.
    Thanks again for your valuable time.
    Babu Ji

  • Access other schema's table without specify the schema name

    Hi, need ur help again,
    I would like to access other schema's table without specify the schema name. for example,
    select * from hr.jobs;
    What priviledges i need if i want to select the data in this way:
    select * from jobs;
    Thanks!

    Public synonyms have their place, but are not generally a good idea as they will cause conflicts with other schemas and applications. Another think that you can do is issue the
    ALTER SESSION set CURRENT_SCHEMA = schema;
    The CURRENT_SCHEMA (8i and above) parameter changes the current schema of the session to the specified schema. Subsequent nqualified references to schema objects during the session will resolve to objects in the specified schema. The setting persists for the duration of the session or until you issue another ALTER SESSION SET CURRENT_SCHEMA statement. CURRENT_SCHEMA is a session parameter only, not an initialization parameter.
    This setting offers a convenient way to perform operations on objects in a schema other than that of the current user without having to qualify the objects with the schema name. This setting changes the current schema, but it does not change the session user or the current user, nor does it give you any additional system or object privileges for the session.

  • Printing the schema name at PROMPT

    DB Version: 10.2.0.4
    We run scripts like below on lots of schemas. To display the schema name , i can actually use
    SHOW USERin the script. But, i would like the schema name to printed at xxxx as shown below (in the CREATE message)
    set echo off
    set feedback on
    set define off
    Spool ModuleName-SCRid.log
    PROMPT Creating table emp in Schema xxxx -------- I need schema name to be printed here
    create table emp
    empid          varchar2(15 )           not null,
    emp_Code     varchar2(15 )           not null,
    updated_c     varchar2(1 )            not null
    alter table hrtb_emp add constraint pk_hrtb_emp primary key (empid, emp_Code);
    PROMPT Creating package spec lms in Schema xxxx -------- I need schema name to be printed here
    CREATE OR REPLACE PACKAGE lms
    AUTHID CURRENT_USER
    AS
    FUNCTION fetch_emp_x
       (in_code            NUMBER,
       iv_period            VARCHAR2,
       iv_emp_id            VARCHAR2,
       id_date            DATE
       RETURN VARCHAR2;
    end ;
    show errors
    spool off;Is there any way i could do this?

    Johan, Joel
    The issue with
    set sqlprompt "&&_USER@&&_CONNECT_IDENTIFIER SQL>"is ; once there is login issue with any of schemas like password mismatch or locked account..etc. From then onwards, you won't see the schema name.
    An example from a script after a failed login to one of the schemas.
    &_user:&_connect_identifier > CONNECT bn_205/hgh45ui@ws_test
    Connected.
    &_user:&_connect_identifier > @D:\DEPLOYMENTS\alter.sql
    &_user:&_connect_identifier > show user
    USER is "bn_205"
    &_user:&_connect_identifier >
    &_user:&_connect_identifier > alter table CNF_DATA_FIELD_BLK add MAPPING_VALUE_C VARCHAR2(50 BYTE);
    Table altered.
    &_user:&_connect_identifier > alter table CNF_DATA_FIELD_BLK add MAPPING_START_VAL_C VARCHAR2(15 BYTE);
    Table altered.
    &_user:&_connect_identifier > alter table CNF_DATA_FIELD_BLK add MAPPING_END_VAL_C VARCHAR2(15 BYTE);
    Table altered.
    &_user:&_connect_identifier >
    &_user:&_connect_identifier > alter table DOP_FIELD_VAL_DET add FIELD_BLK_CODE_C VARCHAR2(15 BYTE);Laurent,
    Your solution almost worked.
    Creating package spec lms in Schema MANU                                       
    1 row selected.I want to get rid of the row selected message. But i don't want to set the FEEDBACK OFF

  • HT2905 I have multiple album titles of the same name with different artists. How can I get them to go under one album title again?

    I have multiple album titles of the same name with different artists. How can I get them to go under one album title again?

    In iTunes(on a Mac or PC) just tap on 'Albums' rather than 'Artists' and you'll see them all together.
    You may find that there are songs mislabelled. In which case right tap on the Album or Artist and tap 'Get Info', then change to the correct name and the songs will join the rest of the songs for that Artist or Album.
    Then resync with your iPhone and all will be well.

  • How to configure the schema name dynamically based on user input.

    configure the schema name dynamically based on user input.
    For ex:
    We have two schemas:
    Schema1  - base schema having 15 tables.
    Schema2 -  tables which is specific to modules. Having only 10 tables which is also available in Schema1
    Login to application using Schema 1
    Access a particlular module and select the country. Here country selection is identified.
    Based on the country selection, we need to connect the schema respectively.
    If the user selects France --> It should connect Schema1
    If the user selects Germeny --> It should connect schema2.
    Used: Eclipselink

    You may want to have a different persistence unit for each country, then you just need to switch persistence units, and can put the schema in your orm.xml file.
    You may also want to investigate EclipseLink multi-tenant support,
    http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_multitenant.htm
    You can the schema in a persistence unit in code using a SessionCustomizer and the tableQualifier.

  • I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with   - how can I change this?

    I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with %20  - how can I change this?

    Click on the below link :
    https://get.adobe.com/flashplayer/otherversions/
    Step 1: select Mac OS  X 10.6-`0.`0
    Step 2 : Safari and FIrefox
    Then click on " Download Now"  button.

  • Get the pc name with domain name and add it to my properties file using commands

    i want to get the pc name with domain name and add it to my properties file using powershell  .
    sid

    function Get-Environment{
    [environment]|Get-Member -Static -MemberType Properties |
    ForEach-Object{
    if($_.Name -ne 'StackTrace'){
    $v=[scriptblock]::Create("[environment]::$($_.Name)").Invoke()
    New-Object PsCustomObject -Property ([ordered]@{Name=$_.Name;Value=$v[0]})
    Get-Environment
    Get-Environment | Out-String | Out-File environment.txt
    ¯\_(ツ)_/¯

  • Case of schema names with code insight

    I'm running SQL Developer 3.0.04. I want my SQL statements to be of the form "SELECT * FROM schema.table" but I can't seem to find the right code insight option to make this happen. There seems to be a way to make everything lowercase (including keywords) but the closest I can get to what I really want is "SELECT * FROM SCHEMA.table".
    How do I stop the schema name being upper-cased when using code insight without affecting the keywords?

    I don't think you're understanding the issue. This is about code insight, not about the tables being defined in lower case. Here's a step by step example:
    SELECT * FROM mys<ctrl+space> -> SELECT * FROM myschema
    SELECT * FROM myschema.f<ctrl+space> -> SELECT * FROM MYSCHEMA.fred
    when what I want is "SELECT * FROM *myschema*.fred"

  • How to Get the schema name that contains the current procedure?

    I have try select sys_context( 'userenv', 'current_schema' ) from dual; but it returns the schema name of the login user. How to return the schema name of the procedure instead? For example, procedure A is in ControlDB, and I login as sys, when query procedure A it should return ControlDB instead of sys.
    I have searched in Google but no luck to find the answer so far, please help. Thank you

    It works!
    I am quite confused now. I did try to use select username from user_users in GetSchemaName procedure, but it always return the login user instead of the owner of the procedure. Why it return the procedure owner if I put the query inside a function then call it from the procedure?
    Is it because when the login user call the procedure and the procedure call the function, it's the procedure owner is calling the function so the user_users return the user that is calling it which is the procedure owner. And if the query is directly put inside the procedure, when the login user call the procedure, user_users return the login user directly? Does it imply that if the procedure call any function or other procedures etc, it would be the procedure's owner calling them instead of the login user?
    (sys_context works as well if I move the query into the function then call the function from the procedure)
    Cheers
    Message was edited by:
    user500168

  • Creating a Mat View having the same name with that of the table name

    Hi everyone,
    After dropping the mat view name "QQ.TRDLN_DIM_MV", I'm trying to re-create it by having the same name as that of the table but I got an error stating that "name is already used by an existing object". How can create a mat view to look like the object owned by schema "GQ", having a name that is the same as that of the table name, without dropping the table?
    OWNER_O OBJECT_TYPE CREATED LAST_DDL_ TIMESTAMP STATUS OBJECT_NAME
    ===
    GQ MATERIALIZED VIEW 05-NOV-08 13-DEC-08 2008-11-05:06:31:46 VALID TRDLN_DIM_MV
    GQ TABLE 05-NOV-08 15-DEC-08 2008-11-05:06:31:00 VALID TRDLN_DIM_MV
    QQ TABLE 17-AUG-07 16-MAR-09 2007-08-17:17:05:21 VALID TRDLN_DIM_MV
    SQL&gt;CREATE MATERIALIZED VIEW QQ.TRDLN_DIM_MV
    2 TABLESPACE FPLC01S
    3 NOCACHE
    4 NOLOGGING
    5 COMPRESS
    6 PARALLEL ( DEGREE 2 INSTANCES 1 )
    7 BUILD IMMEDIATE
    8 REFRESH FORCE ON DEMAND
    9 WITH PRIMARY KEY
    10 AS
    11 select /*+ NO_REWRITE */ trdln_id,
    12 trdln_skid,
    13 trdln_end_date,
    14 first_value(trdln_end_date) over (partition by trdln_id order by trdln_end_date DESC) as MaxDate
    15 from QQ.trdln_dim;
    from QQ.trdln_dim
    ERROR at line 15:
    ORA-00955: name is already used by an existing object
    I appreciate your help. Many thanks in advance!
    Regards,
    Radic

    You'd have to rename the table (using ALTER TABLE tablename RENAME TO othername; ) before you create the MV.
    You can't have both existing with the same name in the same schema.
    What you see in the GQ schema is that the "table" is the underlying table for the Materialized View.
    When you do a CREATE MATERIALIZED VIEW MY_MV AS ...
    Oracle creates two objects with the same name, one being the Materialized View MY_MV and the other being the table MY_MV which is the physical storage. {Remember that a Materialized View is a means of getting a physical representation of a View}.
    In the QQ schema what you have is either
    a. a real Table
    or
    b. an improperly dropped MV, resulting in the underlying Table still present.

  • How to determine the schema name from stored function or procedure

    Hi all
    I need to find the way to determine the name of shema in which the given stored procedure residing. This SP is created with AUTHID CURRENT_USER what means that expression like SYS_CONTEXT('USERENV','CURRENT_USER') or SYS_CONTEXT('USERENV','CURRENT_SCHEMA') will be return the name of user or schema of user which calls given SP.
    can somebody help me?

    What is the problem you are trying to solve?
    Presumably, when you're creating a stored procedure, you know what schema owns it. So it's pretty trivial to simply create a local variable L_OWNER in your procedure, assign it the value of the schema owner, and then use that owner. Most people don't really need to figure out at runtime what they already knew at compile time.
    Barring that, you could inspect the data dictionary as user130038 suggested. That requires that you know the name of the procedure (which would likely also have to be a local variable that is initialized to a hard-coded value. And if there are multiple users that own procedures with the same name, it may not be reliable.
    Inspecting the call stack is the most reliable and dynamic approach. But it is also the most costly in terms or runtime performance and in terms of code complexity.
    Justin

Maybe you are looking for

  • Single Sign On - SAPSSOEXT - Can't find Dependant Libraries

    HI   I am trying to implrement SSO to another server running in IBM Websphere 5.1 In my java code System.LoadLibrary fails for SAPSSOEXT and error message is "Can't find Dependant Libraries" concerned java code is public static String SSO2TICKETLIBRA

  • How do I sync a Word document onto my iPad, using Adobe reader?

    My laptop can't connect to the Internet, so I'm trying to upload some critical documents to my iPad, using Adobe Reader. I've tried copying them via ITunes, and while the sync is supposedly successful, they don't show up in Reader on my inPad. Any su

  • Document Restriction Interactive Form

    Hey guys i have generate an Interactive Form like  the ABAP Program FP_TEST_IA_01. Now we try to "configure"  the PDF restrictions over the structure sfpoutputparams (parameter PDFCHANGESRESTRICTED). Our problem is, that the generated PDF doesn't all

  • Query acts strangely !

    Hello guys, I have some from used to insert data (including a Date) into some table, every thing is fine and I can query the data using that date from the form. Any way, if I performed a query at that table from SQL*Plus for example with this conditi

  • Will BO software support Microsoft SQL SERVER 2008 version in the future

    Hello, Currently, I do not see any support available for MS SQL Server 2008. Are there any plans for BO to support MS SQL SERVER 2008 in any roadmap documentation abhi