sdetable -o update_dbms_stats
Hi Seth-It's Jeremy Hazel, we worked together fall semester in 2009. I'm interested to know if you are using any replication at all or are you only maintaining a single database? I'm having some issues with compressing a replicated database and thought maybe you could help. I've posted a thread on this forum here http://forums.arcgis.com/threads/26048-SDE-compression-and-One-way-replication.We are using the sdetable -o update_dbms_stats within a batch file here before and after our compression operation but are not updating near as many tables as you. We are specifying the tables to update stats on individually. Would it be worth it for you to use python to iterate through the table_registry, grab the name of each table and write it out to the -t option of the sdetable -o update_dbms_stats command in a txt file, appending a new command for each table and then run the resulting txt file as a batch process? Just a thought...
#!/bin/bash ########################################################################## # Batch analyze script # Query ArcSDE to get a list of all datasets in the database, then # iterate through each owner.dataset to update DBMS statistics (ANALYZE). # Output is logged to a file and optionally, a summary may be e-mailed to # the ArcSDE administrator. # Tested to work with ArcSDE/Oracle on RHEL 5. # Author: Seth Peery, Virginia Polytechnic Institute and State University # E-mail: sspeery@vt.edu # Last Modified 2011-04-15 # Licensed under a Creative Commons Attribution 3.0 Unported License # http://creativecommons.org/licenses/by/3.0/ ########################################################################## # PREREQUISITE: # Set the following variables to match your environment # N.B. be sure to chmod the referent of PASSWORDFILE to 600! OUT_DIR=/path/to/script/output # logfile destination PASSWORDFILE=$OUT_DIR/sdepass.txt # a single-line file with sde password SERVER_NAME="myserver.example.com" # hostname of SDE server DBMS_INSTANCE="my_TNS_entry" # TNS entry for SDE's Oracle Instance SEND_EMAIL=true # set to true to send $SUMMARYFILE ADMIN_EMAIL="foo@example.com" # admin's e-mail address LAYERLIST=/tmp/allsdelayers.txt # no real need to change this # Now, process the above to set password and output location variables. PASSWORD=$(cat $PASSWORDFILE | head -n 1) LOGFILE=$OUT_DIR/analyze_log_$(date +%F) SUMMARYFILE=$OUT_DIR/analyze_summary_$(date +%F) # Write the opening banner. Note that the first line truncates # any existing logfile with the same name. # If you want this to operate silently, # replace 'tee -a' with '>>' and 'tee' with '>'. echo '********************************************' | tee $SUMMARYFILE $LOGFILE echo '******* ArcSDE Batch Analyze Utility *******' | tee -a $SUMMARYFILE $LOGFILE echo '********************************************' | tee -a $SUMMARYFILE $LOGFILE echo 'Analyze operation initiated ' $(date) | tee -a $SUMMARYFILE $LOGFILE echo "Logging output to $LOGFILE" | tee -a $SUMMARYFILE # Here's the SQL command we send to SQL*PLUS # to get a list of all the objects in sde.table_registry { echo "set pagesize 0"; echo "set feedback off"; echo "select owner || '.' || table_name from table_registry order by owner, table_name;"; } | sqlplus -s sde/$PASSWORD@$DBMS_INSTANCE > $LAYERLIST; echo 'Processing' $(cat $LAYERLIST | wc -l ) 'layers...' | tee -a $SUMMARYFILE echo 'Any errors encountered during this process will be listed below.' | tee -a $SUMMARYFILE echo '----------------------------------------------------------------' | tee -a $SUMMARYFILE # Iterate through the layer list and run sdetable -o update_dbms_stats. numLayers=0 numProcessedOK=0 for i in $(cat $LAYERLIST); do # Attempt to run Analyze on each layer sdetable -o update_dbms_stats -u sde -p $PASSWORD -t $i &> /tmp/dbstats.out; # Test for errors by grepping for the string "Error" errorsPresent=$(grep Error /tmp/dbstats.out | wc -l) let numLayers=$numLayers+1 if [ $errorsPresent -gt 0 ]; then # Log the ArcSDE error messages (anything that says "Error") grep Error /tmp/dbstats.out | tee -a $LOGFILE $SUMMARYFILE else # Log the last line of ArcSDE dbms_stats command output # as our indication of success tail -n 1 /tmp/dbstats.out >> $LOGFILE let numProcessedOK=$numProcessedOK+1 fi done echo '----------------------------------------------------------------' | tee -a -a $SUMMARYFILE echo 'Done.' echo $numProcessedOK layers out of $numLayers analyzed OK. | tee -a $SUMMARYFILE $LOGFILE echo 'Analyze operation completed' $(date) | tee -a $SUMMARYFILE $LOGFILE if [ "$SEND_EMAIL" == "true" ]; then SUBJECT="$SERVER_NAME Analyze log for $(date +%F)" EMAIL=$ADMIN_EMAIL EMAILMESSAGE=$SUMMARYFILE /bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE fi
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.