Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can you prevent commits from a client application?

0 views
Skip to first unread message

dean

unread,
Jul 8, 2008, 1:55:48 PM7/8/08
to
10g. Is there any way to alter a session and prevent ANY commits (at
least until a subsequent call to remove the alteration)? I'm using the
following statement to prevent commits in any procedures (ALTER
SESSION DISABLE COMMIT IN PROCEDURE), but I need a way to prevent
accidental commits from within a client application.

The reason I would like this is to allow testers to be able to
navigate around an application after a databridge has been run, and
poke around here and there in various datagrids, without risk of them
accidentally calling a function that has a commit in it.

Any thoughts appreciated.

Ana C. Dent

unread,
Jul 8, 2008, 8:54:43 PM7/8/08
to
dean <deanb...@yahoo.com> wrote in news:18ccb7fd-35ad-47a5-ac0d-
8eedf9...@b1g2000hsg.googlegroups.com:

Provide a READ ONLY schema

gazzag

unread,
Jul 9, 2008, 5:50:57 AM7/9/08
to

Flashback database any use?

HTH

-g

dean

unread,
Jul 9, 2008, 7:37:51 PM7/9/08
to
On Jul 8, 8:54 pm, "Ana C. Dent" <anaced...@hotmail.com> wrote:
> dean <deanbrow...@yahoo.com> wrote in news:18ccb7fd-35ad-47a5-ac0d-
> 8eedf96fa...@b1g2000hsg.googlegroups.com:

Can you set read-only from a client program, at run time?

Steve Howard

unread,
Jul 9, 2008, 8:58:38 PM7/9/08
to

Look up secure application roles, if you want to specify what a
certain application user can do under specific conditions.

dean

unread,
Jul 9, 2008, 10:49:47 PM7/9/08
to
> certain application user can do under specific conditions.- Hide quoted text -
>
> - Show quoted text -

Sorry I'm not being clear here - I would like do a series of updates
and inserts, and then once all that is finished, turn off any ability
to make changes. In other words, a run-time and dynamic change in the
read-only state (such as with alter session).

Kai Rode

unread,
Jul 16, 2008, 3:30:58 PM7/16/08
to
>Sorry I'm not being clear here - I would like do a series of updates
>and inserts, and then once all that is finished, turn off any ability
>to make changes. In other words, a run-time and dynamic change in the
>read-only state (such as with alter session).

My idea (haven't had time to test yet): Create a table with a deferred
constraint CHECK (1=0). Insert a row into that table, then let your testers
play. If anyone tries to commit, the commit will be prevented by the failed
checking of the deferred constraint.

Ed Prochak

unread,
Jul 16, 2008, 10:20:46 PM7/16/08
to
On Jul 9, 10:49 pm, dean <deanbrow...@yahoo.com> wrote:
>
> Sorry I'm not being clear here - I would like do a series of updates
> and inserts, and then once all that is finished, turn off any ability
> to make changes. In other words, a run-time and dynamic change in the
> read-only state (such as with alter session).

This is still not clear how this will help testing.
Ed

dean

unread,
Aug 15, 2008, 8:29:21 PM8/15/08
to

Interesting! I'll try it and post up either way whether it works or
not.

Thanks!

-Dean

dean

unread,
Aug 22, 2008, 3:34:02 PM8/22/08
to

I've implemented and been using the new (check 1=0) constraint method
and it appears to be a good solution that I will maintain in
production code. DDL statements, truncates, and other sources of
commits have been caught and typically the transaction is rolled back
if there is any attempt to commit, while the statement itself also
appears to fail. For example doing a truncate does the following: (1)
Roll back uncommitted changes, including the insert into the table
that contains the check. (2) Provide an error message (see below). (3)
Statement fails.

CREATE TABLE A (DUMMY NUMBER);

Table created.


CREATE TABLE TRANSACTION_STOP (DUMMY NUMBER NOT
NULL,
CONSTRAINT "TRANSACTION_STOP_I" CHECK(1=2) DEFERRABLE
INITIALLY DEFERRED) ;

Table created.


insert into A values (1);

1 row created.

commit;

Commit complete.

insert into transaction_stop values (1); -- <- contains deferred
check(1=0) constraint

1 row created.

truncate table A;
*
ERROR at line 1:
ORA-02091: transaction rolled back
ORA-02290: check constraint (GC_FEB08.TRANSACTION_STOP_I) violated


select * from A; -- Test if truncate succeeded.

DUMMY
----------
1

1 row selected.

DA Morgan

unread,
Aug 23, 2008, 12:19:27 AM8/23/08
to

To some extent you have recreated the wheel.

All currently supported versions of Oracle contain DDL triggers that
can trap is block any or all DDL.

Check it out:
http://www.psoug.org/reference/ddl_trigger.html
--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damo...@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org

dean

unread,
Aug 23, 2008, 4:05:40 AM8/23/08
to
> damor...@x.washington.edu (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org- Hide quoted text -

>
> - Show quoted text -

Thanks for that. I was trying to guard against other possibilities too
- such as simply calling commit from a different part of the GUI, or
procedures, etc.

Ana C. Dent

unread,
Aug 23, 2008, 10:24:18 AM8/23/08
to
dean <deanb...@yahoo.com> wrote in
news:f161e0a0-d654-431d...@a1g2000hsb.googlegroups.com:

>
> Thanks for that. I was trying to guard against other possibilities too
> - such as simply calling commit from a different part of the GUI, or
> procedures, etc.
>

If the application is coded to allow this, then you have bigger problems.

Are you aware that session A can not issue a COMMIT for session B?

DA Morgan

unread,
Aug 23, 2008, 5:19:26 PM8/23/08
to
dean wrote:

> Thanks for that. I was trying to guard against other possibilities too
> - such as simply calling commit from a different part of the GUI, or
> procedures, etc.

What you just described is impossible and bring up the question of
whether you understand Oracle's transaction model. What is the basis
of your belief that such a thing is possible?


--
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington

damo...@x.washington.edu (replace x with u to respond)

0 new messages