<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python to backup SDE database on Sqlserver Express? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404544#M31866</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, this is possible.&amp;nbsp; Below is an example using the &lt;A href="https://github.com/mkleehammer/pyodbc" rel="nofollow noopener noreferrer" target="_blank"&gt;PYODBC &lt;/A&gt;module:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import pyodbc

conn = pyodbc.connect('DRIVER={SQL Server};SERVER=&amp;lt;server name&amp;gt;;UID=sa;PWD=sa;Trusted_Connection=yes', autocommit=True)
backup_path = 'C:\\temp\\'
db = "VECTOR"

def backup_db(conn, db, backup_path):
&amp;nbsp; cur = conn.cursor()
&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.execute('BACKUP DATABASE ? TO DISK=?', [db, backup_path + db + r'.bak'])
&amp;nbsp;&amp;nbsp;&amp;nbsp; while cur.nextset(): 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.close()
&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Unable to backup: ' + db

backup_db(conn, db, backup_path)

conn.close()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:25:48 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-12-11T18:25:48Z</dc:date>
    <item>
      <title>Python to backup SDE database on Sqlserver Express?</title>
      <link>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404543#M31865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to use Python to do a backup of SDE databases stored in Sqlserver Express?&amp;nbsp; I have been using a custom executable that uses Arcobjects IDataServerManagerAdmin.BackupGeodatabase() but, I would prefer to use Python. The executable makes our IT staff a bit nervous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2015 18:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404543#M31865</guid>
      <dc:creator>DavidDoop</dc:creator>
      <dc:date>2015-09-09T18:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python to backup SDE database on Sqlserver Express?</title>
      <link>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404544#M31866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, this is possible.&amp;nbsp; Below is an example using the &lt;A href="https://github.com/mkleehammer/pyodbc" rel="nofollow noopener noreferrer" target="_blank"&gt;PYODBC &lt;/A&gt;module:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import pyodbc

conn = pyodbc.connect('DRIVER={SQL Server};SERVER=&amp;lt;server name&amp;gt;;UID=sa;PWD=sa;Trusted_Connection=yes', autocommit=True)
backup_path = 'C:\\temp\\'
db = "VECTOR"

def backup_db(conn, db, backup_path):
&amp;nbsp; cur = conn.cursor()
&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.execute('BACKUP DATABASE ? TO DISK=?', [db, backup_path + db + r'.bak'])
&amp;nbsp;&amp;nbsp;&amp;nbsp; while cur.nextset(): 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.close()
&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Unable to backup: ' + db

backup_db(conn, db, backup_path)

conn.close()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:25:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404544#M31866</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T18:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python to backup SDE database on Sqlserver Express?</title>
      <link>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404545#M31867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you haven't already, it might be worth checking out the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/manage-data/geodatabases/methods-for-copying-geodatabases-overview-of-copyi.htm"&gt;Overview of copying geodatabases &lt;/A&gt;documentation, it covers a few different ways of getting data in bulk out of geodatabases.&amp;nbsp; A note of caution, one of the links is incorrect and redirects you to another link.&amp;nbsp; See the ArcGIS 10.2.x Help for &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Copying_a_geodatabase_using_the_Copy_tool/003n0000002w000000/"&gt;Copying a geodatabase using the Copy tool.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2015 21:34:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-to-backup-sde-database-on-sqlserver-express/m-p/404545#M31867</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-09-09T21:34:58Z</dc:date>
    </item>
  </channel>
</rss>

