When ever you are creating table, you need to give ROWDEPENDECIES with the CREATE Statement.
After you can access a psuedo column ORA_ROWSCN to get the state of perticular column. ORA_ROWSCN in your update clause to ensure that the row has not changed since the last time you read it
Example
Whene ever you access a record from table you need to get ORA_ROWSCN number store it with your record.
Update tablename set column where id=1 and ORA_ROWSCN= stored number.
if the staement execute none you can tigger the user,that the record has changed somewhere else.
Showing posts with label Oracle 11g. Show all posts
Showing posts with label Oracle 11g. Show all posts
Friday, July 17, 2009
How can we find row level changes while you updating a row?
Posted by Career IT Developers at 12:28 AM 0 comments
Labels: Oracle 11g, ROWDEPENDECIES
Overcome Concurrency Limitations
Here is how you can solve the concurrency-limiting problem demonstrated in my test case using ROWDEPENDENCIES. The following code creates a new set of tables, opens two SQL*Plus sessions, and executes an anonymous block:
/* create the tables for the test case */
create table t1_rd (c1 number) rowdependencies pctfree 5;
create index idx_t1_rd on t1_rd(c1) pctfree 5;
/* now open 2 SQL*Plus sessions and cut-paste this code in both */
/* session 1*/
alter session set isolation_level=serializable;
begin
FOR i IN 1..10000
LOOP
insert into t1_rd values(i);
END LOOP;
end;
/* session 2*/
alter session set isolation_level=serializable;
begin
FOR i IN 1..10000
LOOP
insert into t1_rd values(i);
END LOOP;
end;
/* now in both sessions, execute the anonymous block*/
/* session 1 */
SQL>/
/* session 2*/
SQL>/
Here is the output from both sessions:
SQL> alter session set isolation_level=serializable;
Session altered.
SQL> begin
2 FOR i IN 1..10000
3 LOOP
4 insert into t1_rd values(i);
5 END LOOP;
6 end;
7 /
PL/SQL procedure successfully completed.
The code produced no errors. Now you can commit or rollback to end the transaction. After commit, you can see the rows inserted in the table.Determine Which Rows Have Been Committed
You can use ROWDEPENDENCIES to determine which rows have been committed and which rows haven't been committed yet by the same session.
INSERT INTO t1_rd VALUES (100);
INSERT INTO t1_rd VALUES (101);
SELECT c1, ORA_ROWSCN FROM t1_rd WHERE ORA_ROWSCN IS NULL;
INSERT INTO t1 values (1000);
INSERT INTO t1 values (1001);
SELECT c1, ORA_ROWSCN FROM t1;
In tables with ROWDEPENDENCIES, the ORA_ROWSCN column is NULL for uncommitted rows.
With these techniques, you can improve application concurrency and avoid that dreaded ORA-8177 error.
Posted by Career IT Developers at 12:11 AM 0 comments
Labels: Concurrency, ORA_ROWSCN, Oracle 11g, ROWDEPENEDENCIES
Tuesday, May 19, 2009
Change sessions, transaction and processes parameters in Oracle 10g
alter system set PROCESSES=100 scope=SPFILE;
alter system set TRANSACTIONS=126 scope=SPFILE;
alter system set SESSIONS=115 scope=SPFILE;
Posted by Career IT Developers at 2:02 AM 0 comments
Labels: Databse Issues, Oracle 10g, Oracle 11g, Oracle XE
Subscribe to:
Posts (Atom)