Help using Base SAS procedures

How to find which user has a lock on a table

Accepted Solution Solved
Reply
Super Contributor
Posts: 398
Accepted Solution

How to find which user has a lock on a table

Hello,

I have a process that I move some of my sas tables to different directories for my users.   When one of the users has a table open I get the following error:

ERROR: A lock is not available for LibTest.TestData.DATA.

ERROR: Download function terminated. The file created may be unusable.

How can I have it tell me which user has the table lock?  I don't want to email every user when this happens.

Thank you


Accepted Solutions
Solution
‎12-04-2014 03:06 PM
Valued Guide
Posts: 3,208

Re: How to find which user has a lock on a table

That one could be even your alter you on the same machine.  Than you do not have anything on the involved user name.

If you would open a txt-file in windows in notepad you will see other people can open that and update without being notified. Windows is not designed for multi-user processing it was added in the meantime.

Going for mainframes you will have to master the locking/sharing approach as that one is designed for multi-user by design. The disp=shr new/old needed for every dataset with associated enques.

In the system log you can find the information of the process giving the information who is the guilty one.

With Unix it is not that advanced as mainframe and not that left open as Windows.

What SAS I doing is using a own locking approach on sas-datasets. You can often see the -.lck suffix. When ready  the old dataset is deleted and the -.lck dataset is renamed to the original one.

When that renaming is failed that can be seen as a lock. Try the rename the file with Windows for hope it will give you a Windows message who dun it.

Also on Windows every file is associated to an owner-id completely the same as on Unix. The common security approach is hiding that setting global access rules.

All is moved to admin roles also seeing open files/sessions Manage Sessions and Open Files (Microsoft.com)

At Unix the lock message I have seeing come along with a process-number. That is belonging to a person with a task.

     
    

---->-- ja karman --<-----

View solution in original post


All Replies
Super User
Posts: 3,105

Re: How to find which user has a lock on a table

What operating system does your SAS run under? There is no functionality in Base SAS for this so you would have to use operating system commands if available at all. One approach might be to look at the available SAS processes running and kill the process you think is locking the dataset.

Super Contributor
Posts: 398

Re: How to find which user has a lock on a table

SASKiwi,

Thank you for the response.  The computer I'm testing with is running Windows 7 64-bit.

Valued Guide
Posts: 3,208

Re: How to find which user has a lock on a table

How do you find the user that has locked a excel-file using excel?

---->-- ja karman --<-----
Super Contributor
Posts: 398

Re: How to find which user has a lock on a table

Japp,

When I open the excel file it tells me which user has the lock. 

Solution
‎12-04-2014 03:06 PM
Valued Guide
Posts: 3,208

Re: How to find which user has a lock on a table

That one could be even your alter you on the same machine.  Than you do not have anything on the involved user name.

If you would open a txt-file in windows in notepad you will see other people can open that and update without being notified. Windows is not designed for multi-user processing it was added in the meantime.

Going for mainframes you will have to master the locking/sharing approach as that one is designed for multi-user by design. The disp=shr new/old needed for every dataset with associated enques.

In the system log you can find the information of the process giving the information who is the guilty one.

With Unix it is not that advanced as mainframe and not that left open as Windows.

What SAS I doing is using a own locking approach on sas-datasets. You can often see the -.lck suffix. When ready  the old dataset is deleted and the -.lck dataset is renamed to the original one.

When that renaming is failed that can be seen as a lock. Try the rename the file with Windows for hope it will give you a Windows message who dun it.

Also on Windows every file is associated to an owner-id completely the same as on Unix. The common security approach is hiding that setting global access rules.

All is moved to admin roles also seeing open files/sessions Manage Sessions and Open Files (Microsoft.com)

At Unix the lock message I have seeing come along with a process-number. That is belonging to a person with a task.

     
    

---->-- ja karman --<-----
Super Contributor
Posts: 398

Re: How to find which user has a lock on a table

Thank you so much Jaap for your help.

This has put me in the right direction.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 2654 views
  • 0 likes
  • 3 in conversation