Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Oracle Locks and Joins

Oracle Locks and Joins

Ratings: (0)|Views: 165 |Likes:
Published by ypraju

More info:

Published by: ypraju on Dec 20, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





By penchalaRaju.Yanamala
Use the LOCK TABLE statement to lock one or more tables, table partitions, or table subpartitions in a specified mode. This lock manually overrides automaticlocking and permits or denies access to a table or view by other users for theduration of your operation.Some forms of locks can be placed on the same table at the same time. Other locks allow only one lock for a table.A locked table remains locked until you either commit your transaction or roll itback, either entirely or to a savepoint before you locked the table.A lock never prevents other users from querying the table. A query never placesa lock on a table. Readers never block writers and writers never block readers.See Also:
Oracle Database Conceptsfor a complete description of the interaction of lock modes
SAVEPOINTPrerequisitesThe table or view must be in your own schema or you must have the LOCK ANYTABLE system privilege, or you must have any object privilege on the table or view.Syntaxlock_table::=Description of the illustration lock_table.gif 
SemanticsschemaSpecify the schema containing the table or view. If you omit schema, then OracleDatabase assumes the table or view is in your own schema.table / viewSpecify the name of the table or view to be locked.If you specify view, then Oracle Database locks the base tables of the view.If you specify PARTITION or SUBPARTITION, then Oracle Database firstacquires an implicit lock on the table. The table lock is the same as the lock youspecify for partition or subpartition, with two exceptions:
If you specify a SHARE lock for the subpartition, then the databaseacquires an implicit ROW SHARE lock on the table.
If you specify an EXCLUSIVE lock for the subpartition, then the databaseacquires an implicit ROW EXCLUSIVE lock on the table.If you specify PARTITION and table is composite-partitioned, then the databaseacquires locks on all the subpartitions of partition.Restriction on Locking Tables If view is part of a hierarchy, then it must be theroot of the hierarchy.dblinkSpecify a database link to a remote Oracle Database where the table or view islocated. You can lock tables and views on a remote database only if you areusing Oracle distributed functionality. All tables locked by a LOCK TABLEstatement must be on the same database.If you omit dblink, then Oracle Database assumes the table or view is on thelocal database.See Also:"Referring to Objects in Remote Databases"for information on specifyingdatabase linkslockmode ClauseSpecify one of the following modes:ROW SHARE ROW SHARE permits concurrent access to the locked table butprohibits users from locking the entire table for exclusive access. ROW SHARE
is synonymous with SHARE UPDATE, which is included for compatibility withearlier versions of Oracle Database.ROW EXCLUSIVE ROW EXCLUSIVE is the same as ROW SHARE, but it alsoprohibits locking in SHARE mode. ROW EXCLUSIVE locks are automaticallyobtained when updating, inserting, or deleting.SHARE UPDATE See ROW SHARE.SHARE SHARE permits concurrent queries but prohibits updates to the lockedtable.SHARE ROW EXCLUSIVE SHARE ROW EXCLUSIVE is used to look at awhole table and to allow others to look at rows in the table but to prohibit othersfrom locking the table in SHARE mode or from updating rows.EXCLUSIVE EXCLUSIVE permits queries on the locked table but prohibits anyother activity on it.NOWAITSpecify NOWAIT if you want the database to return control to you immediately if the specified table, partition, or table subpartition is already locked by another user. In this case, the database returns a message indicating that the table,partition, or subpartition is already locked by another user.If you omit this clause, then the database waits until the table is available, locksit, and returns control to you.ExamplesLocking a Table: Example The following statement locks the employees table inexclusive mode but does not wait if another user already has locked the table:LOCK TABLE employeesIN EXCLUSIVE MODENOWAIT;The following statement locks the remote employees table that is accessiblethrough the database link remote:LOCK TABLE employees@remoteIN SHARE MODE;
A join is a query that combines rows from two or more tables, views, or materialized views. Oracle Database performs a join whenever multiple tablesappear in the FROM clause of the query. The select list of the query can selectany columns from any of these tables. If any two of these tables have a columnname in common, then you must qualify all references to these columnsthroughout the query with table names to avoid ambiguity.

Activity (8)

You've already reviewed this. Edit your review.
1 hundred reads
brijesh1747 liked this
maheshumbarkar liked this
balaji liked this
jaganj liked this
allitmails liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->