SQL Source Control 6

These pages cover SQL Source Control 6, which is not the latest version. Help for other versions is also available.

Remove object locking

To remove object locking from the server, you need to run an uninstall script. Any locked objects on the server will be unlocked.

If you want to uninstall SQL Source Control, you should remove object locking from the server first.

 If you have unlocked objects when you uninstall SQL Source Control, they will stay locked until you either:

  • reinstall SQL Source Control and unlock them in the Locking tab, or
  • run the unlock SQL for each locked object

Required privileges

To remove object locking, you need these database privileges:

  • CREATE USER
  • CREATE ROLE
  • GRANT ANY PRIVILEGE
  • CREATE ANY TABLE
  • CREATE ANY PROCEDURE

To remove object locking

  1. View the script:

    Object locking uninstall script Toggle source code

    1. -- This script removes the objects added by the object locking setup script. Any locked objects on the server will be unlocked.
    2. -- Before you run the script, close any other query windows that use the RedGate database.
    3. -- The script doesn't delete the Redgate database. If you want to delete the database, make sure it isn't being used by other Redgate tools (eg DLM Dashboard).
    4. -- For more information about object locking, see http://www.red-gate.com/SOC-object-locking
    5.  
    6. --//////////////////////////////////////
    7. USE [RedGate]
    8. --//////////////////////////////////////
    9. --// DDL Trigger
    10. --//////////////////////////////////////
    11. IF EXISTS (SELECT 1 FROM sys.server_triggers WHERE name = 'RG_SQLSourceControl_DDLTrigger')
    12. DROP TRIGGER RG_SQLSourceControl_DDLTrigger ON ALL SERVER
    13. GO
    14. --//////////////////////////////////////
    15. --// Locked Objects Table
    16. --//////////////////////////////////////
    17. IF OBJECT_ID('[SQLSourceControl].[LockedObjects]') IS NOT NULL
    18. DROP TABLE [SQLSourceControl].[LockedObjects]
    19. GO
    20. --//////////////////////////////////////
    21. --// LockObject Stored Procedure
    22. --//////////////////////////////////////
    23. IF OBJECT_ID('[SQLSourceControl].[LockObject]') IS NOT NULL
    24. DROP PROCEDURE [SQLSourceControl].[LockObject]
    25. GO
    26. --//////////////////////////////////////
    27. --// UnlockObject Stored Procedure
    28. --//////////////////////////////////////
    29. IF OBJECT_ID('[SQLSourceControl].[UnlockObject]') IS NOT NULL
    30. DROP PROCEDURE [SQLSourceControl].[UnlockObject]
    31. GO
    32. --//////////////////////////////////////
    33. --// GetLockedObjects Function
    34. --//////////////////////////////////////
    35. IF OBJECT_ID('[SQLSourceControl].[GetLockedObjects]') IS NOT NULL
    36. DROP FUNCTION [SQLSourceControl].[GetLockedObjects]
    37. GO
    38. --//////////////////////////////////////
    39. --// IsObjectLocked Function
    40. --//////////////////////////////////////
    41. IF OBJECT_ID('[SQLSourceControl].[IsObjectLocked]') IS NOT NULL
    42. DROP FUNCTION [SQLSourceControl].[IsObjectLocked]
    43. GO
    44. --//////////////////////////////////////
    45. --// SQLSourceControl Schema
    46. --//////////////////////////////////////
    47. IF (SCHEMA_ID('SQLSourceControl') IS NOT NULL)
    48. DROP SCHEMA [SQLSourceControl]
    49. GO
  2. Close any other query windows that use the RedGate database.
  3. Run the script on the server.

Object locking is removed from the server.


Didn't find what you were looking for?