TestStand 2013 ships with invalid SQL scripts
Hi all,
I tried to submit this through the official support channel, but ran into this roadblock. So, I'm reporting the issue here.
=================================================
I wanted to set up TestStand to log results to an SQL Server 2008 R2 database. I followed the instructions at http://zone.ni.com/reference/en-XX/help/370052M-01/tsfundamentals/infotopics/database_logging/
I tried to run C:\Program Files\National Instruments\TestStand 2013\Components\Models\TestStandModels\Database\SQL Server Create Generic Recordset Result Tables.sql However, SQL Server reported that the script contains syntax errors.
To fix the issue, I had to modify the script (replace "//" with "--", and replace "~" with ";") before running it.
It looks like other scripts in this folder have syntax errors too. Please fix the SQL scripts shipped with TestStand.
Hey JKSH,
Thanks for reporting this--we've filed an internal report for one of our developers to examine the syntax of our SQL files.
In the meantime, it sounds like you were able to work around the issue by changing the characters in the scripts, but have you run into any other problems using the scripts? I'd be happy to help out in any way I can. Just let us know if there's anything we can do to assist!
Daniel E.
TestStand Product Support Engineer
National Instruments
Similar Messages
-
ODP bug with generated SQL script when using DateTime
With EF5, I'm getting some really weird SQL scripts when dealing with DateTime.
THe follow script works fine.
var a = db.MOTOR_POOL_RESERVATION
.Where(o => o.DEPART_DT > new DateTime(2013, 1, 1))
.Select(o => o.RESERVATION_ID)
.ToList();
SELECT "Extent1"."RESERVATION_ID" AS "RESERVATION_ID"
FROM "MOTORPOOL"."MOTOR_POOL_RESERVATION" "Extent1"
WHERE ("Extent1"."DEPART_DT" > TO_TIMESTAMP('2013-01-01 00:00:00.000', 'YYYY-MM-DD HH24:MI:SS.FF'))
But as soon as I create DateTime with year, month or day values forming from a variable, then generated scripts become incorrect.
var year = 2013;
var month = 3;
var dt = new DateTime(year, month, 1);
var c = db.MOTOR_POOL_RESERVATION
.Where(o => o.DEPART_DT > dt)
.Select(o=>o.RESERVATION_ID)
.ToList();
see the date is treated a string.
SELECT "Extent1"."RESERVATION_ID" AS "RESERVATION_ID"
FROM "MOTORPOOL"."MOTOR_POOL_RESERVATION" "Extent1"
WHERE ("Extent1"."DEPART_DT" > '2013-03-01 00:00:00')
var b = db.MOTOR_POOL_RESERVATION
.Where(o => o.DEPART_DT > new DateTime(year, month, 1))
.Select(o => o.RESERVATION_ID)
.ToList();
same problem with this one.
SELECT "Extent1"."RESERVATION_ID" AS "RESERVATION_ID"
FROM "MOTORPOOL"."MOTOR_POOL_RESERVATION" "Extent1"
WHERE ("Extent1"."DEPART_DT" > '2013-03-01 00:00:00')It turns out that the sql is valid since I'm using bind parameters.
-
How to add responsibility to an user with an sql script
Hi All,
Apps:11.5.10.2
DB:9.2.0.8
how can we add a particular responsibilty to mutiple application user at a time with an sql query.
Thanks
SunilHey,
Thanks for the posting on this. I have been working on this for the past couple of days and found the same "issue". The SQL is working, but the fnd_user_resp_groups 'view' at least in our version doesn't display the 'start_date, end_date, description' correctly. It seems to be hard coded to display:
start_date = 01/JAN/00
end_date = NULL
description = NULL
I found this out as I was trying to alter the table, but it then I realized it was a view. And if you look at the view details, it will show it is hardcoded.
You should look at the user_resp_groups_all view. It displays what you have set. -
Lync standard 2013 deployment with standard SQL 2008/2012
Hi
I have been looking into the requirements and of setup Lync 2013 and I'm getting a little confused at to what would be required for SQL databases and what servers they need to be located on.
we have two sites siteA and siteB and a fast link between them 1g
I want to have two FE lync servers at site A in a pool
I want to have two FE Lync servers at site B in a pool
want to have the DR capabilities that have been mentioned in pool pairing as well can this be done with standard only
Do I require SQL for these Front end servers? or do I just need two BE servers at each location each with SQL standard installed?
To start with we really only want to use lync for IM and Presence but will require access from Iphones will this require a edge server in the DMZ? or could you use TMG?
what other roles will be required if we need to look at conversation that occurred in IM for auditing purposes.
I have looked on Technet and it only really refers to using SQL express for standard, which to me historically is something I have not done since it has been looked upon as free and therefore maybe not seen as an medium enterprise solution.
thanks in advanced
JIf you're using Standard edition servers, meaning you'd have 1 server per pool and you'd pair between the sites, no SQL licensing is required unless you want it for monitoring or persistent chat databases.
If you want to have multiple servers in a pool for high availability (you mentioned 2 per pool, you want a minimum of 3 per pool), you'll need a Lync Enterprise pool with a full SQL backend.
You can pool pair with both Standard and Enterprise.
You don't require SQL for the front ends in either scenario, as SQL Express will be installed. For the Enterprise edition pool you'll need at least one SQL Standard instance, but a second for high availability using mirroring would be nice. You'll
want a third SQL server acting as a witness to allow for automatic failover within the mirror, but this can be SQL express and doesn't require a license.
For access from an iPhone, using the Lync mobility client, you'll need an edge for A/V traffic and a TMG or other reverse proxy such as IIS ARR or WAP to publish the web services on the front end pool to the Internet.
Since this is Lync 2013, you don't need an additional role for auditing, auditing can be collocated on the front end server and write to the same SQL instance you're using for the front end pool. You could also choose to keep the data in Exchange if
you're running at least Exchange 2013.
SQL express is the only thing you can use for Lync standard back end, but this isn't awful. It does the job for Lync. If you prefer a full SQL instance, then Enterprise is the way to go, and if you want HA with multiple servers in a pool, this
is your only option. Lync will install SQL Express on each server regardless for local copies of the management store databases and presence information, but the primary copies will be in the full SQL back end instances.
Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
SWC Unified Communications
This forum post is based upon my personal experience and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Hello everyone.
Can sb help me in creating the following script based on three tables:
id
col1
314
somevalue2
id
id1
col2
314
1
somevalue4
314
2
somevalue5
314
3
somevalue6
id
id1
id2
cod
qty
314
1
1
LTR
10
314
1
2
KG
20
314
2
1
LTR
40
The result should be like this:
id
id1
id2
cod_1
qty_1
cod2
qty_2
col1
col2
314
1
1
LTR
10
KG
20
somevalue2
somevalue4
314
2
1
LTR
40
somevalue2
somevalue5
Message was edited by: 933651Hi,
here's my view to this problem. Perhaps need some adjusting in join conditions when data model and data is clearer
create table t1 (
id number,
col1 varchar2(10)
insert into t1 values (314, 'somevalue2');
create table t2 (
id number,
id1 number,
col2 varchar2(10)
insert into t2 values (314, 1, 'somevalue4');
insert into t2 values (314, 2, 'somevalue5');
insert into t2 values (314, 3, 'somevalue6');
create table t3(
id number,
id1 number,
id2 number,
cod varchar2(3),
qty number
insert into t3 values (314, 1, 1, 'LTR', 10);
insert into t3 values (314, 1, 2, 'KG', 20);
insert into t3 values (314, 2, 1, 'LTR', 40);
with ltr as (
select id, id1, id2, cod, qty from
select id, id1, id2, cod as code, cod, qty from t3
pivot
sum(qty) for code in ('LTR' as qty)
where qty is not null
), kg as (
select id, id1, id2, cod, qty from
select id, id1, id2, cod as code, cod, qty from t3
pivot
sum(qty) for code in ('KG' as qty)
where qty is not null
select
t2.id,
t2.id1,
ltr.id2,
ltr.cod,
ltr.qty,
kg.cod,
kg.qty,
t1.col1,
t2.col2
from t2 join ltr on (
t2.id = ltr.id and t2.id1 = ltr.id1
) full join kg on (
t2.id = kg.id and t2.id1 = kg.id1
) left join t1 on (
t1.id = t2.id
order by id, id1
drop table t1 purge;
drop table t2 purge;
drop table t3 purge;
table T1 created.
1 rows inserted.
table T2 created.
1 rows inserted.
1 rows inserted.
1 rows inserted.
table T3 created.
1 rows inserted.
1 rows inserted.
1 rows inserted.
ID ID1 ID2 COD QTY COD QTY COL1 COL2
314 1 1 LTR 10 KG 20 somevalue2 somevalue4
314 2 1 LTR 40 somevalue2 somevalue5
table T1 dropped.
table T2 dropped.
table T3 dropped. -
Help with T-SQL script. I cannot tell where is that line based on line number. Thx
rrr
If the error is indeed here, then try
CAST(@KillDays * @VarianceFactorPrcnt * -0.24 AS INT)
But in fact the value should be INT, not decimal for the DATEADD function.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Utlrp.sql script job schedule from OEM
Any users on how to create grid control job for recompiling object via below script:
@?/rdbms/admin/utlrp.sql
I tried few testing but all failing at
SQL> SQL> SQL> SQL> SQL> SELECT dbms_registry_sys.time_stamp('utlrp_bgn') as timestamp from dual
ERROR at line 1:
ORA-00904: "DBMS_REGISTRY_SYS"."TIME_STAMP": invalid identifier
(creating job as SQL script)
Thanks,Hi Users,
Thanks for all responses.
Thanks Absorbine, it was really funny l laughed on that.
OrionNet, I am trying to run this on atleast 5 db instances and also not real expert in procedures.
Basically I am trying to create OEM job to run utlrp.sql or UTL_RECOMP pacakages on 5 different db instances.
Tried below:
1. created job with utlrp.sql:
@?.rdbms/admin/utlrp.sql;
Error:
SQL> SQL> SQL> SQL> SQL> SELECT dbms_registry_sys.time_stamp('utlrp_bgn') as timestamp from dual
ERROR at line 1:
ORA-00904: "DBMS_REGISTRY_SYS"."TIME_STAMP": invalid identifier
2. Created job with UTL_RECOMP:
SQL Script:
WHENEVER SQLERROR EXIT FAILURE;
EXEC UTL_RECOMP.recomp_serial;
Error:
SQL> SQL> SQL> SQL> SQL> BEGIN utl_recomp.recomp_serial ; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'UTL_RECOMP.RECOMP_SERIAL' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
cheers,
Rapchik -
SQL script for LOV in designer 10G repository
Hi, i need to extract the full sql text (script or ddl) from each list of values registered in the repository, i know i can see the table usage, sql sets etc, but i need an script to built each sql from each list.
Thanks about your help.
Regards,
Marco.
pd. i dl the designer repository data model but is not full documented.
Help me please.Sorry, I can't help with the SQL script, but regarding the Repository metamodel, have you seen the Schema Diagrams and the Repository and API Model Reference Guide on the Designer documentation page (http://www.oracle.com/technology/products/designer/documentation.html) on OTN?
- Suresh -
Does SQL Developer support a default Path to SQL scripts
Just started using SQL Developer.
In the past, I created shortcuts on my PC desktop to run SQLPLUS to the different
instances as follows:
1. Create a shortcut to PLUS80W.exe
2. Set the property "Start in" to a directory where the SQL scripts are located.
3. Add the login/password@instance to the end of the shortcut.
In this way, ypu only needed to click on the shortcut to log into SQLPLUS and run your
scripts via @script.sql etc.
Can you setup a default path to SQL scripts SQL Developer so that it can locate
the scripts on your PC ?I did notice in version 13.43 that if you close SQL Developer with a SQL script open in the SQL Worksheet, when you startup SQL Developer the next time it automatically opens the file in the SQL Worksheet with no database connection. It also sets the default path for SQL scripts to be the directory where your open SQL file resides. If you right-click in the SQL Workshop and then click on "Open File" the directory defaults to the directory of the SQL file that is open.
Mike -
Running a SQL Script during task sequence
We are about to roll out new workstations to our entire enterprise. With that rollout comes updated software. The primary application that our end users work with on a daily basis uses SQL Express 2008 R2. A challenge that we've come across
is with a SQL script that we need to run, after the workstation has joined our domain. I have created a batch file, and copied it to the same directory as the AddADGroup.sql script. I have created an application in SCCM to run the batch file and
SQL script. The following is the batch file:
@echo off
Set Path=%path%;C:\Program Files\Microsoft SQL Server\110\Tools\Binn
echo.
SQLCMD -S .\SQLEXPRESS -U sausername -P xxxxxxxxxxxxxxxxx -i AddADGroup.sql
echo.
What I need to know is how to get this batch file to run, and be successful (about 4000 times). Is running this batch file the best practice? If not, what is the alternative?
Thanks! NateHi,
The following blog describes that how to deploy bat and script by Packages.
SCCM 2012 – deploying bat files and scripts
(Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice.
Microsoft does not guarantee the accuracy of this third-party contact information.)
Best Regards,
Joyce Li
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
"ORA-1722 Invalid number" error while runing a SQL script in SQL*Plus
Hello,
I created a SQL script that is intended to populate tables with
baseline data. When I run the script in the SQL*Plus program
that comes with the Oracle 8.1.6 (client), I receive an "ORA-
1722 Invalid number".
The error always occurs when SQL*Plus tries to execute the
following SQL statement:
insert into components(db_ind,module_id,ext_compid,active) values
('cm',modules_seq.currval,1046682,'y');
The datatypes for the columns on the components table are as
follows:
db_ind varchar2(2);
module_id number;
ext_compid number;
active varchar2(1);
It seems that for some reason Oracle is having trouble
recognizing 1046682 as a number.
I also tried the following INSERT statements to see if that
would work:
insert into components(db_ind,module_id,ext_compid,active) values
('cm',modules_seq.currval,to_number('1046682'),'y');
insert into components(db_ind,module_id,ext_compid,active) values
('cm',modules_seq.currval,'1046682','y');
but I still receive the same error message
Is there some NLS setting(s) I need to modify so that Oracle
does not give me this error? Does anyone know the answer to
this problem?
Your help is greatly appreciated.
Oscar
(NOTE: I also receive this same error when trying run the
script in SQL Navigator and Toad programs)Please see the following docs.
R12: JBO-27122 Error Message Clicking On Supplier Accounting Link With Unexpected Error [ID 1218903.1]
Supplier Management Accounting Link Gives Unexpected Error and JBO-27122 at SELECT * FROM (select pvsa.ADDRESS_STYLE [ID 1340655.1]
Adding Accounting Information or Operating Unit Information fails with APP-FND-1564: ORACLE error 1722 in FDFGVD [ID 364265.1]
Thanks,
Hussein -
Issues with the SQL wrapper scripts created with the DB adapter
Hi All,
We have the wrapper sql scripts created with the DB adapter configurations which are being used to invoke the stored procedures.
To give you a background on the wrapper sql scripts-The Adapter Configuration wizard generates a wrapper API when a PL/SQL API has arguments of data types, such as PL/SQL Boolean, PL/SQL Table, or PL/SQL Record.
These two SQL files are saved in the same directory where the WSDL and XSD files are stored, and are available in the Project view.
The issue we are facing now is that whenever the associated package or the procedure structure undergoes a change we see an error as given below:
An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/Application1_ABC_ESB/DBADP_Update_Out.wsdl [ DBADP_Update_Out_ptt::DBADP_Update_Out(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'DBADP_Update_Out' failed due to: Error while trying to prepare and execute an API. An error occurred while preparing and executing the APPS.XXIRIS_SOA_R_WRAPPER.XXIRIS_AR_CUST_K$ API. Cause: java.sql.SQLException: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body "APPS.XXIRIS_AR_CUST_K" has been invalidated ORA-04065: not executed, altered or dropped package body "APPS.XXIRIS_AR_CUST_K" ORA-06508: PL/SQL: could not find program unit being called: "APPS.XXIRIS_AR_CUST_K" ORA-06512: at "APPS.XXIRIS_SOA_R_WRAPPER", line 1 ORA-06512: at line 1 [Caused by: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body
In such cases we need to either execute the wrapper scripts again or refresh the connection pool in case the wrapper sql scripts for that procedure are not available.
In some cases we see that the first instance errors out.However the second request and the subsequent requests after that goes through successfully.
Please do let me know if anyone has faced such issues before.
Any inputs in this regard would be of great help.
Thanks in advance!
DeepthiI stumbled on a link in the oracle forum which says that the "create or replace package XXX" at the start of the PL/SQL procedure when run seems to intermittently cause the ORA-04068: existing state of packages has been discarded problem.
As per the solution suggested an “alter package XXX compile" can be executed after the changes are made and then we would no longer get the error in BPEL/ESB and dont have to bounce the server too.
__http://forums.oracle.com/forums/thread.jspa?threadID=185762_
However the above solution does not seem to resolve the issue.
Any help in this regard would be highly appreciated.
Thanks,
Deepthi -
SQL script with a prompt functionality.
Hello experts,
I tried searching this on the net but was unsucessful...
Bascially I need to update an sql script with a prompt functionality..Basically I would like a user prompt that would enter 'Yes or No' to compile invalid objects using utlrp.
If Yes, it should compile it
If No it should exit out...
Can anyone please help.. Need to do this today.
Edited by: user568296 on Oct 2, 2009 8:18 AMHi,
As someone suggested, you're probably better off doing this at the OS level.
SQL*Plus does not have any good mechanism for conditional branching. One trick you can do in SQL*Plus is to run one script from another by saying <tt>@@filename</tt>. By using a substitution variable (which can be defined based on the results of a query) in place of a literal filename, you can make this dynamic.
For example, the following script runs either
recompile.sql or
goodbye.sql
based on the answer to a prompt:
ACCEPT recompile_now PROMPT 'Do you want to recompile objects now? '
COLUMN next_script_col NEW_VAL next_script
SELECT CASE
WHEN UPPER ('&recompile_now') LIKE 'Y%'
THEN 'recompile'
ELSE 'goodbye'
END AS next_script_col
FROM dual;
@@&next_script<tt>@@filename</tt> assumes filename.sql is on the same directory as the calling script. You could also give a full path name using only one @-sign:
<tt>@pathname</tt> -
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. -
Invalid SQL Query with DBMS_JOB.SUBMIT inside
Probably a simple thing, but I can't seem to find the problem in here. I get an error that INVALID SQL STATEMENT. I guess I'm messing something up with the lots of ' chars. If anyone could point out where did I failed I'd be really grateful.
create or replace
trigger TR_REFRESH_SCHEMAS
after create or alter
on schema
declare
tableName user_tables.table_name%TYPE;
table_count number(2);
begin
select ora_dict_obj_name
into tableName
from dual;
select count(table_name)
into table_count
from user_tables
where table_name = tableName;
if (table_count != 0) then
execute immediate
'BEGIN' ||
'DBMS_JOB.SUBMIT' ||
'(' ||
'job => ' || table_count || ',' ||
'what => ' || 'INSERT_SCHEMA(' || tableName || ');,' ||
'next_date => ' || sysdate || ',' ||
'interval => ' || null ||
');' ||
'END;' ||
'COMMIT;'
end if;
exception
when no_data_found then
raise_application_error(-20020, 'Table ' || tableName || ' not found!');
when others then
raise_application_error(-20002, 'Error (' || SQLCODE || '): ' || SQLERRM);
end;I've tried all your recommendations without any success.
For the dbms_output.put_line:
- I've found there was a problem with the interval => null. In the final statement it looked like: DBMS_JOB.SUBMIT(1, INSERT_SCHEMA(TEST), 2012-08-31...., ); obviously wrong. Since the default value of interval is NULL I've taken out that parameter.
For the formatting:
- Thanks for pointing that out! It was surely a problem with that part, as I've seen when printing the statement.
execute immediate
'BEGIN ' ||
'DBMS_JOB.SUBMIT' ||
'(' ||
'job => ' || table_count || ',' ||
'what => ' || 'INSERT_SCHEMA(''' || tableName || ''');,' ||
'next_date => ' || sysdate ||
');' ||
'END;'
);With the qnotation:
- I get an immediate syntactical error when inserting your code right at the second 'q{' part. On the other hand the first parameter: job is a number type so to_char is meaningless in my opinion.
The result so far for a CREATE TABLE statement:
Error starting at line 1 in command:
create table TESTING
id varchar2(20) not null,
text number(8),
dat blob,
creat_e date
Error at Command Line:1 Column:0
Error report:
SQL Error: ORA-00604: error occurred at recursive SQL level 1
ORA-20002: Error (-6550): ORA-06550: line 1, column 77:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. ( ) , * % & = - + < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
The symbol ";" was ignored.
ORA-06550: line 1, column 102:
PLS-00103: Encountered the symbol "-" when expecting one of the following:
<an identifier> <a double-quoted delimited-identifier>
current delete exists prior
Th
ORA-06512: at line 32
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
Maybe you are looking for
-
Help required in understanding of static blocks in java
Hi , Can some one help me in understanding the difference between static blocks in java....also what is the difference in declaring some static variables in a class and and declaring some variables in a static block? From an architecture viewpoint wh
-
Change shopping cart status to reject when older than certain period
Hi Guru's, I'm new to this environment. Please help me with advice and sample code for the following. I need to check if shopping cart is open for more than 20 days then change status to reject, daily background job. Then need to inform user of new s
-
Cannot find Billing System Password to register for My Verizon account
I'm trying to register for a My Verizon account with my new business phone line, in hopes that I can see when my next bill will be due, or if it has already been sent, but I've not yet received it. When I click to register for a My Verizon account, I
-
Displaying dynamic form for multiple players
I am trying to dynamically display a form based on the number the user chooses. For instance, the user is register his/her child for soccer. I have a form that asks all the parent/guardian information and the player info. If the parent/guardian choos
-
Hi, I can't connect to my iMessage account with the Messages application from my Mac ( 10.8.5) I am retyping my user/password - which works for my other Apple services ( iCloud, iTunes store,...) but the Messages app can't connect. Also, the FaceTime