Object locking is only available in Source Control for Oracle 2 and later.
If your team works on a shared database, you can lock objects so other people can't edit the objects while you're working on them. This means teams don't accidentally overwrite work.
After you lock an object, you can work on it and check it in as usual. When you try to edit an object locked by someone else, the server returns an error. You can still unlock other people's objects if you need to.
Object locking isn't necessary for teams where each developer has their own copy of the database.
To use object locking, a SQL script needs to be run on the database. You can do this from the Lock objects tab, or you can run the script manually.
For more information, and to view the script, see Setting up object locking.
After locking is set up, the top pane lists objects that are currently locked in the database. The bottom pane lists objects that are currently unlocked.
The tab shows:
You can move the mouse over the Date and Last edited columns to see exact time stamps.
Type a comment explaining why you're locking the object (optional).
Click Lock selected objects.
The object is locked and appears in the Locked objects pane. The rest of your team can see you've locked the object and won't be able to edit it until it's unlocked.
You can also lock an object by right-clicking it.
For an example of how a team might use object locking, see Example - locking objects.
By default, searching is confined to the Name and Schema columns.
To search in a particular column, use the column name followed by a colon and your search term – for example, name:department or lockedby:phil.
You can use any column name except Date and Last edited.
To search for objects you locked, use lockedby:(me). You don't need to replace (me) with your username.
To exclude a term, use -. For example, to exclude objects with job in the object or schema name, use -job, or to exclude all tables, use -type:table.
You can combine the above methods to make your search more specific. For example:
type:view -type:log department schema:hr
This displays views and materialized views - but not materialized view logs - containing department in the name or schema and hr in the schema.
To exclude a search term containing more than one word, use - before each word you want to exclude. If you only use - before the first word, only the first word will be excluded. The others will be included.
For example, if you want to search for views but exclude view logs, use both type:view and -type:log. If you use -type:view log, this will exclude views but search for logs.