- Q What is your biggest regret and why?
- Q Write Short Notes on Oxidative Phosphorylation
- Q In November 2010 billionaire Stanly Ho paid £210,000 for two large examples of what culinary delicacy?
- Q Maximum number of ‘No Confidence Motion’ were admitted and discussed during the Prime Ministership of
- Q We are having two bugs one is of HSLP and other is of LSHP. The developer says that he has just time to fix only one bug then which bug is more important to fix and why?
- Q What is genome?
- Q How many transforms can be supplied in the command line?
- Q Where do I record the refund of a registration fee?
- Q As per the Union Railway Budget 2009, how stations have been identified for religious and tourism importance?
- Q Write some useful table tags that we use in html?
- Q Is targeting using grain data secure?
Answers
Demonstrate the effect of automatic shared and exclusive locks, using DML and DDL
commands.
1. Connect to your database with SQL*Plus as user SYSTEM.
2. Create a table, and insert a row into it.
ocp10g> create table t1(c1 number);
Table created.
ocp10g> insert into t1 values(1);
1 row created.
ocp10g> commit;
Commit complete.
3. Open a second session, again connecting with SQL*Plus as user SYSTEM.
4. In session 1, issue a DML command that will take an exclusive lock on the
row and a shared lock on the table.
ocp10g> update t1 set c1=2 where c1=1;
1 row updated.
5. In session 2, issue a DDL statement against the table.
ocp10g> alter table t1 add (c2 date);
alter table t1 add (c2 date)
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
The attempt to add a column to the table fails, because the exclusive table
lock necessary for a DDL statement conflicts with the shared lock already
granted for a DML statement. Note that whereas a DML statement will wait
and continually retry until it gets its lock (in other words, it hangs), DDL
statements terminate immediately with an error.
6. In session 1, commit the transaction.
ocp10g> commit;
Commit complete.
7. In session 2, repeat Step 5. This time it will succeed because there are no
shared DML locks blocking the exclusive DDL lock.
8. In session 1, lock the whole table.
ocp10g> lock table t1 in exclusive mode;
Table(s) Locked.
9. In session 2, insert a row. The session will hang.
ocp10g> insert into t1 values (1,sysdate);
10. In session 1, release the table lock by issuing a COMMIT. Note that a
ROLLBACK would do just as well.
ocp10g> commit;
Commit complete.
11. Session 2 will now be released, and the insert will complete; issue a COMMIT
to terminate the transaction and release the row exclusive lock.
12. Leave both sessions open; they will be used in later exercises. Your Comment
commands.
1. Connect to your database with SQL*Plus as user SYSTEM.
2. Create a table, and insert a row into it.
ocp10g> create table t1(c1 number);
Table created.
ocp10g> insert into t1 values(1);
1 row created.
ocp10g> commit;
Commit complete.
3. Open a second session, again connecting with SQL*Plus as user SYSTEM.
4. In session 1, issue a DML command that will take an exclusive lock on the
row and a shared lock on the table.
ocp10g> update t1 set c1=2 where c1=1;
1 row updated.
5. In session 2, issue a DDL statement against the table.
ocp10g> alter table t1 add (c2 date);
alter table t1 add (c2 date)
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
The attempt to add a column to the table fails, because the exclusive table
lock necessary for a DDL statement conflicts with the shared lock already
granted for a DML statement. Note that whereas a DML statement will wait
and continually retry until it gets its lock (in other words, it hangs), DDL
statements terminate immediately with an error.
6. In session 1, commit the transaction.
ocp10g> commit;
Commit complete.
7. In session 2, repeat Step 5. This time it will succeed because there are no
shared DML locks blocking the exclusive DDL lock.
8. In session 1, lock the whole table.
ocp10g> lock table t1 in exclusive mode;
Table(s) Locked.
9. In session 2, insert a row. The session will hang.
ocp10g> insert into t1 values (1,sysdate);
10. In session 1, release the table lock by issuing a COMMIT. Note that a
ROLLBACK would do just as well.
ocp10g> commit;
Commit complete.
11. Session 2 will now be released, and the insert will complete; issue a COMMIT
to terminate the transaction and release the row exclusive lock.
12. Leave both sessions open; they will be used in later exercises. Your Comment
- 0
- 0
- New Answer
- Contributors: *,
More Software Questions..
What is the inputsplit in map reduce software?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How can you implement fine-grained auditing?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is IBM’s simple explanation for Big Data’s four critical features?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What does the NULLIF function do?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What happens if a start method is not invoked and the run method is directly invoked?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
what is the difference between mysql_fetch_array and mysql_fetch_object?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How will XML affect my document links?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Why to use Style Sheets?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are Filters in MVC?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can you explain Application layer in OSI model?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How to define new testplan attributes?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Which oracle package is used to manage the oracle lock management services?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is marker interface?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What types of partitioning are there for BW?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,