Set transaction statement reserving specific tables
Hello,
In the past ten years I developed on Oracle Rdb (on OpenVMS platform). In Rdb there's a possibility to reserve specific tables for shared read only, others for read write due to locking mechanisms. E.g.:
SET TRANSACTION READ WRITE RESERVING EMPLOYEES FOR PROTECTED WRITE, JOBS, SALARY_HISTORY FOR SHARED READ;
COMMIT ;Is there a similar way in 10gR2?
There was a discussion on this last year.
See Slightly off topic: Read-only tables pre 11g
Then, again, 11g supplies this "out of the box"
Hemant K Chitale
http://hemantoracledba.blogspot.com
Similar Messages
-
Number of uncommited transactions to a specific table
Hello!
Is there a way to get the number of uncommited transactions to a specific table?
Best regards
DannieHello!
The problem is that I am doing a merge from an external table, and I want to know how many rows were actually merged into the table. Before i had to merge data into the table, I could simply do a select (*) from the external table to figure out how many rows were inserted, but I dont know how to get it from a merge. It does not work to select(*) on the target table before and after the insert, as its is VERY big.
Maybe there is a way to get a merge to tell you how many rows were affected by a merge?
Suggestions?
Best regards
Dannie -
Set Transaction Variant to specific user
Hi all,
Is it possible to set a defined Transaction Variant (SHD0) to a specific user or to a user group?
I want only some users run a transaction thought the variant, and other users run thought standard transaction.
Thanks and Regards in advance.
UrtziHi Subramanian,
Do you mean that if I create a transacation variant i.e.: for the transaction AS01 called U_USERNAME would be specific for my user?
Is tha t correct?
Thanks -
SET TRANSACTION must be first statement of transaction
I am using oracle8i db with sun one 7.0. i use the oracle thin driver to talk to the db. i have bunch of session beans which uses the oracle data source. when i invoke the session bean, i get this ORA-01453 error.
Here is my jdbc properties:
<jdbc-connection-pool steady-pool-size="8" max-pool-size="32" max-wait-time-in-millis="60000" pool-resize-quantity="2" idle-timeout-in-seconds="300" is-isolation-level-guaranteed="true" is-connection-validation-required="true" connection-validation-method="table" fail-all-connections="false" datasource-classname="oracle.jdbc.xa.client.OracleXADataSource" name="JSBContainerPool" res-type="javax.sql.XADataSource" validation-table-name="dual" transaction-isolation-level="read-committed">
<property value="jdbc:oracle:thin:@muruga:1521:DEV" name="URL"/>
<property value="muruga" name="User"/>
<property value="muruga" name="Password"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" pool-name="JSBContainerPool" jndi-name="jdbc/JSBContainerDataSource"/>
Error message:
The exception reported is: "java.sql.SQLException: ORA-01453: SET TRANSACTION
must be first statement of transaction
WARNING: CORE3283: stderr: at oracle.jdbc.dbaccess.DBError.throwSqlExceptio
n(DBError.java:168)
WARNING: CORE3283: stderr: at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.j
ava:208)
WARNING: CORE3283: stderr: at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543
WARNING: CORE3283: stderr: at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Pro
tocol.java:1405)
WARNING: CORE3283: stderr: at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFet
ch(TTC7Protocol.java:822)
WARNING: CORE3283: stderr: at oracle.jdbc.driver.OracleStatement.executeNon
Query(OracleStatement.java:1446)
WARNING: CORE3283: stderr: at oracle.jdbc.driver.OracleStatement.doExecuteO
ther(OracleStatement.java:1371)
WARNING: CORE3283: stderr: at oracle.jdbc.driver.OracleStatement.doExecuteW
ithTimeout(OracleStatement.java:1900)
WARNING: CORE3283: stderr: at oracle.jdbc.driver.OracleStatement.execute(Or
acleStatement.java:737)
WARNING: CORE3283: stderr: at oracle.jdbc.driver.OracleConnection.setTransa
ctionIsolation(OracleConnection.java:1081)
WARNING: CORE3283: stderr: at com.sun.enterprise.resource.Jdbc20XaAllocator
$ConnectionWrapper.setTransactionIsolation(Jdbc20XaAllocator.java:196)In the connection pool setting in Admin server under the section Transaction Isolation deselect the option "Guarantee Isolation Level" .This should solve the problem.
regards
Kris -
Hi.
Im running JSC created application and getting in the log file this messages:
[date & time] warning (24167): CORE3238: stderr: JdbcRowSetXImpl (setTransactionIsolation): [Sun][Oracle JDBC Driver][Oracle]ORA-01453: SET TRANSACTION must be the first statement of transaction
As you may see, Im using JSC JDBC drivers. Im running on Sun One Web Server version 6.1 sp2 on Linux RedHat 3Ent. The application was builded with JSC me with latest patch applied.
It seems a bug in the JdbcRowSetXImpl.
Has someone similar problem?
Regards.Hi John.
This message is present on all log file a few days after the application began in production use, almost a month ago.
The only change done in the configuration few days after the app was deployed was "Guarantee Isolation Level" in the JDBC connection pool configuration, switched from OFF to ON.
Yesterday I turn OFF again and have no more messages about SET TRANSACTION...
I guess that the SET TRANSACTION is issued two times, one by the web server before giving the connection to the app then by the row set impl.
I will let you known if the messages appears again (I guess not).
Regards. -
How do I set a BG Image for a specific Table Cell?
Hello...
How do I set a Background Image for a specific table cell
without it affecting the main page background image?
thanks
JUse CSS -
td.special { background-image:url(foo.gif); }
will style this table cell only -
<td class="special">
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"JSloanSDRE" <[email protected]> wrote in
message
news:g2dl7n$pf5$[email protected]..
> Hello...
>
> How do I set a Background Image for a specific table
cell without it
> affecting the main page background image?
>
> thanks
> J -
Error while running query for a specific table
Hi All,
I need your help please.
I've configured everything correctly in my SCCM environment. And i used to connect the CAS database from a separate box(same domain) which has SSMS console installed in it. Now the problem is, whenever i try to run a query in CAS database locally, it runs
successfully. But when i connect the CAS database remotely and run the same query with the same login i used in CAS, it says the below error. This is happening from past 2 days only. :'(
Query ran :
select top 100 * from v_GS_WORKSTATION_STATUS
Error :
Msg 18456, Level 14, State 1, Line 1
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
OLE DB provider "SQLNCLI11" for linked server "abc.domain.com" returned message "Invalid connection string attribute".
I checked the SQL connection authentication information it says authenticated by kerberos using below query :
SELECT
s.session_id
, c.connect_time
, s.login_time
, s.login_name
, c.protocol_type
, c.auth_scheme
, s.HOST_NAME
, s.program_name
FROM sys.dm_exec_sessions s
JOIN sys.dm_exec_connections c
ON s.session_id = c.session_id
where s.host_name='servername'
Result:
136 2015-01-30 17:50:29.277 2015-01-30 17:50:29.280 domain\user TSQL KERBEROS servername Microsoft SQL Server Management Studio
But, another wierd information is i can successfully run the below query in remote.
select * from vSMS_R_System
I think that specific table is not working in remote. Pleaseeeeeeee helppp me......
Regards,
JayHi JaySmiley,
According to your description, you get the logon issue when connecting to CAS database remotely and execute query. Right?
In this scenario, this error can happen when the SPN account is registered without setting 'trusted for delegation' property. Account must be trusted for delegation in order for Kerberos delegation to succeed. Here's a blog talking about your scenario, please
refer to the link below:
http://blogs.technet.com/b/umairkhan/archive/2013/10/19/the-distributed-views-do-not-get-created-in-configmgr-2012-sp1-because-of-the-login-issue.aspx
If you have any question, please feel free to ask.
Simon Hou
TechNet Community Support -
Is "SET TRANSACTION USE ROLLBACK SEGMENT" only a hint
I have two users, one makes some inserts in a table.
The other makes a select which visits many rows.
I have a big rollback-segment.
To ensure, both users use this rollback-segment I created a logon-trigger:
CREATE OR REPLACE TRIGGER a_logon AFTER LOGON
ON DATABASE
WHEN ( USER IN ( 'SCOTT', 'BOB' ) )
BEGIN
SET TRANSACTION USE ROLLBACK SEGMENT rbs_big;
END;
But I still get "snapshot to old" messages from the select, which contains the name off an other rollback-segment in the message.
The trigger really fires, i tested it by adding an insert-statement to a log-table.
What`s wrong ?The set transaction use rollback segment lasts only until you commit or rollback first time and all other transactions in that session will not be forced to that rbs anymore. Other possible solution could be that other users are accessing same tables / updating them so those sessions can't keep the read consistent image available anymore for your sessions.
-
What is the exact purpose of Transaction NACE and NAST Table?
Hi All,
What is the exact purpose of Transaction NACE and NAST Table?
Pls help me
Akshitha.Hi
When a Output type in an apllication doc is configured with a Medium, Partner, Lang and other communication paramters an entry is created in NAST table
so to trigger the output an entry in NAST is compulsory
Output is a link between the Driver Program and the Sapscript,
An output type summarizes messages of the same meaning. It contains parameters that are valid for all its assigned messages, for example appropriate partner functions.
Transmission medium is a medium which the layout will be come out, this may be printout, Fax or Mail
Check this link.
http://help.sap.com/saphelp_nw2004s/helpdata/en/c8/19884743b111d1896f0000e8322d00/content.htm
ex-how to config output type.
You will assign output types using Transaction NACE.
Do the follow steps to assign output type
1)Select Application Type V2 which will have description Shipping.
2)Click on Output types button.
3)Go to change mode by pressing Ctrl+F4.
4)Select one output type which already exists
5)Do Copy As(F6)
6)Give your output type against Output Type field.
7)Under General data Tab, Give Program and Form routine and Save the data.
i think it a work of functional guy but at senior level i think it is not a big deal for abaper.
Check the following documentation
In NACE t-codewe have the application for each one. based on the application output type can be defined, based on output type script and print progrma can be defined.
If suppose data can be read from EDI then we should go for condition records.
So whenever we execute the script first composer checks the output type and then execute the program. in program whenever opn form FM will be populate then script will open first. After that again program till another FM will populate if it then script will populate........like it is cycle proces. Composer does all these things and at last it will submit that output to spool.
Go to the Transaction NACE.
choose the related sub module.. like billing or shipping
doubel click on Output Types
Choose the Output Type for which whcih you wanted your script to trigger
Then select the Output Type and double click on Processing Routine
Then go to create new entries--> Select the Medium (1- print output), then enter your Script and Print Program detls --> Save and come out
Now go to the Transaction (for which you have created the output type)... Issue output--> Select the output type --> Print....
Device Types for SAP Output Devices (Detail Information)
Definition
The device type indicates the type of printer to be addressed. When you define an output device, choose the name of the device type that was defined in the SAP System for your printer model, such as Post2 for a PostScript printer. In the case of frontend printing under Microsoft Windows, you can also use the generic (device-independent) device type SWIN.
The system uses the information in the device type to convert a document from the internal SAP character representation (spool request in OTF or in text format) to a device-specific, print-ready data stream (output request). Since a device type specifies attributes that apply to all devices of a certain model, it can be shared among device definitions. For example, all devices in the SAP spool system that are compatible with Hewlett-Packard LaserJet IIID printers would use the HPLJIIID device type.
You should not confuse the device type with the printer driver. The device type is the total of all attributes of an output device that the SAP System must know to control the output device correctly, such as control commands for font selection, page size, character set selection, and so on. These attributes also include the printer driver that SAPscript/Smart Forms (the SAP form processor) should use for this printer. The SAPscript printer driver that is to be used for devices of this type for output formatting is therefore only an attribute that the device type specifies.
How do I choose the correct device type?
In most cases, the SAP System already provides the appropriate device type for the printer type for the printer model that you want to use.
These standard device types are completely defined and need no modification or extension before you use them in device definitions.
You can also download missing device types from the sapserv server. For a current list of the supported device types, see SAP Note 8928 in the SAP Service Marketplace.
Most printers can be controlled using a generic format, such as PostScript. They can be switched to a mode that is compatible with one of the standard printers for which an SAP device type is available. In this case, a supported model is emulated.
Almost all printers are delivered with Microsoft Windows printer drivers. The system can control these printers with the generic (device-independent) device type SWIN. The Microsoft Windows spool system then performs the processing of the print data.
If the specified device types are not available, and generic device types cannot be used, you must create your own device type or edit a copy of an existing device type. We recommend that only those with specialist knowledge of the SAP Spool System and printer driver code do this. For more information, see Defining a New Device Type .
Attributes of a Device Type
A device type is distinguished by the attributes listed below. If you change an existing device type or create a new device type, you must change at least some of these attributes.
Character set: A character set specifies the codes with which characters must be represented in the print-ready output stream (output request). This code replaces the generic SAP characters set that is used internally by the SAP spool system (spool request).
Printer driver: You can specify different printer drivers for printing SAPscript documents and ABAP lists.
Print controls: Print controls represent printer operations, such as boldface or changing the font size. These print control are replaced by printer-specific commands during the creation of the output request from a spool request.
Formats: Formats specify the format supported by the SAP system. The system differentiates between SAPScript formats (DINA4 and LETTER) and ABAP list formats (X_65_132 = 65 rows/132 columns).
Page format: A page format is the interface between a format and SAPscript. It specifies the paper dimensions with which SAPScript can calculate the row and column lengths.
Actions: Actions are output device-specific commands that are required for the implementation of a format. The action printer initialization, for example, can contain a printer command with which the number of rows on a page is defined. There is a set of actions for every format supported by a device type.
Reward points for useful Answers -
How can I identify reports that use specific tables
Hi, is there a way that I can identify the reports that select from specific tables? We have 3,000 reports in business object enterprise XI R2 SP5. and we're trying to identify all the reports that use a specific table.
Or if you have a developer in Java or .NET available you can write one. Fairly simple to get the info.
In .NET you would open each report, write the name of the report to a log file with the output of the SQL Statement:
Using RAS as the report engine.
GroupPath gp = new GroupPath();
string tmp = String.Empty;
rptClientDoc.RowsetController.GetSQLStatement(gp, out tmp);
MessageBox.Show(tmp, "Data Source Set and SQL Statement", MessageBoxButtons.OK, MessageBoxIcon.Information);
If you want more details is is available with a few more lines of code. The above would only show you what is used in the report.
I don't believe there is a BOE tool that can do this but they may have one.
Here's a link to the BOE Admin forum: BI Platform
Thank you
Don -
Setting transaction isolation level rises ORA-02089 error
Hello
We have configured a distributed transaction in our application server and
we are using openjpa 1.2.1 and Glassfish application server and Oracle 11g as DB server. Although the default behavior of transaction locking must be optimistic,
it seems that pessimistic locking has been happened.
It is found that Row Lock contention happens in a specific table.
This is the exception :
java.sql.SQLException: ORA-02049: timeout: distributed transaction waiting for lock
Already all the following properties have been set for openjpa.
1. <persistence-unit name="JPXA" transation-type="JTA">
2. <property name="openjpa.TransactionMode" value="managed"/>
You can try a plug-in string to lookup the TM in JNDI (the value is the JNDI name of GlassFish TM as per Google search)
3. <property name="openjpa.ManagedRuntime"
value="jndi(TransactionManagerName=java:appserver/TransactionManager)"/>
Following searching about this locking problem, we found that we should add two more properties for openjpa as listed below.
<property name="openjpa.LockManager" value="version" />
<property name="openjpa.jdbc.TransactionIsolation" value="read-committed" />
but this time by setting the transaction isolation level, we have got another error: org.apache.openjpa.persistence.PersistenceException: ORA-02089: COMMIT is not allowed in a subordinate session.
Thanks for any help.
Regards,
SargolHello
We have configured a distributed transaction in our application server and
we are using openjpa 1.2.1 and Glassfish application server and Oracle 11g as DB server. Although the default behavior of transaction locking must be optimistic,
it seems that pessimistic locking has been happened.
It is found that Row Lock contention happens in a specific table.
This is the exception :
java.sql.SQLException: ORA-02049: timeout: distributed transaction waiting for lock
Already all the following properties have been set for openjpa.
1. <persistence-unit name="JPXA" transation-type="JTA">
2. <property name="openjpa.TransactionMode" value="managed"/>
You can try a plug-in string to lookup the TM in JNDI (the value is the JNDI name of GlassFish TM as per Google search)
3. <property name="openjpa.ManagedRuntime"
value="jndi(TransactionManagerName=java:appserver/TransactionManager)"/>
Following searching about this locking problem, we found that we should add two more properties for openjpa as listed below.
<property name="openjpa.LockManager" value="version" />
<property name="openjpa.jdbc.TransactionIsolation" value="read-committed" />
but this time by setting the transaction isolation level, we have got another error: org.apache.openjpa.persistence.PersistenceException: ORA-02089: COMMIT is not allowed in a subordinate session.
Thanks for any help.
Regards,
Sargol -
Can I run a Unix shell when insert some record on a specific table?
Can I run a Unix shell when insert some record on a specific table?
I need to run a Unix shell when a record be insert on a table. Is there a way in order to do that?
THanks,
Carlos.1. Make a backup of the extproc.c file in the c:\orant\rdbms80\extproc
directory.
2. Create a file called extern.c in the c:\orant\rdbms80\extproc directory.
The "extern.c" file :
#include <oci.h>
#define NullValue -1
#include<stdio.h>
#include<string.h>
long __declspec(dllexport) OutputString(context ,
path , path_ind ,
message , message_ind,
filemode , filemode_ind ,
len , len_ind )
char *path;
char *message;
char *filemode;
int len;
OCIExtProcContext *context;
short path_ind;
short message_ind;
short filemode_ind;
short len_ind;
FILE *file_handle;
int i ;
char str[3];
int value;
/* Check whether any parameter passing is null */
if (path_ind == OCI_IND_NULL || message_ind == OCI_IND_NULL ||
filemode_ind == OCI_IND_NULL || len_ind == OCI_IND_NULL ) {
text initial_msg = (text )"One of the Parameters Has a Null Value!!! ";
text *error_msg;
/* Allocate space for the error message text, and set it up.
We do not have to free this memory - PL/SQL will do that automatically. */
error_msg = OCIExtProcAllocCallMemory(context,
strlen(path) + strlen(initial_msg) + 1);
strcpy((char *)error_msg, (char *)initial_msg);
/*strcat((char *)error_msg, path); */
OCIExtProcRaiseExcpWithMsg(context, 20001, error_msg, 0);
/* OCIExtProcRaiseExcp(context, 6502); */
return 0;
/* Open the file for writing. */
file_handle = fopen(path, filemode);
/* Check for success. If not, raise an error. */
if (!file_handle) {
text initial_msg = (text )"Cannot Create file ";
text *error_msg ;
/* Allocate space for the error message text, and set it up.
We do not have to free this memory - PL/SQL will do that automatically. */
error_msg = OCIExtProcAllocCallMemory(context,
strlen(path) + strlen(initial_msg) + 1);
strcpy((char *)error_msg, (char *)initial_msg);
strcat((char *)error_msg, path);
OCIExtProcRaiseExcpWithMsg(context, 20001, error_msg, 0);
return 0;
i = 0;
while (i < len)
/* Read the hexadecimal value(1). */
str[0] = message;
i++;
/* Read the hexadecimal value(2). */
str[1] = message[i];
/* Convert the first byte to the binary value. */
if (str[0] > 64 && str[0] < 71)
str[0] = str[0] - 55;
else
str[0] = str[0] - 48;
/* Convert the second byte to the binary value. */
if (str[1] > 64 && str[1] < 71)
str[1] = str[1] - 55;
else
str[1] = str[1] - 48;
/* Convert the hex value to binary (first & second byte). */
value = str[0] * 16 + str[1];
/* Write the binary data to the binary file. */
fprintf(file_handle,"%c",value);
i++;
/* Output the string followed by a newline. */
/* fwrite(message,len,1,file_handle); */
/* Close the file. */
fclose(file_handle);
3. Use the make.bat available in the c:\orant\rdbms80\extproc directory. You
need to run vcvars32.bat file before running this batch file. This will
create a dll file.
4. Configure the tnsnames.ora and the listener.ora files.
The tnsnames.ora should contain the following entries.
extproc_connection_data.world =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = IPC)
(KEY = ORCL)
(CONNECT_DATA = (SID = extproc)
The listener.ora should contain the following entries.
# P:\ORANT\NET80\ADMIN\LISTENER.ORA Configuration File:p:\orant\net80\admin\listener.ora
# Generated by Oracle Net8 Assistant
LISTENER8 =
(ADDRESS = (PROTOCOL = TCP)(HOST = winnt_nsc)(PORT = 1521))
SID_LIST_LISTENER8=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = winnt_nsc)
(SID_NAME = ORCL)
(SID_DESC =
(SID_NAME = extproc)
(PROGRAM = extproc)
5. Login from sqlplus and issue the following statements.
create library externProcedures as 'C:\orant\RDBMS80\EXTPROC\extern.dll';
Create or replace PROCEDURE OutputString(
p_Path IN VARCHAR2,
p_Message IN VARCHAR2,
p_mode in VARCHAR2,
p_NumLines IN BINARY_INTEGER) AS EXTERNAL
LIBRARY externProcedures
NAME "OutputString"
With context
PARAMETERS (CONTEXT,
p_Path STRING,
p_path INDICATOR,
p_Message STRING,
p_message INDICATOR,
p_mode STRING,
p_mode INDICATOR,
p_NumLines INT,
p_numlines INDICATOR);
This is the pl/sql block used to write the contents of the BLOB into a file.
Set serveroutput on before running it.
SQL> desc lob_tab;
Name Null? Type
C1 NUMBER
C2 BLOB
lob_tab is the table which contains the blob data.
declare
i1 blob;
len number;
my_vr raw(10000);
i2 number;
i3 number := 10000;
begin
-- get the blob locator
SELECT c2 INTO i1 FROM lob_tab WHERE c1 = 2;
-- find the length of the blob column
len := DBMS_LOB.GETLENGTH(i1);
dbms_output.put_line('Length of the Column : ' || to_char(len));
-- Read 10000 bytes at a time
i2 := 1;
if len < 10000 then
-- If the col length is < 10000
DBMS_LOB.READ(i1,len,i2,my_vr);
outputstring('p:\bfiles\ravi.bmp',rawtohex(my_vr),'wb',2*len);
-- You have to convert the data to rawtohex format. Directly sending the buffer
-- data will not work
-- That is the reason why we are sending the length as the double the size of the data read
dbms_output.put_line('Read ' || to_char(len) || 'Bytes');
else
-- If the col length is > 10000
DBMS_LOB.READ(i1,i3,i2,my_vr);
outputstring('p:\bfiles\ravi.bmp',rawtohex(my_vr),'wb',2*i3);
dbms_output.put_line('Read ' || to_char(i3) || ' Bytes ');
end if;
i2 := i2 + 10000;
while (i2 < len ) loop
-- loop till entire data is fetched
DBMS_LOB.READ(i1,i3,i2,my_vr);
dbms_output.put_line('Read ' || to_char(i3+i2-1) || ' Bytes ');
outputstring('p:\bfiles\ravi.bmp',rawtohex(my_vr),'ab',2*i3);
i2 := i2 + 10000 ;
end loop;
end; -
One of our customers starts to encounter this error message recently.
We checked our log files. It seems that the error happens when
to obtain a jdbc connection. Have anyone seen similar problems
and knows how to fix it? thanks in advance.
We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
The functions that invoke the jdbc calls are stateless session bean
methods with their transaction attributes marked as Required.
There is no nested calls of these methods.
A partial stack trace we obtained is as following:
java.sql.SQLException: No JDBC connection can be made
because the transaction state is
Marked Rollback
at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)
at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
lixinJoseph Weinstein <[email protected]> wrote:
>
>
YuanHui Liu wrote:
Joe,
We got the exact same error message. The error came after we got theJDBC connection,
and trying to create statement off it.
It occurs intermitently when we are running another standalone JAVAapp to do
some end of day work, which results in the DB Server being very busy(90+%CPU
usage) for about 5 minutes. We see a surge of requests to the WLSJDBC Connection
pool. This would sometimes result in all our subsequent DB requeststo fail and
lead to a crash.
We are using WLS6.0SP1. I do not think there's a 30 seconds wait leadingto a
connection timeout that caused this(rather it is the end effect).
Can you give us a more detailed explanation? Is there a miscommunicationbetween
our DB(Sybase12) and WLS?Hi. It looks to you like it's after you get the connection, but really
it's when the server is
gettng the pool connection. For performance/synchronization reasons we
do a clever
delay: When your code asks for a pool connection we quickly give you
the pool wrapper,
but we delay actually reserving the real underlying DBMS connection until
your first
real need for a connection, at your first JDBC call, such as createStatement()
etc.
It is while waiting for a pool connection long enough for the transaction
coordinator
to have timed you out before you ever get a chance. It's nothing to do
with the
DBMS or even JDBC, I believe. I think the weblogic server either has
too few execute-threads
and/or too few CPU cycles to do the work load.
Okay, so there's a lazy initialization of the connection.
From reading our log I believe our failur is immediate rather
than waiting for 30+ seconds(the default setting) from the DB,
the timeout occurred later as a result. At the time either because the DB Server
is very busy.
Since we are running WLS6.0 we have only one connection pool,
we have defined a max of 150 threads in the pool. While this
is happening the DB Server is being pinned by an overnight job,
but the WLS Server is not busy at all. The DB and WLS resides
on different physical boxes.
We also have a thread dump from the WLS console when we rebooted the server, it
showed that we are hanging on to the thread & jdbc
connections after these exceptions has occurred instead of releasing them, note
"16083"(~4.5 hours) seconds has passed:
142 116222 Retry rollback request for tx: 'transaction=(IdHash=2963855,Name =
[EJB UserManagerBeanImpl.signalICUserServletHeartBeat()],Xid=30643:8f3838f3709bf53d,Status=Rolling
Back. [Reason = Unknown],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since
begin=16083,seconds left=10,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=server),SCInfo[server]=(state=active),properties=({weblogic.jdbc=t3://159.55.158.25:8005,
weblogic.transaction.name=[EJB UserManagerBeanImpl.signalICUserServletHeartBeat()]}))'
Scheduled Trigger
So I would argue this problem actually chewed up resources on the WLS server.
-Yuanhui Liu
>>
>>
Thanks.
-YuanHui Liu
Joseph Weinstein <[email protected]> wrote:
lixin wrote:
One of our customers starts to encounter this error message recently.
We checked our log files. It seems that the error happens when
to obtain a jdbc connection. Have anyone seen similar problems
and knows how to fix it? thanks in advance.
We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
The functions that invoke the jdbc calls are stateless session bean
methods with their transaction attributes marked as Required.
There is no nested calls of these methods.
A partial stack trace we obtained is as following:
java.sql.SQLException: No JDBC connection can be made
because the transaction state is
Marked Rollback
at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)Hi. This sounds like a JVM thread starvation issue, and/or a server
load
issue. What is
happening is that the transaction is started, and times out beforethe
SSB even gets to
the first JDBC work. I would first verify that the customer is using
the very latest JVM
available for the machine.
Joe Weinstein
at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
lixin -
Invalid transaction state when using CMR
I've code a method which involves CMR in CMP. It's a many to many relationship. Initially I was using JBoss 4 which supports EJB 2.1. Now, I'm migrating to OC4J Standalone 10.1.2 which supports only EJB 2.0. I get the error below whenever I call the method that use this CMR.
05/04/25 17:48:15 Error in bean SBFap
java.lang.IllegalStateException: Invalid transaction state, see chapter 10 of the EJB 2.0 specification
at EBFapLocal_EBFunctionLocal_ORCollection99.checkScope(EBFapLocal_EBFunctionLocal_ORCollection99.java:54)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.ejb.ORCollection.iterator(ORCollection.java:97)
at com.infopro.dt.app.fap.ejb.SBFap.getAllFunction(SBFap.java:343)
at SBFapLocal_StatelessSessionBeanWrapper22.getAllFunction(SBFapLocal_StatelessSessionBeanWrapper22.java:343)
at com.infopro.dt.app.accesscontrol.ejb.SBAccessControl.getAllFunctionsOfFap(SBAccessControl.java:427)
at com.infopro.dt.app.accesscontrol.ejb.SBAccessControl.getUserFunction(SBAccessControl.java:407)
at SBAccessControlRemote_StatelessSessionBeanWrapper48.getUserFunction(SBAccessControlRemote_StatelessSessionBeanWrapper48.java:1050)
at com.infopro.dt.ui.bizdelegate.AccessControlDelegate.getUserFunction(AccessControlDelegate.java:199)
at com.infopro.dt.ui.accesscontrol.web.LoginBean.admin_login(LoginBean.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at net.sourceforge.myfaces.custom.fileupload.MultipartFilter.doFilter(MultipartFilter.java:88)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)Please advise on what is the problem. What is the differences in many to many replationship of CMR in EJB 2.1 compared to EJB 2.0.
Thanks in advance.Ok, I needed to help myself and this is what I found out:
If the table already contains records, it is not enough to doresult.moveToInsertRow();but I must beresult.last();
result.moveToInsertRow();I didn't find any explanation and even the code examples from the Sun tutorial don't mention this, so I guess it's a bug occurring in my poor IT environment: DB server running mySQL 5.0.0-alpha on a P1-233-MMX w/ 64MB under WinNT4 (hey don't laugh!!^^).
Maybe this information is of use to someone having similar problems...
Greetings!
reinski -
Sql statement in a table not accepting variable
I have the following problem on 10.1.0.3.0 with varialbe in an execute immediate statement
here is the code that I am using
declare
remote_data_link varchar2(25) := 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA VARCHAR2(40) := 'UDE_OLTP';
l_last_process_date date := to_date(to_char(sysdate,'mm-dd-yyyy hh:mi:ss'),'mm-dd-yyyy hh:mi:ss') - 1;
stmt varchar2(4000) := 'MERGE into applicant_adverseaction_info theTarget USING (select * from '||FROM_SCHEMA||'.applicant_adverseaction_info@'||remote_data_link||' where last_activity > :l_last_process_date ) theSource ON(theTarget.applicant_id = theSource.applicant_id) WHEN MATCHED THEN UPDATE SET theTarget.cb_used = theSource.cb_used, theTarget.cb_address = theSource.cb_address, theTarget.scoredmodel_id = theSource.scoredmodel_id, theTarget.last_activity = theSource.last_activity WHEN NOT MATCHED THEN INSERT(CB_USED, CB_ADDRESS, SCOREDMODEL_ID, APPLICANT_ID, LAST_ACTIVITY) values(theSource.cb_used, theSource.cb_address, theSource.scoredmodel_id, theSource.applicant_id, theSource.last_activity)';
stmt2 varchar2(4000) := 'MERGE into edm_application theTarget USING (select * from '||from_schema||'.edm_application@'||remote_data_link||' where last_activity > :l_last_process_date) theSource ON (theTarget.edm_appl_id = theSource.edm_appl_id) WHEN MATCHED THEN UPDATE SET theTarget.APP_REF_KEY = theSource.APP_REF_KEY, theTarget.IMPORT_REF_KEY = theSource.IMPORT_REF_KEY, theTarget.LAST_ACTIVITY = theSource.LAST_ACTIVITY WHEN NOT MATCHED THEN INSERT (EDM_APPL_ID, APP_REF_KEY, IMPORT_REF_KEY, LAST_ACTIVITY) values(theSource.EDM_APPL_ID, theSource.APP_REF_KEY, theSource.IMPORT_REF_KEY, theSource.LAST_ACTIVITY)';
v_error varchar2(4000);
T_MERGE VARCHAR2(4000);
stmt3 varchar2(4000);
BEGIN
select merge_sql
INTO T_MERGE
from transfertables
where table_name= 'edm_application';
remote_data_link:= 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA := 'UDE_OLTP';
--DBMS_OUTPUT.PUT_LINE(SUBSTR(stmt2,1,200));
--STMT2 := T_MERGE;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
EXECUTE IMMEDIATE stmt2 using l_last_process_date;
--execute immediate stmt3 ;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
dbms_output.put_line(substr(stmt2,1,200));
commit;
EXCEPTION
WHEN OTHERS THEN
V_ERROR := SQLCODE||' '||SQLERRM;
v_ERROR := V_ERROR ||' '||SUBSTR(stmt2,1,200);
DBMS_OUTPUT.PUT_LINE(V_ERROR);
--dbms_output.put_line(substr(stmt2,1,200));
END;
This works perfectly
but if I change it to get the same statement in a db table
declare
remote_data_link varchar2(25) := 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA VARCHAR2(40) := 'UDE_OLTP';
l_last_process_date date := to_date(to_char(sysdate,'mm-dd-yyyy hh:mi:ss'),'mm-dd-yyyy hh:mi:ss') - 1;
stmt varchar2(4000) := 'MERGE into applicant_adverseaction_info theTarget USING (select * from '||FROM_SCHEMA||'.applicant_adverseaction_info@'||remote_data_link||' where last_activity > :l_last_process_date ) theSource ON(theTarget.applicant_id = theSource.applicant_id) WHEN MATCHED THEN UPDATE SET theTarget.cb_used = theSource.cb_used, theTarget.cb_address = theSource.cb_address, theTarget.scoredmodel_id = theSource.scoredmodel_id, theTarget.last_activity = theSource.last_activity WHEN NOT MATCHED THEN INSERT(CB_USED, CB_ADDRESS, SCOREDMODEL_ID, APPLICANT_ID, LAST_ACTIVITY) values(theSource.cb_used, theSource.cb_address, theSource.scoredmodel_id, theSource.applicant_id, theSource.last_activity)';
stmt2 varchar2(4000) := 'MERGE into edm_application theTarget USING (select * from '||from_schema||'.edm_application@'||remote_data_link||' where last_activity > :l_last_process_date) theSource ON (theTarget.edm_appl_id = theSource.edm_appl_id) WHEN MATCHED THEN UPDATE SET theTarget.APP_REF_KEY = theSource.APP_REF_KEY, theTarget.IMPORT_REF_KEY = theSource.IMPORT_REF_KEY, theTarget.LAST_ACTIVITY = theSource.LAST_ACTIVITY WHEN NOT MATCHED THEN INSERT (EDM_APPL_ID, APP_REF_KEY, IMPORT_REF_KEY, LAST_ACTIVITY) values(theSource.EDM_APPL_ID, theSource.APP_REF_KEY, theSource.IMPORT_REF_KEY, theSource.LAST_ACTIVITY)';
v_error varchar2(4000);
T_MERGE VARCHAR2(4000);
stmt3 varchar2(4000);
BEGIN
select merge_sql
INTO T_MERGE
from transfertables
where table_name= 'edm_application';
remote_data_link:= 'UDE_DATATRANSFER_LINK';
FROM_SCHEMA := 'UDE_OLTP';
--DBMS_OUTPUT.PUT_LINE(SUBSTR(stmt2,1,200));
STMT2 := T_MERGE;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
EXECUTE IMMEDIATE stmt2 using l_last_process_date;
--execute immediate stmt3 ;
dbms_output.put_line(from_schema||' '||remote_data_link||' '||l_last_process_date);
dbms_output.put_line(substr(stmt2,1,200));
commit;
EXCEPTION
WHEN OTHERS THEN
V_ERROR := SQLCODE||' '||SQLERRM;
v_ERROR := V_ERROR ||' '||SUBSTR(stmt2,1,200);
DBMS_OUTPUT.PUT_LINE(V_ERROR);
--dbms_output.put_line(substr(stmt2,1,200));
END;
I get ora-00900 invalid sql statement
can somebody explain why this happens
ThanksI agree with jan and anthony. Your post is too long and ill-formatted. However here's my understanding of your problem (with examples though slightly different ones).
1- I have a function that returns number of records in a any given table.
1 CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 BEGIN
5 EXECUTE IMMEDIATE('SELECT count(*) FROM '||p_table) INTO v_cnt;
6 RETURN v_cnt;
7* END;
SQL> /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
GET_COUNT('EMP')
14
2- I decide to move the statement to a database table and recreate my function.
SQL> CREATE TABLE test
2 (stmt varchar2(2000))
3 /
Table created.
SQL> INSERT INTO test
2 VALUES('SELECT count(*) FROM p_table');
1 row created.
SQL> CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 v_stmt varchar2(4000);
5 BEGIN
6 SELECT stmt INTO v_stmt
7 FROM test;
8 EXECUTE IMMEDIATE(v_stmt) INTO v_cnt;
9 RETURN v_cnt;
10 END;
11 /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
SELECT get_count('emp')
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SCOTT.GET_COUNT", line 8
ORA-06512: at line 1
--p_table in the column is a string and has nothing to do with p_table parameter in the function. And since there's no p_table table in my schema function returns error on execution. I suppose this is what you mean by "sql statement in a table not accepting variable"
3- I rectify the problem by recreating the function.
1 CREATE OR REPLACE FUNCTION get_count(p_table varchar2)
2 RETURN NUMBER IS
3 v_cnt number;
4 v_stmt varchar2(4000);
5 BEGIN
6 SELECT replace(stmt,'p_table',p_table) INTO v_stmt
7 FROM test;
8 EXECUTE IMMEDIATE(v_stmt) INTO v_cnt;
9 RETURN v_cnt;
10* END;
SQL> /
Function created.
SQL> SELECT get_count('emp')
2 FROM dual
3 /
GET_COUNT('EMP')
14
Hope this gives you some idea.-----------------------
Anwar
Maybe you are looking for
-
My LAN works ok, but it says its only 100.0 mbs not 1000.0, also in my BIOS there is no option for "onboard giga lan" like it says in the manuel. What is going on here?
-
How to use LIKE operator with PreparedStatement
Hi, I need to execute a query with the LIKE operator, but using a PreparedStatement. Can I do this, and if so what must my SQL look like with the wildcard characters '%' or '_'? normal PS example: conn.prepareStatement("select * from mytable where na
-
Error in replacing script in the editing page properties of Oehr_Depatment sample
Hi Forum, I downloaded and imported the Oehr sample objects to repeat tutorials. The tutorial instructed me to scroll to the Source on the Region Definition page and replace the content on the Department report region (i.e. select "DEPARTMENT_ID", "D
-
Why can I only receive but not reply to group text conversations? It will keep trying to send until it finally says failed.
-
Captivate 7 keeps freezing while working/editing courses
Hi, Every 10 minutes or so Captivate 7 keeps freezing regularly (for about 20 seconds)! This happens while working on courses or editing slides (backend). I used Captivate 4-6 on the same machine without any problems.. Very seldom an error message ap