import arcpy, os, string arcpy.env.overwriteOutput = True DS3 = "C:\GIS\DS.gdb" if arcpy.Exists(DS3): arcpy.Delete_management(DS3) def CopyDatasets(start_db,end_db,num): #Set workspaces arcpy.env.workspace = start_db wk2 = end_db datasetList = arcpy.ListDatasets() #for feature classes within datasets for dataset in datasetList: print "Reading: {0}".format(dataset) name = arcpy.Describe(dataset) new_data=name.name[num:] if arcpy.Exists(wk2 + os.sep + new_data)==False: arcpy.Copy_management(dataset, wk2 + os.sep + new_data) print "Completed copy on {0}".format(new_data) else: print "Dataset {0} already exists in the end_db so skipping".format(new_data) #Clear memory del dataset def CopyFeatureClasses(start_db,end_db,num): #Set workspaces arcpy.env.workspace = start_db wk2 = end_db datasetList = arcpy.ListDatasets() #for feature classes within datasets for fc in arcpy.ListFeatureClasses(): print "Reading: {0}".format(fc) name = arcpy.Describe(fc) new_data=name.name[num:] if arcpy.Exists(wk2 + os.sep + new_data)==False: arcpy.Copy_management(fc, wk2 + os.sep + new_data) print "Completed copy on {0}".format(new_data) else: print "Feature class {0} already exists in the end_db so skipping".format(new_data) #Clear memory del fc def CopyTables(start_db,end_db,num): #Set workspaces arcpy.env.workspace = start_db wk2 = end_db datasetList = arcpy.ListDatasets() #for feature classes within datasets for table in arcpy.ListTables(): print "Reading: {0}".format(table) name = arcpy.Describe(table) new_data=name.name[num:] if arcpy.Exists(wk2 + os.sep + new_data)==False: arcpy.Copy_management(table, wk2 + os.sep + new_data) print "Completed copy on {0}".format(new_data) else: print "Table {0} already exists in the end_db so skipping".format(new_data) #Clear memory del table if __name__== "__main__": start_db = "C:\GIS\PARCEL\Parcel.gdb" #Origin Database end_db = "C:\GIS\DS.gdb" #To database num = 8 #number of characters in schema (for example: sde.sde. is 8) arcpy.Copy_management(start_db,end_db,num) arcpy.Copy_management(start_db,end_db,num) arcpy.CopyRows_management(start_db,end_db,num)
ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Rows: Dataset C:\GIS\PARCEL\Parcel.gdb does not exist or is not supported Failed to execute (CopyRows)
Solved! Go to Solution.
A little old thread but i am trying to figure out how to save over my network.
I currently have tried the using the UNC path but no luck.
like the following but no luck.
server_backup_path ='\\\\ccdept\\dsd\\GIS\\'
Some functions trip on UNC paths on occasion so it may be easier to save it locally to the database and move it with shutil.copy to the network location. Also, instead of trying to escape the slashes just flip your slashes forward, or wrap the whole thing in triple quotes and only give it what slashes you really want: """\\ccdept\dsd\GIS"""
Shutil.copy worked out best.
Thanks!
Tony,
You may also look into a maintenance plan that is available with SQL Server. You can add a backup database task to the plan and just schedule it. See this microsoft developer network document.