Minimal host privilegues to execute sql job

Hi all,
I have installed OEM Grid Control 10.2.0.5 and I have one problem.
For example, I have created one Administrator TEST (Setup -> Administrators -> Create ... ) which primary role is to execute the jobs (SQL Scripts) on target database testdb.
I logged like new administrator TEST and set Preferred Credentials for my Database Instance (Preferences -> Prefered Credentials -> Database Instance / Set Credentials).
I have setup username/password for database testdb and username/password for specific node for example testnode. Try test and everything is OK.
Now I have created one simple SQL Script Job (select * from dual) on this target testdb database, and for first test I have used Use Preferred Credentials in Credentials tab and everything is passed OK.
In second test what I wish is to execute some other SQL Script Job, but with other dbuser (not like defined in the Preferred Credentials), but with the same OS username/password.
I have choose Override Preferred Credentials of Credentials tab, but here I must type again Database Host Credentials and new Database Credentials (for new database user).
My questions>
1) Is there any way I can use already typed OS username/password, I have earlier defined in Prefered Credentials of my Database Instance, and just change database credentials
2) Can I define some other user (not oracle) on OS (UNIX) with minimal privileges on OS and give his credentials to new OEM Administrators, which is able to execute SQL Script jobs (not to give/always type oracle username password)
Best regards,
Dragan

I am certain, not begin able to test this but you should be able to:
HOST ('sqlplus username/password @my_script', NO_SCREEN);
Hello all,
I am able to start sql/plus using the HOST command from a form, but would like to execute a sql/plus program I have saved on my c: drive as well. Anyone have any ideas or thoughts on how to pass the name of the program while starting (or after starting) SQL/Plus?
Thanks to all,
Jeff

Similar Messages

  • SSIS Package compiled successful, in SQL Server Integration Service package executed sucessful, But fail to run in MS SQL Job Scheduler

    Hi Everyone,
    I having a problem to transfer data from MS SQL 2005 to IBMAS400. Previously my SSIS was running perfectly but there is some changes I need to be done in order for the system to work well. Considers my changes are minimal & just for upgrades (but I did
    include DELETE statements to truncate AS400 table before I insert fresh data from MS SQL table to the same AS400 table), so I compile my SSIS package & it run successfully & I passed it into MS SQL Integrated Service as 1 of the packages & manually
    executed the package & the result is the same, that mean it was successful again but when I try to run it in a MS SQL Job Scheduler, the job failed with these message shown below as extracted from the job View history. 
    Date today
    Log Job History (MSSQLToAS400)
    Step ID 1
    Server MSSQLServer
    Job Name MSSQLToAS400
    Step Name pumptoAS400
    Duration 00:00:36
    Sql Severity 0
    Sql Message ID 0
    Operator Emailed
    Operator Net sent
    Operator Paged
    Retries Attempted 0
    Message
    Executed as user: MSSQLServer\SYSTEM. ... 9.00.4035.00 for 32-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    
    Started:  today time  
    Error: on today time     
    Code: 0xC0202009     Source: SSISMSSQLToAS400 Connection manager "SourceToDestinationOLEDB"     
    Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. 
    Error code: 0x80004005.  An OLE DB record is available.  
    Source: "IBMDA400 Session"  
    Hresult: 0x80004005  
    Description: "CWBSY0002 - Password for user AS400ADMIN on system AS400SYSTEM is not correct ".  End Error  
    Error: today     
    Code: 0xC020801C     
    Source: Data Flow Task OLE DB Destination [5160]     
    Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "DestinationClearData" failed with error code 0xC0202009.  There may be error messages posted before
    this with more information on why the AcquireConnection method ca...  The package execution fa...  The step failed.
    So I hope somebody can shed some hints or tips for me to overcome time problem of mine. Thanks for your help in advance. As I had scoured thoroughout MSDN forums & found none solution for my problem yet. 
    PS: In the SQL Integrated Services when I deployed the package I set the security of the packages to Rely on server... 
    Hope this will help.

    Hi Ironmaidenroxz,
    From the message “Executed as user: MSSQLServer\SYSTEM”, we can see that the SQL Server Agent job ran under the Local System account. However, a Local System account doesn’t have the network rights natively, therefore, the job failed to communicate with
    the remote IBMAS400 server.
    To address this issue, you need to create a proxy account for SQL Server Agent to run the job. When creating the credentials for the proxy account, you can use the Windows domain account under which you executed the package manually.
    References:
    How to: Create a Credential
    How to: Create a Proxy
    Regards,
    Mike Yin
    TechNet Community Support

  • Error while executing the Job:Cannot assign NULL to host variable 1

    Hello!
    I have the following issue:
    Error while executing the Job:Cannot assign NULL to host variable 1. setNull() can only be used if the corresponding column is nullable. The statement is "INSERT INTO "VIRSA_... (see log for details)
    Note 1362138 - Rule generation - null pointer exception virsa_cc_rtmap  doesn't me. After uploading files of ZCC_DOWNLOAD_SAPOBJ and ZCC_DOWNLOAD_DESC I got the same problem during job running...
    How can I find out where is the problem?

    Hi
    That looks like your fields are disabled but they could still be causing the problem edited ( nah - talking rubbish as you've put dummy " " in there) edited - the 'null' error caused many background jobs to fail but, once we had the evidence to show the space (somebody had pressed enter instead of delete/backspace to clear the entry) it stopped the problem - just a bit of learning on the job which we all go through for the GRC chaps in KL.
    A " " would be valid but a    (I know you can't see it but it's there wouldn't be      )
    edited.When you did an edit/replace did it say it had replaced anything please?edited
    The word doc option does sound good!
    Cheers
    David
    Edited by: David Berry on Nov 4, 2010 7:33 PM

  • Execute Process Task showing all the SSIS Config variables in SQL Job History

    Hi,
    Am using an Execute Process task to execute my child package. And executing the Parent package from a SQL JOB.
    I am using the same config file for both Parent and Child packages.
    After the Job execution was Successful / Failure, in Job history it is showing all the variables from Config file which are not using in Child package. With the below message.
    "The package path referenced an object that cannot be found"
    I don't want to catch all the Variables information in Job History. Instead I need only the Success / Failure message.
    PFA Screen.
    Thanks,
    Sailaja

    see
    http://www.mssqltips.com/sqlservertip/1417/custom-logging-in-sql-server-integration-services-ssis/
    https://www.simple-talk.com/sql/ssis/ssis-event-handlers-basics/
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • EXECUTE permission denied on sp_sqlagent_log_jobhistory when running a maintenance task or sql job

    Hi folks,
    I have a scheduled maintenance plan and associated jobs in SQL Server 2008 SP2 that have been working but stopped about two months ago. When I run a maintenance task or sql job using any account (sa, sysadmin-priveleged domain account, etc) I get the following
    entries in the SQL Server Agent log (see below). I've tried changing the SQL Server Agent account, applied the latest hotfixes (CU2 for 2008 SP2) and set permissions manually so that the service accounts have dbo access to the msdb database. Anyone got other
    ideas? I've avoided recreating the msdb database, but that may be my only option.
    Date  4/02/2011 3:42:40 PM
    Log  SQL Server Agent (Current - 4/02/2011 3:23:00 PM)
    Message
    [298] SQLServer Error: 229, The EXECUTE permission was denied on the object 'sp_sqlagent_log_jobhistory', database 'msdb', schema 'dbo'. [SQLSTATE 42000] (ConnExecuteCachableOp)
    Date  4/02/2011 3:42:40 PM
    Log  SQL Server Agent (Current - 4/02/2011 3:23:00 PM)
    Message
    [298] SQLServer Error: 229, The EXECUTE permission was denied on the object 'agent_datetime', database 'msdb', schema 'dbo'. [SQLSTATE 42000] (ConnExecuteCachableOp)
    Date  4/02/2011 3:42:40 PM
    Log  SQL Server Agent (Current - 4/02/2011 3:23:00 PM)
    Message
    [298] SQLServer Error: 229, The EXECUTE permission was denied on the object 'sp_sqlagent_log_jobhistory', database 'msdb', schema 'dbo'. [SQLSTATE 42000] (ConnExecuteCachableOp)

    And just to add to the confusion - I created a SQL login called sql-maintjobs and have it sysadmin priveleges. I then logged in to SQL using this account on the instance that is failing and ran the following:
    declare
    @backupjobid uniqueidentifier
    select
    @backupjobid=CONVERT(uniqueidentifier,
    '2C4974D4-53BE-4E38-8EC0-8F5398CADE88')
    exec
    sp_sqlagent_log_jobhistory
    @job_id = @backupjobid,
    @step_id
    =1,
    @sql_message_id
    = 0,
    @sql_severity
    = 0,
    @message
    =
    NULL,
    @run_status
    =1,
    -- SQLAGENT_EXEC_X code
    @run_date
    =19900101,
    @run_time
    =1,
    @run_duration
    =1,
    @operator_id_emailed
    = 0,
    @operator_id_netsent
    = 0,
    @operator_id_paged
    = 0,
    @retries_attempted
    =0,
    @server
    =
    NULL,
    @session_id
    = 0
    This sql worked fine - no permission errors at all. That would suggest the account does have permission to EXECUTE that stored procedure... very confusing!

  • Execute the SSIS packages (2008 version) using SQL job 2008

    We need to execute the SSIS packages (2008 version) using SQL job Please help with details information how to execute it.
    1.Protection level of the SSIS packages.
    2.Configuration File (Curently using XML file)
    3.Please provide details how to create Credential (Windows User etc)  Do we need to create windows cred explicitly to run the Job etc..
    4.Please provide details for creating Proxy.
    5.How can we configure the xml file since the xml is reading from local box but when the package is moved from developement box to production box
    then the local drive might not be mapped with Production box .
    6.Roles that need to be tagged for the Proxy/Credential.
    7.Which is the best and safest way to execute ssis packages either msdb deployment or filesystem deployment and other necessary details.

    Hi,
    If you want to Execute your SSIS package using SQL job then best solution is to first deploy your Package
    either using msdb deployment or filesystem deployment.The simplest approach to deployment is probably to deploy to the file system.
    So, here is the deployment steps;
    There are four steps in the package deployment process:
        The first optional step is optional and involves creating package
    configurations that update properties of package elements at run time. The configurations are automatically included when you deploy the packages.
        The second step is to build the Integration Services project to create a package deployment utility. The deployment utility for the project contains the packages that you want to deploy
        The third step is to copy the deployment folder that was created when you built the Integration Services project to the target computer.
        The fourth step is to run, on the target computer, the Package Installation Wizard to install the packages to the file system or to an instance of SQL Server.
    you can use below link also;
    http://bharath-msbi.blogspot.in/2012/04/step-by-step-ssis-package-deployment.html
    After that you need to Schedule package using SQL Agent then  Have a look at the following link. It explains how to create an SQL job that can execute an SSIS package on a scheduled basis.
    http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
    Deployment in msdb deployment or filesystem deployment has there own merits and demerits.
    For security point of view msdb deployment is good.
     it provides Benefits from database security, roles and Agent interaction
    Protection Level;
    In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package.
    Open the package in the SSIS designer.
    If the Properties window does not show the properties of the package, click the design surface.
    In the Properties window, in the Security group, select the appropriate value for the
    ProtectionLevel property.
    If you select a protection level that requires a password, enter the password as the value of the
    PackagePassword property.
    On the File menu, select Save Selected Items to save the modified package.
    SSIS Provide different Protection levels;
        DontSaveSensitive
        EncryptSensitiveWithUserKey
        EncryptSensitiveWithPassword
        EncryptAllWithPassword
        EncryptAllWithUserKey
        ServerStorage
    For better undertsnading you can use below link;
    http://www.mssqltips.com/sqlservertip/2091/securing-your-ssis-packages-using-package-protection-level/
    Thanks

  • Export scheduler job but chain step and chain rule failed with ORA-24150 ORA-06512 during executed sql script.

    Hi Folks,
    I used expdp utility to export all Oracle scheduler jobs and chains with below method, after that generate sql script by impdp, later on executing sql script encountered some errors.
    Only chain step and chain rule for executing script. Does anyone bright me some light? Thanks!
    My env: Oracle 11g + Oracle Linux 5.5
    My steps as below:
    1. export(expdp) oracle scheduler job(chain)
    2. generate sql script by impdp.
    3. remove orginal scheduler job(chain)
    4. execute sql script
    5. job with no chain well but job with chain failed
    [oracle@linux1 ~]$ expdp scott/tiger directory=db_dump_dir dumpfile=scott_job.dmp include=procobj:\" in \(select \
    > name from sys.obj$ where type\# in \(46,59,66,67,68,69,72,74,79\)\)\"  schemas=scott
    Export: Release 11.2.0.1.0 - Production on Tue Dec 3 17:42:31 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/******** directory=db_dump_dir dumpfile=scott_job.dmp include=procobj:" in (select name from sys.obj$ where type# in (46,59,66,67,68,69,72,74,79))" schemas=scott
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 0 KB
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCOBJ
    Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
      /u03/database/usbo/BNR/dump/scott_job.dmp
    Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 17:42:54
    [oracle@linux1 ~]$ impdp scott/tiger sqlfile=scott_job.sql directory=db_dump_dir dumpfile=scott_job.dmp logfile=imp_scott_job.log
    Import: Release 11.2.0.1.0 - Production on Tue Dec 3 17:43:04 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    Master table "SCOTT"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
    Starting "SCOTT"."SYS_SQL_FILE_FULL_01":  scott/******** sqlfile=scott_job.sql directory=db_dump_dir dumpfile=scott_job.dmp logfile=imp_scott_job.log
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCOBJ
    Job "SCOTT"."SYS_SQL_FILE_FULL_01" successfully completed at 17:43:07
    [oracle@linux1 ~]$ more /u03/database/usbo/BNR/dump/scott_job.
    scott_job.dmp  scott_job.sql 
    [oracle@linux1 ~]$ more /u03/database/usbo/BNR/dump/scott_job.sql
    -- CONNECT SCOTT
    ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
    -- new object type path: SCHEMA_EXPORT/POST_SCHEMA/PROCOBJ
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_1"','1=1',NULL, 'First link in the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_2"',':"CHAIN_STEP_1".COMPLETED = ''TRUE''',NULL, 'Second link in the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_3"',':"CHAIN_STEP_2".COMPLETED = ''TRUE''',NULL, 'Third link in the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_4"',':"CHAIN_STEP_3".COMPLETED = ''TRUE''',NULL, 'End of the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule_set('"SCHED_RULESET$1"','"SCHED_EV_CTX$1"',NULL, 0);
    END;
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_program('"TEST_PROC_1"','PLSQL_BLOCK',
    'BEGIN
                             INSERT INTO tb_schduler (id, descr, cr_date)
                             VALUES (tb_schduler_seq.NEXTVAL, ''test_proc_1'', SYSDATE);
                             COMMIT;
                           END;'
    ,0, TRUE,
    'Program for first link in the chain.'
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_program('"TEST_PROC_3"','PLSQL_BLOCK',
    'BEGIN
                             INSERT INTO tb_schduler (id, descr, cr_date)
                             VALUES (tb_schduler_seq.NEXTVAL, ''test_proc_3'', SYSDATE);
                             COMMIT;
                           END;'
    ,0, TRUE,
    'Program for last link in the chain.'
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_program('"TEST_PROC_2"','PLSQL_BLOCK',
    'BEGIN
                             INSERT INTO tb_schduler (id, descr, cr_date)
                             VALUES (tb_schduler_seq.NEXTVAL, ''test_proc_2'', SYSDATE);
                             COMMIT;
                           END;'
    ,0, TRUE,
    'Program for second link in the chain.'
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
    , rule_set_name=>'"SCHED_RULESET$1"   '
    dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
    dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
    dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_job('"TEST_CHAIN_1_JOB"',
    job_type=>'CHAIN', job_action=>
    'test_chain_1'
    , number_of_arguments=>0,
    start_date=>TO_TIMESTAMP_TZ('03-DEC-2013 05.38.56.718161000 PM +08:00','DD-MON-RRRR HH.MI.SSXFF AM TZR','NLS_DATE_LANGUAGE=english'), repeat_interval=>
    'freq=minutely; interval=2'
    , end_date=>TO_TIMESTAMP_TZ('03-DEC-2013 06.08.56.000000000 PM +08:00','DD-MON-RRRR HH.MI.SSXFF AM TZR','NLS_DATE_LANGUAGE=english'),
    job_class=>'"DEFAULT_JOB_CLASS"', enabled=>FALSE, auto_drop=>TRUE,comments=>
    NULL
    COMMIT;
    END;
    [oracle@linux1 ~]$ export ORACLE_SID=usbo
    [oracle@linux1 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 3 17:44:43 2013
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    sys@USBO> show parameter db_name
    NAME                                 TYPE                              VALUE
    db_name                              string                            usbo
    sys@USBO> conn scott/tiger;
    Connected.
    --remove job and chain.
    scott@USBO> EXEC DBMS_SCHEDULER.drop_job(job_name => 'test_chain_1_job');
    EXEC DBMS_SCHEDULER.drop_chain (chain_name  => 'test_chain_1');
    EXEC DBMS_SCHEDULER.drop_program (program_name  => 'test_proc_1');
    EXEC DBMS_SCHEDULER.drop_program (program_name  => 'test_proc_2');
    EXEC DBMS_SCHEDULER.drop_program (program_name  => 'test_proc_3');
    PL/SQL procedure successfully completed.
    scott@USBO> @/u03/database/usbo/BNR/dump/scott_job.sql
    Session altered.
    Session altered.
    Session altered.
    Session altered.
    Session altered.
    Session altered.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    BEGIN
    ERROR at line 1:
    ORA-24150: evaluation context SCOTT.SCHED_EV_CTX$1 does not exist
    ORA-06512: at "SYS.DBMS_RULEADM_INTERNAL", line 28
    ORA-06512: at "SYS.DBMS_RULE_IMP_OBJ", line 40
    ORA-06512: at line 3
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    BEGIN
    ERROR at line 1:
    ORA-24141: rule set SCOTT.SCHED_RULESET$1 does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_ISCHED", line 1694
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1638
    ORA-06512: at line 5
    PL/SQL procedure successfully completed.

    Thanks all of you!
    Hi DK2010,
    I took some test that the data dict(dba_rule_sets/dba_evaluation_contexts) no any data returned after I had removed the job.
    So I tried to create evaluation context and re-executed script(only exception setion.) the first error has gone. For the second still have some issue.
    ---->no any returned
    scott@USBO> select * from dba_rule_sets where rule_set_owner='SCOTT';       
    no rows selected
    scott@USBO> select * from dba_evaluation_contexts WHERE evaluation_context_owner='SCOTT';
    no rows selected
    -->add new EVALUATION CONTEXT
    scott@USBO> exec DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT('SCOTT.SCHED_EV_CTX$1');
    PL/SQL procedure successfully completed.
    --->now it looks fine
    scott@USBO> BEGIN
      2  BEGIN
      3  dbms_rule_imp_obj.import_rule_set('"SCHED_RULESET$1"','"SCHED_EV_CTX$1"',NULL, 0);
      4  END;
      5 
      6  COMMIT;
      7  END;
      8  /
    PL/SQL procedure successfully completed.
    --->add new rule set, it prompt aleady exists
    scott@USBO> exec DBMS_RULE_ADM.CREATE_RULE_SET('SCOTT.SCHED_RULESET$1') 
    BEGIN DBMS_RULE_ADM.CREATE_RULE_SET('SCOTT.SCHED_RULESET$1'); END;
    ERROR at line 1:
    ORA-24153: rule set SCOTT.SCHED_RULESET$1 already exists
    ORA-06512: at "SYS.DBMS_RULEADM_INTERNAL", line 28
    ORA-06512: at "SYS.DBMS_RULE_ADM", line 138
    ORA-06512: at line 1
    -->chain rule still could not find.
    scott@USBO> @job_chain_rules.sql
    no rows selected
    -->rerun
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-27477: "SCOTT.TEST_CHAIN_1" already exists 
    ORA-06512: at "SYS.DBMS_ISCHED", line 1148
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1598
    ORA-06512: at line 2
    -->drop chain
    scott@USBO> exec dbms_scheduler.drop_chain('TEST_CHAIN_1');
    BEGIN dbms_scheduler.drop_chain('TEST_CHAIN_1'); END;
    ERROR at line 1:
    ORA-27479: Cannot drop "SCOTT.TEST_CHAIN_1" because other objects depend on it
    ORA-06512: at "SYS.DBMS_ISCHED", line 1319
    ORA-06512: at "SYS.DBMS_ISCHED", line 1222
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1854
    ORA-06512: at line 1
    scott@USBO> exec dbms_scheduler.drop_chain('TEST_CHAIN_1',force=>TRUE);
    PL/SQL procedure successfully completed.
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-24141: rule set SCOTT.SCHED_RULESET$1 does not exist   --->still returned no rule set
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_ISCHED", line 1694
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1638
    ORA-06512: at line 5
    scott@USBO> exec DBMS_RULE_ADM.CREATE_RULE_SET('SCOTT.SCHED_RULESET$1')
    PL/SQL procedure successfully completed.
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-27477: "SCOTT.TEST_CHAIN_1" already exists
    ORA-06512: at "SYS.DBMS_ISCHED", line 1148
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1598
    ORA-06512: at line 2
    scott@USBO> exec dbms_scheduler.drop_chain('TEST_CHAIN_1',force=>TRUE);
    PL/SQL procedure successfully completed.
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-24141: rule set SCOTT.SCHED_RULESET$1 does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_ISCHED", line 1694
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1638
    ORA-06512: at line 5
    Would you like to give me more clue?
    Thanks again.

  • Error while executing a JOB

    Post Author: rkolturu
    CA Forum: Data Integration
    I tried to execute a job which is compiled and error free but get the error below has any one of you any workaround for this problem
    5308 4880 PAR-010102 12.12.2007 08:44:52 |SessionJOB_XYZ
    5308 4880 PAR-010102 12.12.2007 08:44:52 Syntax error at line : 00297-182
    5308 4880 PAR-010102 12.12.2007 08:44:52 0-189393172: near found expecting .
    5308 4880 PAR-010102 12.12.2007 08:44:52 Syntax error at line : <>: near found .
    5308 4880 PAR-010102 12.12.2007 08:44:52 2 error(s), 0 warning(s).
    5308 4880 PAR-010102 12.12.2007 08:44:52 . Please check and fix the syntax and retry the operation.

    Hi,
    If  CI & DB are on different host this error normally occures.SAP return codes 236 means no connection to gateway, can you check it?
    Also check whether TCP/IP RFC connection SAPXPG_DBDEST_*  is working fine or not.If it is not working fine then please check whether you have mentioned below details
    Program              sapxpg
    Target Host          DB Host name
    Gateway Host    DB host/gateway host
    Gateway service sapgw##
    Also refer SAP Note  108777 - CCMS: Message 'SAPXPG failed for BRTOOLS' & Note 446172 - SXPG_COMMAND_EXECUTE (program_start_error) in DB13
    Hope this helps.
    Thanks,
    Sushil

  • Error on auto execute of job 1032656.. Where i can get the details?

    ORA-12012: error on auto execute of job 1032656
    ORA-04063: ORA-04063: package body "ORACLE_OCM.MGMT_DB_LL_METRICS" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "ORACLE_OCM.MGMT_DB_LL_METRICS"
    ORA-06512: at line 1
    ORA-1580 signalled during: alter database backup controlfile to 'backup_control_file.ctl'..
    Hi All,
    I am getting the above error in my alert log.
    When i check in my dba_jobs there were only two jobs having job column 1 & 21.
    Where i can see the job 1032656 and its details ?
    Regards
    Arun

    Hi Arun,
    This is due to invalid objects in ORACLE_OCM schema.
    Please read metalink note id:
    Invalid Objects After Revoking EXECUTE Privilege From PUBLIC [ID 797706.1]
    Symptoms
    OEM recommends that EXECUTE privilege being revoked from PUBLIC. After revoking the privilege, the following errors appeared in alert log:
    ORA-12012: error on auto execute of job 66171
    ORA-04063: package body "ORACLE_OCM.MGMT_DB_LL_METRICS" has errors
    ORA-06508: PL/SQL: could not find program unit being called: ORACLE_OCM.MGMT_DB_LL_METRICS"
    ORA-06512: at line 1 has errors .
    Also, the below query returns invalid rows count (approximately 46 rows)
    SQL> select object_name, owner, object_type, status from dba_objects where status = 'INVALID';
    Owners of invalid objects are ORACLE_OCM and WMSYS
    *Cause*
    At the time of installation of the database, Oracle execute scripts that test to see if PUBLIC access is granted to all of the routines that ORACLE_OCM and WMSYS need access to. If PUBLIC access is NOT available, Oracle scripts grant specific access rights. However, If EXECUTE privilege is revoked from PUBLIC after installation, then those specific access rights needs to be granted manually.
    *Solution*
    You will need to grant execute on UTL_FILE and DBMS_SCHEDULER to ORACLE_OCM and WMSYS. The below action plan should solve the issue:
    SQL> grant execute on UTL_FILE to oracle_ocm;
    SQL> grant execute on DBMS_SCHEDULER to oracle_ocm;
    SQL> grant execute on UTL_FILE to wmsys;
    SQL> grant execute on DBMS_SCHEDULER to wmsys;
    SQL> shutdown immediate;
    SQL> startup restrict;
    SQL> @utlrp.sql /* $ORACLE_HOME/rdbms/admin/@utlrp.sql */
    SQL> shutdown immediate;
    SQL> startup;
    Regards
    Rajesh

  • From Time to Time error while executing RMAN Job

    Hi everybody,
    i have a strange problem. From time to time i recieve following error when executing a Job from Grid Control (Enterprise Manager).
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-04004: Fehler aus Recovery-Katalog-Datenbank: ORA-12170: TNS: Connect Timeout aufgetreten
    After that error the Job uses the Control File of the Database so the job runs. The strange thing for me is, that sometimes the jobs runs without problems and sometimes it gaves the error shown above.
    For clarifying. Grid Control runs on a Unix (Sun Solaris) Machine and the target Database runs on a Windows Server in a DMZ. I tried to find out what the problem is but neither on the windows server nor on the firewall side there are any problems.
    So can anybody help me finding out what the problem is?
    Any help would be appreciated.
    Greetings

    Hi sunny,
    i have tried the tnsping several times. There is no problem with this. The tnsping works without problems and in an appropriate time.
    When i issue the command on our unix machine it shows the following:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = srvxyz)(PORT = 1521))) (CONNECT_DATA = (SID = db1) (SERVICE_NAME = db1)))
    OK (10 msec)
    And when issue it on the Windows Server the follwoing output is shown:
    TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 - Production on 26-APR-2011 10:35:45
    Copyright (c) 1997, 2007, Oracle. All rights reserved.
    Parameterdateien benutzt:
    O:\ORACLE\product\10.2.0\network\admin\sqlnet.ora
    Adapter TNSNAMES zur Auflösung des Alias benutzt
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world)(PROTOCOL = TCP)(Host = SRVXYZ)(Port = 1521))) (CONNECT_DATA = (SID = db1)))
    OK (0 ms)
    So any other ideas??

  • Error on auto execute of job

    Hii,
    I am using Oracle 11g version 11.2.0.2.0
    From last few days i am getting the error
    ORA-12012: error on auto execute of job 179297
    ORA-01403: no data found
    ORA-06512: at line 1
    in my alert log.
    The trace file details are :
    Trace file C:\APP\MANAGER\diag\rdbms\c2kprod\c2kprod\trace\c2kprod_j002_5552.trc
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Windows NT Version V5.2 Service Pack 2
    CPU : 24 - type 8664, 2 Physical Cores
    Process Affinity : 0x0x0000000000000000
    Memory (Avail/Total): Ph:13735M/32756M, Ph+PgF:77877M/95801M
    Instance name: c2kprod
    Redo thread mounted by this instance: 1
    Oracle process number: 30
    Windows thread id: 5552, image: ORACLE.EXE (J002)
    *** 2012-10-27 00:10:17.259
    *** SESSION ID:(394.10451) 2012-10-27 00:10:17.259
    *** CLIENT ID:() 2012-10-27 00:10:17.259
    *** SERVICE NAME:(SYS$USERS) 2012-10-27 00:10:17.259
    *** MODULE NAME:() 2012-10-27 00:10:17.259
    *** ACTION NAME:() 2012-10-27 00:10:17.259
    ORA-12012: error on auto execute of job 19030
    ORA-01403: no data found
    ORA-06512: at line 1
    Trace file C:\APP\MANAGER\diag\rdbms\c2kprod\c2kprod\trace\c2kprod_j002_5552.trc
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Windows NT Version V5.2 Service Pack 2
    CPU : 24 - type 8664, 2 Physical Cores
    Process Affinity : 0x0x0000000000000000
    Memory (Avail/Total): Ph:7765M/32756M, Ph+PgF:70412M/95801M
    Instance name: c2kprod
    Redo thread mounted by this instance: 1
    Oracle process number: 260
    Windows thread id: 5552, image: ORACLE.EXE (J002)
    *** 2012-11-06 13:50:27.895
    *** SESSION ID:(1282.5387) 2012-11-06 13:50:27.895
    *** CLIENT ID:() 2012-11-06 13:50:27.895
    *** SERVICE NAME:(SYS$USERS) 2012-11-06 13:50:27.895
    *** MODULE NAME:() 2012-11-06 13:50:27.895
    *** ACTION NAME:() 2012-11-06 13:50:27.895
    ORA-12012: error on auto execute of job 68977
    ORA-01403: no data found
    ORA-06512: at line 1
    Trace file C:\APP\MANAGER\diag\rdbms\c2kprod\c2kprod\trace\c2kprod_j002_5552.trc
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Windows NT Version V5.2 Service Pack 2
    CPU : 24 - type 8664, 2 Physical Cores
    Process Affinity : 0x0x0000000000000000
    Memory (Avail/Total): Ph:13738M/32756M, Ph+PgF:77307M/95801M
    Instance name: c2kprod
    Redo thread mounted by this instance: 1
    Oracle process number: 165
    Windows thread id: 5552, image: ORACLE.EXE (J002)
    *** 2012-12-03 11:23:33.693
    *** SESSION ID:(1350.229) 2012-12-03 11:23:33.693
    *** CLIENT ID:() 2012-12-03 11:23:33.693
    *** SERVICE NAME:(SYS$USERS) 2012-12-03 11:23:33.693
    *** MODULE NAME:() 2012-12-03 11:23:33.693
    *** ACTION NAME:() 2012-12-03 11:23:33.693
    ORA-12012: error on auto execute of job 179297
    ORA-01403: no data found
    ORA-06512: at line 1
    Can anybody please tell what happened and what is solution for this.
    Thanks

    I cann't help you. It is your DB you have to know what's your environment. What application/users are connected to DB.
    You may find some glue in column log_user,priv_user, schema_user. From those column you could find DB schema under whitch job is created. then investigave if there is any PL/SQL code. If yes go to the code and look for dbms_job.submit procedure.
    If no PL/SQL then you must found who is connecting under DB schema and ask then.
    Or at last: may be you could audit access to sys.job$ table to find who is manipulating with data - but I don't recomend it before testing this on some test DB to be sure that there is no bad side effect of monitoring ORACLE data dictionary table.
    This DB is production DB or test/development DB ?
    Edited by: spajdy on Dec 5, 2012 12:14 PM

  • SSIS importing comma delimited with double quote text qualifier - Works in VS - SQL Job ignores text qualifier and fails (truncation)

    I've created an SSIS package to import a comma delimited file (csv) with double quotes for a text qualifier ("). Some of the fields contain the delimiter inside the qualified text. An example row is:
    15,"Doe, John",IS2,Alabama
    In SSIS I've specified the text qualifier as ". The sample output in the connection manager looks great. The package runs perfectly from VS and when manually executed on the SSIS server itself. The problem comes when I schedule the package to run via SQL
    job. At this point the package ignores the text qualifier, and in doing so pushes half of a field into the next available column. But instead of having too many columns, it concatenates the last 2 columns ignoring the delimiter. For example (pipes are fields):
    15|"Doe| John"|IS2,Alabama
    So the failure happens when the last half of a field is too large to fit into the next available field. In the case above _John" is 6 characters where the IS2 field is char(3). This would cause a truncation failure, which is the error I receive from the
    job history.
    To further test this I created a failure flow in my data flow to capture the records failing to be pulled from the source csv. Out of ~5000 records, ~1200 are failing, and every one of the failures has a comma delimiter inside the quoted text with a 'split'
    length greater than the next ordinal field. The ones without the comma were inserted as normal and records where the split fit into the next ordinal column where also imported, with the last field being concatenated w/delimiter. Example records when selected
    from table:
    25|"Allan Percone Trucking"|GI6|California --Imported as intended
    36|"Renolds| J."|UI6,Colorado --Field position offset by 1 to right - Last field overloaded
    To further ensure this is the problem, I changed the csv file and flat file connection manager to pipe delimited, and sure enough every record makes it in perfectly from the SQL job execution.
    I've tried comma delimited on the following set ups. Each set up failed.
    SSIS Server 2008 R2 RTM
    DB Server 2008 RTM
    DB Compat 80
    SSIS Server 2008 R2 RTM
    DB Server 2008 R2 RTM
    DB Compat 80
    SSIS Server 2008 R2 RTM
    DB Server 2008 RTM
    DB Compat 100
    SSIS Server 2008 R2 RTM
    DB Server 2008 R2 RTM
    DB Compat 100
    Since a lot of our data comes in via comma delimited flat files, I really need a fix for this. If not I'll have to rebuild all my files when I import them to use pipe delimiters instaed of commas. I'd like to avoid the extra processing overhead if possible.
    Also, is this a known bug? If so can someone point me to the posting of said bug?
    Edit: I can't ask the vendor to change the format to pipe delimited because it comes from a federal government site.

    Just wanted to share my experience of this for anyone else since I wasted a morning on it today.
    I encountered the same problem where I could run the package fine on my machine but when I deployed to a server and ran the package via dtexec, the " delimeter was being replaced with _x0022_ and columns all slurped up together and overflowing columns/truncating
    data etc.
    Since I didn't want to manually hack the DTS XML and can't install updates, the solution I used was to set an expression on the textdelimiter field of the flat file connection with the value "\"" (a double quote). That way, even if the one stored in XML
    gets bodged somewhere along the way, it is overridden with the correct value at run time. The package works fine everywhere now.

  • Execute SQL Task, OLE DB, Stored Procedure, Returns unexpected value upon second run

    when debugging SSIS, the "Execute SQL Task" runs a stored procedure and returns the expected value. When running the package a second time, the task returns an unexpected value. When running in VS2012 SQL editor, everything operates as expected.
    Please help me debug how to get the stored proc to return the same value every time the SSIS Package is run. thanks!
    Here is the sequence of events and what happens....
    Look for a Positor that matches the Application, Host, and User
    No matching PositorId is found, Creates new Positor row, returns that new PositorId
    Use PositorId to upload some data (Every thing works)
    re-run/debug the ssis pacakge
    Look for a Positor that matches the Application, Host, and User 
    <No clue what is happening>
    Returns -1 (SHOULD BE the same PositorId value returned in #2)
    "Execute SQL Task" Setup: No edits to Result Set nor Expressions
    "Execute SQL Task" Setup: GENERAL
    "Execute SQL Task" Setup: PARAMETER MAPPING
    SP called by "Execute SQL Task"
    CREATE PROCEDURE [posit].[Return_PositorId]
    AS
    BEGIN
    DECLARE @PositorId INT = [posit].[Get_PositorId]();
    IF (@PositorId IS NULL)
    BEGIN
    DECLARE @ProcedureDesc NVARCHAR(257) = OBJECT_SCHEMA_NAME(@@PROCID) + N'.' + OBJECT_NAME(@@PROCID);
    DECLARE @PositorNote NVARCHAR(348) = N'Automatically created by: ' + @ProcedureDesc;
    EXECUTE @PositorId = [posit].[Insert_Positor] @PositorNote;
    END;
    RETURN @PositorId;
    END;
    Supporting SQL Objects:
    CREATE FUNCTION [posit].[Get_PositorId]
    RETURNS INT
    AS
    BEGIN
    DECLARE @PositorId INT = NULL;
    SELECT TOP 1
    @PositorId = [p].[PO_PositorId]
    FROM [posit].[PO_Positor] [p]
    WHERE [p].[PO_PositorApp] = APP_NAME()
    AND [p].[PO_PositorHost] = HOST_NAME()
    AND [p].[PO_PositorUID] = SUSER_ID();
    RETURN @PositorId;
    END;
    GO
    CREATE PROCEDURE [posit].[Insert_Positor]
    @PositorNote NVARCHAR(348) = NULL
    AS
    BEGIN
    DECLARE @ProcedureDesc NVARCHAR(257) = OBJECT_SCHEMA_NAME(@@PROCID) + N'.' + OBJECT_NAME(@@PROCID);
    SET @PositorNote = COALESCE(@PositorNote, N'Automatically created by: ' + @ProcedureDesc);
    DECLARE @Id TABLE
    [Id] INT NOT NULL
    INSERT INTO [posit].[PO_Positor]([PO_PositorNote])
    OUTPUT [INSERTED].[PO_PositorId]
    INTO @Id([Id])
    VALUES(@PositorNote);
    RETURN (SELECT TOP 1 [Id] FROM @Id);
    END;
    GO
    CREATE TABLE [posit].[PO_Positor]
    [PO_PositorId] INT NOT NULL IDENTITY(0, 1),
    [PO_PositorApp] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorApp] DEFAULT(APP_NAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorApp] CHECK([PO_PositorApp] <> ''),
    [PO_PositorName] NVARCHAR(256) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorName] DEFAULT(SUSER_SNAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorName] CHECK([PO_PositorName] <> ''),
    [PO_PositorHost] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorHost] DEFAULT(HOST_NAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorHost] CHECK([PO_PositorHost] <> ''),
    [PO_PositorSID] VARBINARY(85) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorSID] DEFAULT(SUSER_SID()),
    [PO_PositorUID] INT NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorUID] DEFAULT(SUSER_ID()),
    [PO_PositorNote] VARCHAR(348) NULL CONSTRAINT [CL__PO_Positor_PO_PositorNote] CHECK([PO_PositorNote] <> ''),
    [PO_tsInserted] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__PO_Positor_PO_tsInserted] DEFAULT(SYSDATETIMEOFFSET()),
    [PO_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__PO_Positor_PO_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__PO_Positor_PO_RowGuid] UNIQUE NONCLUSTERED([PO_RowGuid]),
    CONSTRAINT [UK__Positor] UNIQUE CLUSTERED ([PO_PositorApp] ASC, [PO_PositorHost] ASC, [PO_PositorUID] ASC),
    CONSTRAINT [PK__Positor] PRIMARY KEY ([PO_PositorId] ASC)
    GO
    ssd

    The error is in item 7: Returns -1 (SHOULD BE the same PositorId value returned in #2); but no error message is returned or thrown from SSIS.
    The error message indicated referential integrity is not upheld when inserting records. This error message occurs AFTER the Execute SQL Task successfully completes; the E.SQL Task returns -1.  The executed SQL code will not allow values less than 0
    ([PO_PositorId] INT NOT NULL IDENTITY(0, 1),)
    [Platts Valid [41]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E2F.
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E2F  Description: "The statement has been terminated.".
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E2F  Description:
    "The INSERT statement conflicted with the FOREIGN KEY constraint "FK__PricingPlatts_Posit_PositorId". The conflict occurred in database "Pricing", table "posit.PO_Positor", column 'PO_PositorId'.".
    The aforementioned FOREIGN KEY constraint is due to the value being returned by the Execute SQL Task.; therefore, the error lies in the value returned by the Execute SQL Task.

  • SSIS custom execute sql task : Failed with error

    I am developing a custom SSIS task for running sql task. But it fails with error - I'm trying to set the resultsetbinding to be used by next task in workflow.
    Error: 0xC0014054 at CustomSSISTask: Failed to lock variable "User::id" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container
    during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
    Error: 0xC002F210 at CustomSSISTask, Execute SQL Task: Executing the query "SELECT id FROM sysobjects WHERE name = 'sysrowsets..." failed with the following error: "Failed to lock variable "User::id" for read access with error 0xC0010001
    "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is
    not being created.".
    ". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Warning: 0x80019002 at CustomSSISTask: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (3) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
    the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
    Task failed: CustomSSISTask
    Here is the code sample I'm trying , 
            public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser,
                                                  IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
                MessageBox.Show("testing:");
                try
                    // Add the SQL Task
                    Package package = new Package();
                    package.Executables.Add("STOCK:SQLTask");
                    Microsoft.SqlServer.Dts.Runtime.Variable variable = package.Variables.Add("id", false, "User", 0);
                     // Get the task host wrapper
                    TaskHost taskHost = package.Executables[0] as TaskHost;
                    // Get the task object
                    ExecuteSQLTask task = taskHost.InnerObject as ExecuteSQLTask;
                    // Set core properties
                    task.Connection = connections[0].Name;
                    task.SqlStatementSource = "SELECT id FROM sysobjects WHERE name = 'sysrowsets'";
                    //task.SqlStatementSource =
                    //    "SELECT PersonID from [AmalgaSpeedTableData].[SpeedTable].[DimPerson] where PersonIntID  = '1'";
                    task.SqlStatementSourceType = SqlStatementSourceType.DirectInput;
                    // Add result set binding, map the id column to variable
                    IDTSResultBinding resultBinding = task.ResultSetBindings.Add();
                    //IDTSResultBinding resultBinding = task.ResultSetBindings.GetBinding(0);
                    resultBinding.ResultName = "variable";
                    resultBinding.DtsVariableName = variable.QualifiedName; //"User::id";
                    task.Execute(connections, variableDispenser, componentEvents, log, transaction);
                catch (Exception ex)
                    throw new ArgumentException(ex.Message);
                return DTSExecResult.Success;
    It doesnt throw any exception but custom task fails.
    Later I will be also using parametersetbindings to pass some input parameters to this task , since I'm stuck for out param - blocked moving ahead.
    Any help would be greatly appreciated.
    Thanks
    Sang

    Hi, could you check whether the following threads help:
    http://stackoverflow.com/questions/5787621/ssis-package-failed-to-locak-variable-for-read-access-with-error-0xc0010001
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/40ee7eff-5ec1-426f-a1a8-ab85b40b51aa/error-variable-can-not-be-found-while-executing-package-from-the-net-code?forum=sqlintegrationservices
    Regards, Leo

  • SSIS Execute SQL Task using sp_rename giving deadlock issues

    All,
    We have a job that has 2 steps and both of those steps call an SSIS package
    1st package - Loads the data from a SQL server source, to a SQL Server destination tables, say, "TblHistory" is one of them
    2nd package - It does a re-name from the History table to the Main table, so below, is how the code looks like in the execute SQL Task:
    BEGIN TRANSACTION
    EXECUTE sp_rename 'dbo.Tbl', 'TblOld'
    EXECUTE sp_rename N'dbo.TblOld.PK_TblId', N'PK_TblIdOld', N'INDEX'
    EXECUTE sp_rename 'dbo.TblHistory', 'Tbl'
    EXECUTE sp_rename N'dbo.Tbl.PK_TblHistoryId', N'PK_TblId', N'INDEX'
    EXECUTE sp_rename 'dbo.TblOld', 'TblHistory'
    EXECUTE sp_rename N'dbo.TblHistory.PK_TblIdOld', N'PK_TblHistoryId', N'INDEX'
    COMMIT TRANSACTION
    In package 1 there are multiple history tables that are being loaded and most of them get renamed in the 2nd package. There is a separate SQL task for each of the history tables. The problem that I am running in to are the deadlock issues. When the 2nd package
    runs, it throws this error:
    "SQL - Table Rename & Swap for "Tbl" Execute SQL Task     Description: Executing the query "BEGIN TRANSACTION     EXECUTE sp_rename Tbl..." failed with the following error: "Transaction
    (Process ID 60) was deadlocked on lock resources with another process and has been chosen as the deadlock victim."
    It's giving me a deadlock issue on the other tasks as well. So, when the job ran today, I am noticing 4 deadlock errors on the 4 different execute SQL tasks in the 2nd package (i.e. the job fails at 2nd step)
    Has anyone faced this scenario before?

    Why renaming tables? The data do not change. So just load the data to an interim table and push it to the target or may be you do not need it at all - just load the right table.
    I admit I fail to capture the overall picture of what you are trying to solve or deliver. But renaming tables is something not usual.
    Arthur My Blog

Maybe you are looking for