Skip to end of metadata
Go to start of metadata
Icon

Object locking is only available in Source Control for Oracle 2.

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.

Icon

Object locking isn't necessary for teams where each developer has their own copy of the database.

Setting up

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.

Using the Lock objects tab

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:

  • the name of the object
  • the type of object
  • who the object was locked by
  • the date the object was locked
  • when the object was last edited
  • the comment left by the person locking it (if one was provided)
Icon

You can move the mouse over the Date and Last edited columns to see exact time stamps.

Locking objects

To lock an object:

  1. In the Unlocked objects pane, select the object you want to lock.
  2. Type a comment explaining why you're locking the object (optional).

    Icon
    Comments help your team know if it's OK to unlock the object or check it in.
  3. 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.

Icon

You can also lock an object by right-clicking it.

Icon
You can check in locked objects, but other people may still be working on them, and they might not be ready to check in to source control.

Unlocking objects

To unlock objects, select the objects in the Locked objects pane and click Unlock selected objects.

Icon

You can unlock objects even if you're not the person who locked them. 

To unlock objects you locked yourself, click Unlock all my objects.

Icon

You can also unlock an object by right-clicking it.

For an example of how a team might use object locking, see Example - locking objects.

  • No labels