kucukaga

Disconnect All Users from a Geodatabase in pyhton

Discussion created by kucukaga on Apr 19, 2017
Latest reply on Apr 20, 2017 by Alexander_Brown-esristaff

Hi all,

 

I want to throw all users out of the disconnect except for a user, I do not want to throw the user who is connected as a dbo

So, I want to throw out the users I selected in the picture, and I do not want to throw away those that are not selected.
How can i use it as python?

(What I actually want to do is,
To take out the users with the pyhton and to unregister- register as versioned later.)

 

I wrote a pyhton like this, but can not connect again because I throw all the users.

 

# Dont Accept Geo database connections to the CBS database!
arcpy.AcceptConnections('Database Connections\\172.16.200.86_CBS_sa.sde', False)
# Disconnect all users in the GIS Databases!
arcpy.DisconnectUser('Database Connections\\172.16.200.86_CBS_sa.sde', "ALL")
# For CBS_PE Dataset Unregister Connections
CBS_KULLANICI_PE_Hat = "Database Connections\\172.16.200.86_CBS_kullanici.sde\\CBS.KULLANICI.PE_Hat"
CBS_KULLANICI_PE_Hat__2_ = CBS_KULLANICI_PE_Hat
# For CBS_PE dataset Unregister As Versioned APPLY!
arcpy.UnregisterAsVersioned_management(CBS_KULLANICI_PE_Hat, "KEEP_EDIT", "COMPRESS_DEFAULT")
# For CBS_PE Dataset register Connections
CBS_KULLANICI_PE_Hat = "Database Connections\\172.16.200.86_CBS_kullanici.sde\\CBS.KULLANICI.PE_Hat"
Output_Dataset = CBS_KULLANICI_PE_Hat
# For CBS_PE dataset register As Versioned APPLY!
arcpy.RegisterAsVersioned_management(CBS_KULLANICI_PE_Hat, "NO_EDITS_TO_BASE")
# Accept Geo database connections to the CBS database!
arcpy.AcceptConnections('Database Connections\\172.16.200.86_CBS_sa.sde', True)
# Run the Compress tool for CBS Databases.
arcpy.Compress_management('Database Connections\\172.16.200.86_CBS_sa.sde')

 

How can i do that?
Thank you all##

Attachments

Outcomes