Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a script for updating some features on my database every night (just for copying and replacing some features). This features are "read-only". My problem is that I can't avoid that these features are opened by users, and my script can show the following error:

ExecuteError: ERROR 000464: Cannot get exclusive schema lock. 
              Either being edited or in use by another application.

Can I force the phyton script, via some command, copying the files, even been opened by some user? Can I fall down all the connections on my database before running the script?

Thanks!

share|improve this question
1  
This appears to be an arcpy/arcgisscripting error. Please confirm which you are using, and also which database you are using. –  blah238 Jul 5 '12 at 14:31
add comment

3 Answers

I'm not very familiar with postgresql but I think this post can lead you to the right direction:

http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection

share|improve this answer
add comment

I suppose that you are working with SDE.

You should kill all connections using sdemon command-line tool.

  1. If there is an ArcSDE installed on PC where you a running the script then you can execute sdemon -o kill locally to kill all connections. Take a look at this help topic. I am not sure is it killing direct-connections on 10.0. I remember that it was a kind of a problem on 9.3 and that it is definitely killing direct-connections on 10.1.
  2. If you don't have ArcSDE installed and it is running only on a separate server then you can execute this command remotely from Python. There is some discussion in this topic.
share|improve this answer
    
Yes, I'm using SDE (installed on a server). But the "sdemon -o kill" command returned a syntax error. –  Arthur Vrechi Jul 5 '12 at 16:37
    
The sdemon command has to be executed in ArcSDE. Can I put it on my Python script? –  Arthur Vrechi Jul 5 '12 at 18:17
1  
Take a look at subprocess module. Also there is nice questions here: How to call external command in Python and Running shell command from python and capturing the output. –  Alex Markov Jul 5 '12 at 19:12
2  
Command sdemon -o kill is not enough. You should pass additional parameters, take a look at provided link. –  Alex Markov Jul 5 '12 at 19:15
add comment

Another possibility since you said you are using SDE is to delete shared locks from the layer_locks and table_locks tables using SQL, PL/SQL, T-SQL, etc. e.g.:

DELETE FROM TABLE_LOCKS WHERE SDE_ID = :b1 AND REGISTRATION_ID = :b2

I would definitely not recommend this approach on a versioned geodatabase. See also: How are the various lock mechanisms implemented in ArcSDE and the geodatabase?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.