Vince I have both 64-bit and 32-bit Oracle clients installed on the map server (since it was an AWS build, the 64-bit was already installed). I confirmed with my Oracle DBA that I am not getting any connection to the database. Below is just a portion of my script (although it lost the formatting). I have confirmed that if I copy the SDE file that is created in Python to the appropriate folder, I can open it with ArcCatalog.
import arcpy, os
from arcpy import env
arcpy.env.overwriteOutput = True
# Set local variables
gdb_in = r"C:\Users\Administrator\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\Real_Property.sde" #path to input geodatabase
gdb_in2 = r"C:\Users\Administrator\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\GIS_Support_v1_1_testZ.sde" #path to input geodatabase
Database_Connections = "C:\\Users\\Administrator\\AppData\\Roaming\\ESRI\\Desktop10.5\\ArcCatalog"
script_path = sys.path[0]
out_folder_path = script_path
out_name_GIS = r"GIS_Support_v1_1_testZ.sde"
out_name_RP = r"Real_Property.sde"
gdb_out = r"D:\data\stats" #path to output geodatabase
d = str(datetime.date.today().strftime("%Y%m%d"))
out_name = "qaqc_"+d+".gdb"
feature_classes = []
sde_GIS = arcpy.CreateDatabaseConnection_management(out_folder_path,
out_name_GIS,
"ORACLE", # Database platform
"sde:oracle11g:ztracs", # "ztracs" 32-bit instance name 64-bit instance name = "testz_tracs"
"DATABASE_AUTH", # account authentication type
"GIS_Support_v1_1", # username
"Hjs#Jl_3234jksdf#") # password
# "SAVE_USERNAME")
gdb_out_ds = arcpy.CreateFileGDB_management(gdb_out, out_name)
output = str(gdb_out_ds)
fc = str(sde_GIS)+"\State_Polygons"
fc2 = r"GIS_Support_v1_1.State_Polygons"
# Feature dataset in GIS_Support_v1_1 schema
print script_path
#Path to SDE using script path variable
sdeconn = os.path.join(str(script_path), str(sde_GIS))
print sdeconn
#Path to feature class
polfc = os.path.join(sdeconn, fc2)
print polfc
ws = arcpy.env.workspace = sdeconn
print ws
if arcpy.Exists(ws):
print("Exists")
fcList = arcpy.ListFeatureClasses()
for fc in fcList:
print fc
print "Made it to here"
arcpy.Statistics_analysis(str(sde_GIS)+"\\"+fc2, output+"\\"+fc2, "OBJECTID FIRST", "STATE_ABBREV")
...
The results are:
D:\scripts
D:\scripts\GIS_Support_v1_1_testZ.sde
D:\scripts\GIS_Support_v1_1_testZ.sde\GIS_Support_v1_1.State_Polygons
D:\scripts\GIS_Support_v1_1_testZ.sde
Exists
Made it to here
Traceback (most recent call last):
File "D:\scripts\Statistics_QAQC_testz.py", line 64, in <module>
arcpy.Statistics_analysis(str(sde_GIS)+"\\"+fc2, output+"\\"+fc2, "OBJECTID FIRST", "STATE_ABBREV")
File "C:\Program Files\ArcGIS\Server\ArcPy\arcpy\analysis.py", line 1338, in Statistics
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Table: Dataset D:\scripts\GIS_Support_v1_1_testZ.sde\GIS_Support_v1_1.State_Polygons does not exist or is not supported
Failed to execute (Statistics).