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##
Bekir,
The Accept connection call in ArcPy allows an administrator to enable or disable the ability of nonadministrative users to make connections to an enterprise geodatabase.
When you run this part of your script, you connect as the DBO (SA):
# 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")
Since you are connected as DBO, that particular connection is the only one that can access the database. In your case KULLANICI wont be able to connect.
~Alex
Alex,
After running the arcpy.DisconnectUser I noticed that users in ArcCatalog and ArcMap have to disconnect and reconnect. How does this affect "map services?" Do they reconnect automatically or do that have to be restarted?