|
POST
|
Source/destination goedatabases (SDE, mdb, gdb) in replication, I�??m wondering if the destination (SDE, mdb, gdb) geodatabase must be empty to apply the creation of the replica. [ATTACH=CONFIG]21234[/ATTACH] Thank you Best Jamal
... View more
01-30-2013
09:39 PM
|
0
|
0
|
721
|
|
IDEA
|
Showing the name of the hard drive on the catalog to avoid confusion, It is very confusing as the catalog just shows the letter of the drive instead of showing the name of the driver (better to show both)! Facts: In windows XP, users were not able to see the name of the drives when they wanted to “safely remove hardware and eject media”, now in windows 7, this service has enhanced and the users can see the name of the drive that they need to remove Other software that had this problem in the “Allway Sync”. Before the last release the users were not able to see the name of the hard drive that they need to synchronize. But now it is more powerful! It shown the name of the drive Thank you Best Jamal
... View more
01-29-2013
11:13 PM
|
18
|
8
|
4469
|
|
POST
|
Caveman simple: Stop and start the service. It's never failed me... Many thanks Joe for the contribution. I think that this should be part of the script that is used to make the Add-Delete tables with no records (empty) Best Jamal
... View more
01-28-2013
08:52 AM
|
0
|
0
|
3130
|
|
POST
|
I don't see in your script where you are disconnecting the users arcpy.DisconnectUser("Database Connections/[email protected]", "ALL") Many thanks Carl for the answer. Sorry for the confusion 1. Below is the code that I need to have a SCRIPT TOOL (in a toolbox) for (As I don�??t have sufficient skills to do so): ------------------------------------------------------------------------- import arcpy, time, smtplib # set the workspace arcpy.env.workspace = 'Database Connections/admin.sde' # set a variable for the workspace workspace = arcpy.env.workspace # get a list of connected users. userList = arcpy.ListUsers("Database Connections/admin.sde") # get a list of usernames of users currently connected and make email addresses emailList = [u.Name + "@yourcompany.com" for user in arcpy.ListUsers("Database Connections/admin.sde")] # take the email list and use it to send an email to connected users. SERVER = "mailserver.yourcompany.com" FROM = "SDE Admin <[email protected]>" TO = emailList SUBJECT = "Maintenance is about to be performed" MSG = "Auto generated Message.\n\rServer maintenance will be performed in 15 minutes. Please log off." # Prepare actual message MESSAGE = """\ From: %s To: %s Subject: %s %s """ % (FROM, ", ".join(TO), SUBJECT, MSG) # Send the mail server = smtplib.SMTP(SERVER) server.sendmail(FROM, TO, MESSAGE) server.quit() #block new connections to the database. arcpy.AcceptConnections('Database Connections/admin.sde', False) # wait 15 minutes time.sleep(900) #disconnect all users from the database. arcpy.DisconnectUser('Database Connections/admin.sde', "ALL") # Get a list of versions to pass into the ReconcileVersions tool. versionList = arcpy.ListVersions('Database Connections/admin.sde') # Execute the ReconcileVersions tool. arcpy.ReconcileVersions_management('Database Connections/admin.sde', "ALL_VERSIONS", "sde.DEFAULT", versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_TARGET_VERSION", "POST", "DELETE_VERSION", "c:/temp/reconcilelog.txt") # Run the compress tool. arcpy.Compress_management('Database Connections/admin.sde') #Allow the database to begin accepting connections again arcpy.AcceptConnections('Database Connections/admin.sde', True) #Get a list of datasets owned by the admin user # Get the user name for the workspace # this assumes you are using database authentication. # OS authentication connection files do not have a 'user' property. userName = arcpy.Describe(arcpy.env.workspace).connectionProperties.user # Get a list of all the datasets the user has access to. # First, get all the stand alone tables, feature classes and rasters. dataList = arcpy.ListTables('*.' + userName + '.*') + arcpy.ListFeatureClasses('*.' + userName + '.*') + arcpy.ListRasters('*.' + userName + '.*') # Next, for feature datasets get all of the featureclasses # from the list and add them to the master list. for dataset in arcpy.ListDatasets('*.' + userName + '.*'): dataList += arcpy.ListFeatureClasses(feature_dataset=dataset) # pass in the list of datasets owned by the admin to the rebuild indexes and analyze datasets tools # Note: to use the "SYSTEM" option the user must be an administrator. arcpy.RebuildIndexes_management(workspace, "SYSTEM", dataList, "ALL") arcpy.AnalyzeDatasets_management(workspace, "SYSTEM", dataList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE") -------------------------------------- 2. Here is the code that has already a script tool (attached to my previous post) --------------------------- # Name: GDBMaintenance.py # Description: Rebuilds indexes and statistics # on geodatabase feature classes # using an existing .sde file. # Author: Esri # Import system modules import arcpy, os import sys, traceback # set the workspace environment using the data owner account D:\Practical2_Editing\Data\Sa_A.sde path=arcpy.GetParameterAsText(0) arcpy.env.workspace = path ########################################################### #Gather all the FeatureClasses and Tables from the Workspace datasets = arcpy.ListTables() + arcpy.ListFeatureClasses() #Save geodatabase path to use for concatonating feature dataset names path = arcpy.env.workspace #Determine if any were found for fd in arcpy.arcpy.ListDatasets("","Feature"): arcpy.env.workspace = path + "\\" + fd #Gather the FeatureClasses from the Current Dataset datasets += arcpy.ListFeatureClasses() arcpy.env.workspace = path #Rebuild and analyze all datasets arcpy.RebuildIndexes_management(arcpy.env.workspace,"NO_SYSTEM",datasets,"ALL") print arcpy.GetMessages() arcpy.AnalyzeDatasets_management(arcpy.env.workspace,"NO_SYSTEM",datasets,"ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE") print arcpy.GetMessages() #Rebuild and analyze all system tables and compress the Geodatabase # set the workspace environment using the Geodatabase administrative account arcpy.env.workspace = path ###################################################### arcpy.RebuildIndexes_management(arcpy.env.workspace,"SYSTEM","","ALL") print arcpy.GetMessages() arcpy.AnalyzeDatasets_management(arcpy.env.workspace,"SYSTEM","","ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE") print arcpy.GetMessages() arcpy.Compress_management(arcpy.env.workspace) print arcpy.GetMessages() print "Processing complete" ------------------------------- Best Jamal
... View more
01-28-2013
08:41 AM
|
0
|
0
|
2469
|
|
POST
|
Probably what you want is this: Scheduling a Python script to run at prescribed times Desktop » Geoprocessing » Executing tools http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000038000000 It probably doesn't make sense, not practical sense, to make this a script tool - unless you mean you only want a part of this as a tool. At the very beginning of the webhelp documentation, the purpose of the design of this script is posted: "This topic discusses the process an administrator might go through to run a scheduled nightly reconciliation of versions." At any rate, this is a rather long and intensive administrator task that: a) You wouldn't likely want users' to launch, particularly during the day (which would effectively take the database offline for a lengthy period of time. b) You would very likely need to monitor the log and need time as an administrator to fix any hiccups that are bound to occur. c) There are so many input parameters in this script, users would think they are filling out a job application....just setting it up for the run, unless you set it up in some kind of default mode, will be a headache for most any user...doubtful an administrator would even use it. Hope that helps, and by the way - I have written overnight scheduled tasks before and they work very well. This one you have chosen to tackle is likely the most complexly powerful one I have ever seen....and it is critical to get it right, particularly if you have many users. Good luck! It is very interesting though. -Wayne Many thanks Wayne for the time and effort and the distinct help, I do totally agree with you. You have perfectly described the best workflow for the script. My aim from this tool is just to test the behavior of the script by SIMPLE TOOL (accommodated in a toolbox). Attached is a script tool developed for the same purpose. But it doesn�??t do the �??disconnect users�?� part of the work. All what the user needs to do is to provide the data connection and then the script will run smoothly. [ATTACH=CONFIG]21114[/ATTACH], [ATTACH=CONFIG]21115[/ATTACH], [ATTACH=CONFIG]21116[/ATTACH] Best Jamal
... View more
01-27-2013
08:53 PM
|
0
|
0
|
2469
|
|
POST
|
You were before having problems establishing your admin sde connection via Python - I don't know if it was clear but (provided the sde connection files contain valid parameters at the Database Connections shortcut set up in ArcGIS [I think the default location is in the app directory]) you can use the line of code below, if this is the valid admin connection you desire setting up for the reconcile/post process: arcpy.env.workspace = r'Database Connections\Sa_D1.sde' I mentioned using UNC pathname conventions -- what I mean by that is I prefer not to use the 'Database Connections' shortcut, because for one what if the default setting for the shortcut path is overridden?...then where is your script supposed to go look for it? If such things change, then you have to remember to also move the appropriate sde connection files to the new location. Therefore, as a result of this reasoning (and this particularly applies to running scripts from the server and any specialized scripts you want to provide a 'more private' or secure location to use, accessing the file-contained connection parameters), it is convenient to store scripts and any associated sde files, etc. needed to run it on the server --- for example: arcpy.env.workspace = r'\\yourServerName\aMoreSecureLocation\aCopyOf\Sa_D1.sde' You can even copy your sde file there if that is the convenience you want - and in that way you have secured a file for particular use by your server scripts...it is true if you do this you will have to maintain them separately, but how often do you have to change admin connection files? It certainly doesn't make sense to store the files on your desktop for the server to 'reach across the network' for the necessary params in order to do its assigned admin task on the server! Just thought I'd pass that along. Hope it is going well -- the 'batch' workflow (Using Python scripting to batch reconcile and post versions) listed at the 10.1 webhelp is extremely interesting....so if you will post back here to confirm you got it going, that would be great. Thanks, Wayne Many thanks Wayne for the valuable feedback. Quite useful. At the moment, just I need a help to create a TOOL that can live in a TOOLBOX to run the script by only providing the connection. I have posted this challenge in the Python section. Best Jamal
... View more
01-27-2013
11:53 AM
|
0
|
0
|
3130
|
|
POST
|
Attaching a python script in a custom tool to live in a custom toolbox, I couldn�??t manage how the script below (http://resources.arcgis.com/en/help/main/10.1/index.html#//003n000000v7000000) can be attached in a custom tool in a custom toolbox such that the end user just needs to enter the connection of the database to run the entire script. ----------------- import arcpy, time, smtplib # set the workspace arcpy.env.workspace = 'Database Connections/admin.sde' # set a variable for the workspace workspace = arcpy.env.workspace # get a list of connected users. userList = arcpy.ListUsers("Database Connections/admin.sde") # get a list of usernames of users currently connected and make email addresses emailList = [u.Name + "@yourcompany.com" for user in arcpy.ListUsers("Database Connections/admin.sde")] # take the email list and use it to send an email to connected users. SERVER = "mailserver.yourcompany.com" FROM = "SDE Admin <[email protected]>" TO = emailList SUBJECT = "Maintenance is about to be performed" MSG = "Auto generated Message.\n\rServer maintenance will be performed in 15 minutes. Please log off." # Prepare actual message MESSAGE = """\ From: %s To: %s Subject: %s %s """ % (FROM, ", ".join(TO), SUBJECT, MSG) # Send the mail server = smtplib.SMTP(SERVER) server.sendmail(FROM, TO, MESSAGE) server.quit() #block new connections to the database. arcpy.AcceptConnections('Database Connections/admin.sde', False) # wait 15 minutes time.sleep(900) #disconnect all users from the database. arcpy.DisconnectUser('Database Connections/admin.sde', "ALL") # Get a list of versions to pass into the ReconcileVersions tool. versionList = arcpy.ListVersions('Database Connections/admin.sde') # Execute the ReconcileVersions tool. arcpy.ReconcileVersions_management('Database Connections/admin.sde', "ALL_VERSIONS", "sde.DEFAULT", versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_TARGET_VERSION", "POST", "DELETE_VERSION", "c:/temp/reconcilelog.txt") # Run the compress tool. arcpy.Compress_management('Database Connections/admin.sde') #Allow the database to begin accepting connections again arcpy.AcceptConnections('Database Connections/admin.sde', True) #Get a list of datasets owned by the admin user # Get the user name for the workspace # this assumes you are using database authentication. # OS authentication connection files do not have a 'user' property. userName = arcpy.Describe(arcpy.env.workspace).connectionProperties.user # Get a list of all the datasets the user has access to. # First, get all the stand alone tables, feature classes and rasters. dataList = arcpy.ListTables('*.' + userName + '.*') + arcpy.ListFeatureClasses('*.' + userName + '.*') + arcpy.ListRasters('*.' + userName + '.*') # Next, for feature datasets get all of the featureclasses # from the list and add them to the master list. for dataset in arcpy.ListDatasets('*.' + userName + '.*'): dataList += arcpy.ListFeatureClasses(feature_dataset=dataset) # pass in the list of datasets owned by the admin to the rebuild indexes and analyze datasets tools # Note: to use the "SYSTEM" option the user must be an administrator. arcpy.RebuildIndexes_management(workspace, "SYSTEM", dataList, "ALL") arcpy.AnalyzeDatasets_management(workspace, "SYSTEM", dataList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE") ---------------- How such custom tool can be developed to live in a toolbox? Thank you Best Jamal
... View more
01-27-2013
09:23 AM
|
1
|
4
|
5075
|
|
POST
|
Your mistake is with the pathname string - you are mixing conventions. I prefer to stick with passing 'raw' strings so that I do not generally have to concern myself further with backslashes being interpreted by python as an escape sequence (the preceding 'r' means interpret as 'raw' string) -- see the below where I am testing the strings via IDLE:
>>> # the pathname as you have stated it:
>>> pathname = "r'Database Connections\Sa_D1.sde'"
>>> # this is incorrect, directly converting all inside the double-quotes to string:
>>> print pathname
r'Database Connections\Sa_D1.sde'
>>> # removing the double-quotes:
>>> pathname = r'Database Connections\Sa_D1.sde'
>>> # this is correct, with 'r' serving in Python to use raw string:
>>> print pathname
Database Connections\Sa_D1.sde
>>> # quick example of raw versus non-raw interpretation:
>>> # this is without the preceding 'r':
>>> nonRawExample = '\tAtest'
>>> # this string is actually interpreted to include a tab:
>>> print nonRawExample
Atest
>>> # this string includes the preceding 'r' for the raw representation:
>>> useRawExample = r'\tAtest'
>>> # as desired, the string is interpreted as is, or 'raw', to include the backslash character:
>>> print useRawExample
\tAtest
Additionally, this is a matter of preference, but I prefer whenever possible to pass variables, not strings, to my tool, as in this example, particularly when there are a number of params to feed in - such as the 11 params for ReconcileVersions:
# the ReconcileVersions pathname strings
inputDB = r'\\YourServerUNC\folderMaybeThisContainsType\SDEfiles\admins.sde'
logFile = r'C:\temp\reconcilelog.txt'
# other ReconcileVersions defined params
all = 'ALL_VERSIONS'
target = 'sde.DEFAULT'
versionList = arcpy.ListVersions(inputDB)
lock = 'LOCK_ACQUIRED'
abort = 'NO_ABORT'
conflict = 'BY_OBJECT'
resolve = 'FAVOR_TARGET_VERSION'
post = 'POST'
deleteVer = 'DELETE_VERSION'
# Execute the ReconcileVersions tool.
arcpy.ReconcileVersions_management(inputDB, all, target, versionList, lock, abort, conflict, resolve, post, deleteVer, logFile)
Hope that helps - I think it makes the code a little more readable and accessible for troubleshooting. Enjoy, Wayne Many thanks Whitley for the help, It would be highly appreciated if you attach this great python script in a custom tool in a custom toolbox. This would be much easier for the end users. [ATTACH=CONFIG]21111[/ATTACH] Best Jamal
... View more
01-27-2013
09:08 AM
|
0
|
0
|
3130
|
|
POST
|
Jamal, The Help says that the Input database connection defaults "to use the workspace defined in the environment". Since I already see the versions filled out in the dialog, I don't think there is any need to fill in the "Input database connection", as it probably just uses the connection information from the context from which you opened the option (in your case I guess the Geodatabase Administration dialog). I think the "Input database connection" text line is just an "extra" available for when you use the Reconcile Versions option straight from ArcToolbox, in a ModelBuilder model, or in Python scripting, when the connection isn't yet defined. It would have been better if unnecessary options were hidden in specific cases like this, but I guess this is the small price we need to pay for something like the flexible ModelBuilder and ArcToolbox framework. Many thanks Marco for the useful input. Very much appreciated Best Jamal
... View more
01-27-2013
01:30 AM
|
0
|
0
|
867
|
|
POST
|
see Benefits of the Web Adaptor http://resources.arcgis.com/en/help/main/10.1/0154/01540000028p000000.htm Many thanks Domenico for the answer. Then the way we access the �??service directory�?� is the only thing that the Web Adaptor introduces. i couldn't figure out its physical impact on the system (with/without Adaptor) What are we missing if we don�??t install it? Best Jamal
... View more
01-26-2013
11:15 PM
|
0
|
0
|
894
|
|
POST
|
...almost had it --- add to your search string 'users', i.e., 'disconnect users' and should get this which I think is what you are looking for: DisconnectUser (arcpy) Desktop » Geoprocessing » ArcPy » ArcPy functions http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000061000000 So in the very 1st example, there is this: arcpy.DisconnectUser("Database Connections/[email protected]", "ALL") I don't have ArcGIS 10.1 installed yet so cannot test it...but if it works, this is much better than the 'disconnection procedure' I have used before. ...you may want to test for who/what is connected first, with: ListUsers (arcpy) Desktop » Geoprocessing » ArcPy » ArcPy functionshttp://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000030000000 ahh, but there is a catch, probably a design feature 'failsafe' not to accidentally disconnect the admin user - from the webhelp: "Note: DisconnectUser will not disconnect the user who is executing the function." Many thanks Whitley for the answer. I tried the python but sounds not to work (below) [ATTACH=CONFIG]21107[/ATTACH] What might be the issue? Best Jamal
... View more
01-26-2013
09:13 PM
|
0
|
0
|
3130
|
|
POST
|
Data backup scenario in case of Enterprise and ArcGIS Sever, I�??m wondering about the best practice to back up the enterprise and arcgis server data as all the data will be physically stored on the server machine but fragmented in more than one folder Facts: 1. The data in case of sql will be stored on the path below \\P2\c\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA [ATTACH=CONFIG]21099[/ATTACH] 2. Two other folders will maintain data \\P2\c\arcgisserver \\P2\c\inetpub [ATTACH=CONFIG]21100[/ATTACH] Now: 1. How about saving the mxd that is needed to be published? Must it be saved on the server or on the client machine? What is the consequences in each case? 2. Is the best solution to back up (such fragmented data) is to take an image to the entire C drive such that in case of failure all the backed up data will be restored as it was before the failure. 3. Is other any other better scenario? Thank you Best Jamal
... View more
01-26-2013
12:26 PM
|
0
|
0
|
1100
|
|
POST
|
Is there a tool to �??disconnect�?� all the users at a time? I�??m wondering if there is a tool that can disconnect all the users at a time [ATTACH=CONFIG]21098[/ATTACH] Thank you Best Jamal
... View more
01-26-2013
11:52 AM
|
1
|
8
|
3885
|
|
POST
|
�??Input database connection�?� in case of �??reconcile versions�?�, I�??m wondering which connection should be filled out in the �??Input database connection�?�. Please, have a look on the screenshot below, which connection should be filled out? [ATTACH=CONFIG]21091[/ATTACH] Is it the parent �??Sa_D1.sde�?�? Child �??u1_D1.sde�?�? Thank you for the help, Best Jamal
... View more
01-26-2013
09:54 AM
|
0
|
2
|
1238
|
|
POST
|
The ???ArcGIS server Account??? user on the server machine, I have the following scenario: 1. P1 is the client machine and P2 is the server machine (attached) [ATTACH=CONFIG]21071[/ATTACH] 2. The ???ArcGIS server??? is installed on the server machine (P2) while the ???ArcGIS desktop??? is installed in the client machine (P1) 3. When publishing, in order to avoid copying the data to the server machine, both the database and folder need to be shared to the ???ArcGIS server Account??? user - attached [ATTACH=CONFIG]21072[/ATTACH], [ATTACH=CONFIG]21073[/ATTACH] 4. How the folder stored on the client machine (p1) will be shared to ???ArcGIS server Account??? user on the server machine (P2) - attached? [ATTACH=CONFIG]21074[/ATTACH] Thank you Best Jamal
... View more
01-25-2013
10:55 AM
|
0
|
4
|
3703
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2026 08:17 AM | |
| 1 | 09-30-2022 10:43 PM | |
| 2 | 05-05-2025 10:33 AM | |
| 1 | 05-08-2025 09:49 PM | |
| 1 | 05-06-2025 11:10 PM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|