Connecting strings for execution as SQL-Statement
Hello to all.
I've the problem, that I want to write a package which handels occuring erros as far as possible automatically.
One part is to recompile invalid objects.
I can find all these objects by useing the following cursor:
CURSOR curInvalidObjects
IS SELECT OBJECT_TYPE, OWNER, OBJECT_NAME
from dba_objects a
where STATUS = 'INVALID' and
OWNER = 'BESECKE' AND
OBJECT_TYPE in ( 'PACKAGE BODY',
'PACKAGE', 'FUNCTION', 'PROCEDURE',
'TRIGGER', 'VIEW' )
order by OWNER, OBJECT_TYPE, OBJECT_NAME;
After opening the cursor I can go trough the records and recompile the objects with something like this:
alter || recInvalidObjects.OBJECT_TYPE || ' '
|| recInvalidObjects.OWNER || '.' ||
recInvalidObjects.OBJECT_NAME || compile;
But that does not work. In this way I can't get any executable SQL-Statement. It just becomes a string, but it's not executable.
I think it's a simple problem, but I tried to find anything about executable stings in the documentation I have, and I could not find anything. So can anybody give me a short hint, how to create an executable statement?
Thanks a lot.
Susanne Saalmann
If you just recompile without taking the correct order of compilation into account, you will have to run your statement a couple of times. This script solves that:
SET HEADING OFF
SET FEEDBACK OFF
SET PAGES 9999
SET TIMING OFF
SET TERMOUT ON
COLUMN noprn NOPRINT
SPOOL comp.sql
SELECT 'ALTER '||
DECODE( o.object_type, 'PACKAGE BODY', 'PACKAGE', o.object_type)||
' '||decode(o.object_type,'JAVA CLASS','"',null)||
o.object_name || decode(o.object_type,'JAVA CLASS','"',null)||
' COMPILE '||
DECODE( o.object_type, 'PACKAGE BODY', 'BODY;', ';'),
COUNT( d.name ) noprn
FROM user_objects o,
user_dependencies d
WHERE o.object_name = d.referenced_name(+)
AND o.object_type = d.referenced_type(+)
AND o.status = 'INVALID'
GROUP BY o.object_name, o.object_type
ORDER BY noprn DESC
SPOOL OFF
SET HEADING ON
SET FEEDBACK ON
SET PAGES 14
START comp.sql
SHOW USER
SELECT object_type, status, count(*)
FROM user_objects
GROUP BY object_type, status
Similar Messages
-
Multiple Executions Plans for the same SQL statement
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.
Below is the awrsqrpt's output for your reference.
WORKLOAD REPOSITORY SQL Report
Snapshot Period Summary
DB Name DB Id Instance Inst Num Release RAC Host
TESTDB 2157605839 TESTDB1 1 10.2.0.3.0 YES testhost1
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 32541 11-Oct-08 21:00:13 248 141.1
End Snap: 32542 11-Oct-08 21:15:06 245 143.4
Elapsed: 14.88 (mins)
DB Time: 12.18 (mins)
SQL Summary DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
Elapsed
SQL Id Time (ms)
51szt7b736bmg 25,131
Module: SQL*Plus
UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
TEST_BATCH_DT = (:B1 )
SQL ID: 51szt7b736bmg DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> 1st Capture and Last Capture Snap IDs
refer to Snapshot IDs witin the snapshot range
-> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
Plan Hash Total Elapsed 1st Capture Last Capture
# Value Time(ms) Executions Snap ID Snap ID
1 2960830398 25,131 1 32542 32542
2 3834848140 0 0 32542 32542
Plan 1(PHV: 2960830398)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 25,131 25,130.7 3.4
CPU Time (ms) 23,270 23,270.2 3.9
Executions 1 N/A N/A
Buffer Gets 2,626,166 2,626,166.0 14.6
Disk Reads 305 305.0 0.3
Parse Calls 1 1.0 0.0
Rows 371,735 371,735.0 N/A
User I/O Wait Time (ms) 564 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 1110 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS FULL | TEST | 116K| 2740K| 1110 (2)| 00:00:14 |
| 3 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 5 (0)| 00:00:01 |
| 4 | INDEX RANGE SCAN | ACCT_DT_ACC_IDX | 1 | | 4 (0)| 00:00:01 |
Plan 2(PHV: 3834848140)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 0 N/A 0.0
CPU Time (ms) 0 N/A 0.0
Executions 0 N/A N/A
Buffer Gets 0 N/A 0.0
Disk Reads 0 N/A 0.0
Parse Calls 0 N/A 0.0
Rows 0 N/A N/A
User I/O Wait Time (ms) 0 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 2 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 28 | 2 (0)| 00:00:01 |
| 3 | INDEX RANGE SCAN | TEST_DT_IND | 1 | | 1 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 4 (0)| 00:00:01 |
| 5 | INDEX RANGE SCAN | INDX_ACCT_DT | 1 | | 3 (0)| 00:00:01 |
Full SQL Text
SQL ID SQL Text
51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )Your input is highly appreciated.
Thanks for taking your time in answering my question.
RegardsOracle Lover3 wrote:
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.If you're using bind variables and you've histograms on your columns which can be created by default in 10g due to the "SIZE AUTO" default "method_opt" parameter of DBMS_STATS.GATHER__STATS it is quite normal that you get different execution plans for the same SQL statement. Depending on the values passed when the statement is hard parsed (this feature is called "bind variable peeking" and enabled by default since 9i) an execution plan is determined and re-used for all further executions of the same "shared" SQL statement.
If now your statement ages out of the shared pool or is invalidated due to some DDL or statistics gathering activity it will be re-parsed and again the values passed in that particular moment will determine the execution plan. If you have skewed data distribution and a histogram in place that reflects that skewness you might get different execution plans depending on the actual values used.
Since this "flip-flop" behaviour can sometimes be counter-productive if you're unlucky and the values used to hard parse the statement leading to a plan that is unsuitable for the majority of values used afterwards, 11g introduced the "adaptive" cursor sharing that attempts to detect such a situation and can automatically re-evaluate the execution plan of the statement.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Log for all the sql statement executed
Hi,
I would like to know how to see the log for all the sql statement executed starting from connection to all the database related actions.
Is it something that i need to set it up in the driver?
I'm using Tomcat and JDBC driver.
Please reply.
Thanks,
AnjanaMake your own.
Calendar cal = new GregorianCalendar();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH) + 1;
int day = cal.get(Calendar.DAY_OF_MONTH);
//use calendar object to get other infos such as time of query
//append your query string
File f =new File ("c:\\jakarta-tomcat-3.2.4\\webapps\\ASD\\LOGS\\log" + df.format(day) + df.format(month) + year + ".txt");
if (! f.exists())
f.createNewFile();
FileWriter fw = new FileWriter (f, true);
// append new log to end of file
fw.write(buf.toString());
fw.write("\n");
fw.flush();
fw.close();
catch (IOException ioe)
System.out.println(ioe.toString()); -
RMAN-11003: failure during parse/execution of SQL statement: alter session
without doing any changes I have started getting the following error in the RMAN logs.
i didnt any changes related to sort_area_size but getting the error below
plz help guys
RMAN logs
=====================
connected to recovery catalog database
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of allocate command at 12/03/2007 22:00:01
RMAN-03014: implicit resync of recovery catalog failed
RMAN-03009: failure of full resync command on default channel at 12/03/2007 22:00:01
RMAN-11003: failure during parse/execution of SQL statement: alter session set sort_area_size=10485760
ORA-00068: invalid value 10485760 for parameter sort_area_size, must be between 0 and 1Hi:
It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe). -
How to get the time for executing an SQL statement?
hi all...
How can I get the total execution time for a given SQL statement to a ViewObject which is created dynamically for this SQL so that the end user knows it before hand and try to stop it or go further..?
Please post any ideas if you have got..!!!
thanx in advance..
grüss
K°viThis is not really a question for the JDeveloper forum, but rather for the DB forum.
Since Oracle9i there is a way to estimate how long a query will take, before executing it.
Check it out in the Oracle DB documentation or ask on the DB forum.
There is no built-in functionality for this in JDeveloper, but you should be able to call out to the DB from your Java code to get the estimate. -
How to dynamically set connection string for report in C# code?
Hi,
I have installed CRVS2010. I have created new Crystal Report WPF Application and new report. I would like to set connection string for report in code dynamically.
Is this possible?
Thanks
IvanaLots of posts in this forum on how to set database connections. WPF should not be a consideration as it's just a viewer. The report engine is still the same. Search these forums. Use the search box at the top right corner of this page. Look at samples here:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
Note that none of the samples above are using WPF, but like I said, the WPF is just a different viewer and will not impact how the report engine logs on to a database. (I think of it as a gray car vs. a red car. Same engine, just the color is different)
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
Save Query - An error occurred while creating connection strings for the query
A workbook trying to edit and reload I get the following error "Save Query - An error occurred while creating connection strings for the query" No Power Pivot data model or anything.
I am getting the same error when editing a Power Query in an Excel spreadsheet. It happens when I change a Group By step to do a Sum instead of Count Rows.
-
How to change connection string for a form created with b1de
Hi all
i've created a form using the Code Generator tool ob B1DE
My question is how can i set the connection string to a different server and database. doing so after the creation wizard has finished?Hi,
Why do you need to change the connection string? What are you calling "connection string for a form"???
The only connection string I now about is the one used to connect to the UI API... and this one is fixed for all apps in debug mode and given as parameter when your addon is registered in B1.
The connection string is filled in the code of your generated addon.
Please go to the main class of your addon, in the main method you have the following code where the connection string is filled either with the command line parameters (release mode) or with the fixed value given by SAP. This code doesn't need to be changed...
public static void Main()
int retCode = 0;
string connStr = "";
bool diRequired = true;
// CHANGE ADDON IDENTIFIER BEFORE RELEASING TO CUSTOMER (Solution Identifier)
string addOnIdentifierStr = "";
if ((System.Environment.GetCommandLineArgs().Length == 1)) {
connStr = B1Connections.connStr;
else {
connStr = System.Environment.GetCommandLineArgs().GetValue(1).ToString();
try {
// INIT CONNECTIONS
retCode = B1Connections.Init(connStr, addOnIdentifierStr, diRequired);
Regards
Trinidad. -
Report Designer odbc connection string for data source using a parameter
I am using stand alone report designer 3 for the present and have a question/problem regarding the odbc connection string for MySQL when setting up the data-source
I need to be able to enter a parameter which is the database name i.e. BOE-201401 or say BOE-201312 etc from a list of databases the user can choose from.
at present the odbc connection string points to BOE-201402
the connection string is at present Dsn=Development Server for MYsql;description=MYSQL;server=ldndw01;database=BOE-201402;port=3306
my parameter has the name BOE_DATABASE
and in an expression it is as such
=Parameters!BOE_DATABASE.Value
I want to point the datasource for the report to the parameter value before the user sees the report.Hi Leslie,
Based on your description, we want to design a report with a dynamic DataSource connection string. There are the basic steps below for your reference:
Create report with static database.
Change data source to report parameter.
Send new database connection string as a report parameter.
More detail information, please refer to the following blog: Dynamic Database in SSRS 2008.
http://haseebmukhtar.wordpress.com/2011/11/09/dynamic-database-in-ssrs-2008/
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
What are the username, password and connect string for Designer 6.1.1?
So that we may better diagnose DOWNLOAD problems, please provide the following information.
- Server name
- Filename
Oracle designer6.1.1
- Date/Time
- Browser + Version
IE 6.0
- O/S + Version
Win 98
- Error Msg
ORA-12154:TNS:could not resolve service name.
RME-00220:Fail to connect to repository
These error messages were shown after I entered system, manager and internal, respectively.Hi YungJen Chen,
There is no general username, password and connect string for
Designer 6i Release 4.1.1.
First, you install the client tools using the Installer. See also the
Designer Installation Guide, Chapter 1, 'Client Side installation'.
Second, you install the repository into an existing database, using
the Designer Installation Guide, Chapter 2, 'Server-side installation,
migration and upgrade'.
The Installation Guide provides step by step instructions on what
users you need to create for various purposes. Any database users
you may need to use such as System or Sys will use the password
given when you installed the database, or whatever passowrd you
changed it to since.
The Installation Guide is available as part of the download, or from
your Windows Start Menu once the Designer client tools are installed
or from the Designer Documentation page here on OTN.
Hope this helps. Regards,
Dominic Battiston
Designer/JDeveloper Product Management -
What are the username, password, and connect string for Designer6i R4.1.1
As the title, I tried system, manager and internal.
But it did not work out.
Thank you for your help.Hi YungJen Chen,
There is no general username, password and connect string for
Designer 6i Release 4.1.1.
First, you install the client tools using the Installer. See also the
Designer Installation Guide, Chapter 1, 'Client Side installation'.
Second, you install the repository into an existing database, using
the Designer Installation Guide, Chapter 2, 'Server-side installation,
migration and upgrade'.
The Installation Guide provides step by step instructions on what
users you need to create for various purposes. Any database users
you may need to use such as System or Sys will use the password
given when you installed the database, or whatever passowrd you
changed it to since.
The Installation Guide is available as part of the download, or from
your Windows Start Menu once the Designer client tools are installed
or from the Designer Documentation page here on OTN.
Hope this helps. Regards,
Dominic Battiston
Designer/JDeveloper Product Management -
Hi expert,Incorrect connection string for addon
hi expert
I am getting error when connect my addon in client pc.
my addon working fine in server at client side.
but in client i m getting error "Incorrect connection string for addon".in my addon i am using crystal report and two sap b1 user form. thanks in adva.
regards
Rajkumar Gupta
Edited by: Rajkumar Gupta on May 23, 2009 12:49 PMHi Rajkumar,
Sometimes this error message is related to the UI server. Please see note 808354 or 852031 and see if this has any effect.
If not, please post up a code sample so we can take a look,
Regards,
Niall -
Execution of SQL statement 'alter tablespace PSAPSR3
Dear mastah,
I trying extend tablesapce at oracle, but not succesfully, and have problem,
maybe can help this issue..
error problem add tablespace:
BR0280I BRSPACE time stamp: 2014-01-06 10.27.31
BR0370I Directory /oracle/SID/sapreorg/semxnacf created
BR0280I BRSPACE time stamp: 2014-01-06 10.27.32
BR0319I Control file copy created: /oracle/SID/sapreorg/semxnacf/cntrlSID.old 99106816
BR0280I BRSPACE time stamp: 2014-01-06 10.27.32
BR1088I Extending tablespace PSAPSR3...
BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
BR0301E SQL error -59 at location BrSqlExecute-1, SQL statement:
'/* BRSPACE */ alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off'
ORA-00059: maximum number of DB_FILES exceeded
BR1017E Execution of SQL statement 'alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off' failed
BR0669I Cannot continue due to previous warnings or errors - you can go back to repeat the last action
BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
BR0671I Enter 'b[ack]' to go back, 's[top]' to abort:
regards,
aminBR1088I Extending tablespace PSAPSR3...
BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
BR0301E SQL error -59 at location BrSqlExecute-1, SQL statement:
'/* BRSPACE */ alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off'
ORA-00059: maximum number of DB_FILES exceeded
$ oerr ora 59
00059, 00000, "maximum number of DB_FILES exceeded"
// *Cause: The value of the DB_FILES initialization parameter was exceeded.
// *Action: Increase the value of the DB_FILES parameter and warm start.
$ -
Connection string for Oracle in instantclient11_1 Driver without TNS
We have Oracle DB without tnsnames.ora.
We are able to connect to the DB using sqlplus from a command line with the following connection string:
username/Password@DomainAdress:Port/DataBaseName.DomainAdress
SYS/****@computerName.Domain.net:1523/DataBaseName.computerName.Domain.net
If we try to connect from the command line only with the DB name and not the FQDN – the connection fails.
We would like to connect using Driver={Oracle in instantclient11_1} We tried the following connection string:
Driver={Oracle in instantclient11_1};Dbq= computerName.Domain.net:1523/ DataBaseName.computerName.Domain.net;Uid=SYS;Pwd=**** as sysdba
We got the following Error:
[Oracle][ODBC][Ora]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
What should be the right connection string for Oracle in instantclient11_1 Driver?Thanks for the confirmation.
-
SQL 2000 ODBC CONNECTION STRING FOR SQL 2008
i have vb 6 application. Database is SQL server 2000.
my connection string is (using odbc driver),
.ConnectionString = "Driver={SQL Server};SERVER=" & mServer & ";DATABASE=mydb;UID=" & mLogin.Username & ";pwd=" & mLogin.Password & ";"
Now i have tried this application with SQL server express 2008 R2
Can i still keep the old connection string? will there be any problem in future?
(if i have to change then have to change at so many places.....)
I can run application without any problem for now (not changed connection string to new one)
otherwise i have to use ODBC or OLEDB which are,
.ConnectionString = "Driver={SQL Server Native Client 10.0};SERVER=" & mServer & ";DATABASE=mydb;UID=" & mLogin.Username & ";pwd=" & mLogin.Password & ";"
or
.ConnectionString = "Provider=SQLNCLI10;SERVER=" & mServer & ";DATABASE=mydb;UID=" & mLogin.Username & ";pwd=" & mLogin.Password & ";"
if i have to change to new connection string Which one is better to use odbc or oledb.
h2007personally I favor ODBC as it is easy to use sometime. Additionally you can check the link below:
http://social.msdn.microsoft.com/Forums/en/sqlintegrationservices/thread/19e0c306-0be4-46b5-b207-0937931d63a7
cheers!!!
Vatsa
www.objectiveprogramming.com
Maybe you are looking for
-
Need advice about certification: do J2SE 1.4 or wait for 1.5 to go out?
I need advice here! I am studing for Java Programmer certification (310-035) and I know now that the certification does not have any expiration date, instead it's version based. So, if I get now a J2SE 1.4 certification, soon it will be outdated... I
-
Hi, I am getting following error while running WLST using ANT. Traceback (innermost last): File "<iostream>", line 13, in ? ImportError: no module named weblogic We have written our custom ant task to create WLST script and invoke it from there. Othe
-
Making footage in CS 5.5 with completely transparent background. How?
The footage is a man speaking. With this man speaking I want nothing else to show other than the man speaking. No background. I want it completely transparent, other than the man speaking. A good example is http://www.videotile.co.uk/ . This footage
-
I cannot play music when connect to stereo via 30-pin connector. Help?
Since I first upgraded my iPod Touch 2nd Gen to iOS 4.x, I cannot play music when connect to external speakers via the 30-pin connector. I've tried several different speaker systems, but none work. My iPod freezes after making my song selection and d
-
I have had a brief search and cannot find an explanation for this error message. Whilst attempting to run the migration wizard to migrate SSAS 2000 cubes to SSAS 2008, I receive the following error: Cannot identify the source table of the '(SELECT 0)