niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle » Server
ORA-00937 when CURSOR_SHARING=FORCE
Post new topic   Reply to topic Page 1 of 1 [9 Posts] View previous topic :: View next topic
Author Message
fmons@ayto-santander.es
*nix forums beginner


Joined: 21 Dec 2005
Posts: 4

PostPosted: Wed Dec 21, 2005 8:36 am    Post subject: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

Hello,

I have read about the use of bind variables and how dramatically it can
inprove the performance on the Database servers.

Unafortunatelly I have several applications running against my Oracle
servers that doesn't make good use of this feature. In most of the
cases they simply don't work with bind variables at all.

Afortunatelly, Oracle has a init parameter that considers this
problematic, and internally manages all the similar SQLs implementing
on them bind variables.

This parameter is to set Cursor_Sharing=Force

My problem is that when i set this parameter some SQLs that before the
change where working, now they don't. The error that Oracle is raisng
is the ORA-00937: not a single-group group function.

One of the SQL's that is raising the error is the following:

Select Count(*) as Total From IINEHABIT Where
IgCargasM='00000CRGM001000176'

Thanks in advance.

Regards,
Fernando Mons.
Back to top
fmons@ayto-santander.es
*nix forums beginner


Joined: 21 Dec 2005
Posts: 4

PostPosted: Wed Dec 21, 2005 8:55 am    Post subject: Re: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

Sorry,

I forgot some details about the problem:

1. I'm using Oracle 9.2.0.1.0
2. The errors dissapear when I return this parameter to the EXACT
value.
3. The error doesn't repoduce in sql*plus, only takles place in the
applications.

I hope you can help with this issue.

Thanks.
Back to top
sybrandb@yahoo.com
*nix forums Guru


Joined: 30 May 2005
Posts: 482

PostPosted: Wed Dec 21, 2005 9:02 am    Post subject: Re: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

You can several things
- search for this error on Metalink. As I have the feeling it is a bug
you'll need
- to upgrade to 9.2.0.6.0 at least
Alternatively you could trace the affected session and search for
err=937
in your trace file, and watch the *exact* statement resulting in this
error.
You could also do the following (in sql*plus)
variable x varchar2(...)
begin
Mad := '<your value>';
end;
/
Select Count(*) as Total From IINEHABIT Where
IgCargasM=Mad
/
To verify whether this behavior occurs with a *true* bind variable
(sql*plus doesn't use bind variables by default, so it MUST use the
same mechanism as in the affected program)

Hth

--
Sybrand Bakker
Senior Oracle DBA
Back to top
fmons@ayto-santander.es
*nix forums beginner


Joined: 21 Dec 2005
Posts: 4

PostPosted: Wed Dec 21, 2005 9:26 am    Post subject: Re: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

Hi Sybrand,

Thanks for your fast info.

I have some doubts about your answers:

You said:

"Alternatively you could trace the affected session and search for
err=937
in your trace file"

And I say:

I didn't know that tracing application SQLs with Oracle was
possible!!!! Can you give me some information about tracing or a link
to read about it??


I also have searched on metalink as a first resource but nothing found,
so I come to this forum by recomdation of Aktom.com
Back to top
sybrandb@yahoo.com
*nix forums Guru


Joined: 30 May 2005
Posts: 482

PostPosted: Wed Dec 21, 2005 10:11 am    Post subject: Re: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

Hi Fernando

Amongst others

http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_23a.htm#2141496

to set trace for the complete instance.
You could use dbms_system.set_sql_trace_in_session(sid, serial#,
true|false) to enable trace for a specific session (documented on
http://tahiti.oracle.com)

You could also dump the errorstack for error 937 (to see the exact
statement in error), but the syntax varies by error.
Further details usually on Metalink.
The command is something like
alter system set events="937 trace name errorstack, level 1"

And then of course you could create an after logon trigger on the
affected schema, to make sure there is an
execute immediate 'alter session set sql_trace=true' run automatically.

Hth
--
Sybrand Bakker
Senior Oracle DBA
Back to top
bdbafh@gmail.com
*nix forums Guru


Joined: 18 Jul 2005
Posts: 322

PostPosted: Wed Dec 21, 2005 1:36 pm    Post subject: Re: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

One item that deserves mentioning, is that hinting the problematic
statement with

/*+ cursor_sharing_exact */

should take care of this issue, without requiring that
cursor_sharing=exact be set session-wide.

I've seen this type of issue before on 10.1.0.3 on win32. It was fixed
in 10.1.0.4.

IMHO, base releases of the product really aren't for production use -
they're for testing.
The 9i R2 release wasn't "ready" until 9.2.0.4.

If you have metalink access check the readme.html for the 9.2.0.7
patchset and you'll likely see fixes listed for this class of error.

hth.
-bdbafh
Back to top
fmons@ayto-santander.es
*nix forums beginner


Joined: 21 Dec 2005
Posts: 4

PostPosted: Thu Dec 22, 2005 1:01 pm    Post subject: Re: ORA-00937 when CURSOR_SHARING=FORCE Reply with quote

I am going to upgrade my server to Patchset 9.2.0.7, to try to solve
it. Until then I will not use this parameter with the FORCE value.

Thanks for your info. It was very helpful for me.

Regars,
F.Mons
Back to top
ricardao
*nix forums beginner


Joined: 26 Sep 2007
Posts: 2

PostPosted: Wed Sep 26, 2007 9:25 pm    Post subject: CURSOR_SHARING and MSDAORA driver
Subject description: ORA-00937 when change CURSOR_SHARING to FORCE or SIMILAR
Reply with quote

You can set CURSOR_SHARING to SIMILAR or FORCE

But, for SQL statments that use group clauses (like SUM, COUNT) you need to set some parameters in your ado connection (MSDAORA driver) to avoid this problem:

LockType = adLockReadOnly
CursorType = adOpenForwardOnly
Back to top
ricardao
*nix forums beginner


Joined: 26 Sep 2007
Posts: 2

PostPosted: Wed Sep 26, 2007 9:32 pm    Post subject: CURSOR_SHARING AND ORA-00937 Reply with quote

information...

When the CURSOR_SJARING is set to SIMILAR or FORCE, MSDAORA driver detect and modify your SQL statement, like this:

Original:
SELECT COUNT(*) FROM some_table;

Modified by driver:

SELECT COUNT(*), some_table.rowid FROM some_table;

this cause the error ORA-00937, becouse of the lack of GROUP BY at the end of statement.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [9 Posts] View previous topic :: View next topic
The time now is Thu Aug 28, 2008 5:48 pm | All times are GMT
navigation Forum index » Databases » Oracle » Server
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts I need to configure DHCP server to force client to obtain... malazc@gmail.com networking 1 Thu Jul 20, 2006 8:44 pm
No new posts Force linker to check all the implementation toton C++ 1 Thu Jul 20, 2006 6:08 am
No new posts force delivery alexis Exim 0 Mon Jul 17, 2006 3:53 pm
No new posts Force kill a process? Hans du Plooy Debian 14 Tue Jul 11, 2006 1:30 pm
No new posts Q: How to "force" HTTP 503 when Apache hits MaxClients James W. Anderson Apache 2 Sat Jul 08, 2006 5:28 pm

Debt Management | Wills | Mortgage Loans | Refinance | New York Hotels
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0977s ][ Queries: 16 (0.0231s) ][ GZIP on - Debug on ]