CINXE.COM
TracBackup – The Trac Project
<!DOCTYPE html> <html lang="en-US"> <head> <!-- # block head (placeholder in theme.html) --> <!-- # block head (content inherited from layout.html) --> <title> TracBackup – The Trac Project </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!--[if IE]><script> if (/^#__msie303:/.test(window.location.hash)) window.location.replace(window.location.hash.replace(/^#__msie303:/, '#')); </script><![endif]--> <link rel="search" href="/search" /> <link rel="help" href="/wiki/TracGuide" /> <link rel="alternate" href="/wiki/TracBackup?format=txt" title="Plain Text" type="text/x-trac-wiki" /> <link rel="start" href="/wiki" /> <link rel="stylesheet" href="/chrome/common/css/trac.css" type="text/css" /> <link rel="stylesheet" href="/chrome/common/css/wiki.css" type="text/css" /> <link rel="stylesheet" href="/chrome/wikiextras/css/phrases.css" type="text/css" /> <link rel="stylesheet" href="/chrome/wikiextras/css/boxes.css" type="text/css" /> <link rel="stylesheet" href="/wikiextras/dynamicboxes.css" type="text/css" /> <link rel="stylesheet" href="/chrome/vote/css/tracvote.css" type="text/css" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <noscript> <style> .trac-noscript { display: none !important } </style> </noscript> <link type="application/opensearchdescription+xml" rel="search" href="/search/opensearch" title="Search The Trac Project"/> <script src="/chrome/common/js/jquery.js"></script> <script src="/chrome/common/js/babel.js"></script> <script src="/chrome/common/js/trac.js"></script> <script src="/chrome/common/js/search.js"></script> <script src="/chrome/common/js/folding.js"></script> <script src="/chrome/common/js/wiki.js"></script> <script> jQuery(function($) { $(".trac-autofocus").focus(); $(".trac-target-new").attr("target", "_blank"); if ($.ui) { /* is jquery-ui added? */ $(".trac-datepicker:not([readonly])") .prop("autocomplete", "off").datepicker(); // Input current date when today is pressed. var _goToToday = $.datepicker._gotoToday; $.datepicker._gotoToday = function(id) { _goToToday.call(this, id); this._selectDate(id) }; $(".trac-datetimepicker:not([readonly])") .prop("autocomplete", "off").datetimepicker(); $("#main").addClass("trac-nodatetimehint"); } $(".trac-disable").disableSubmit(".trac-disable-determinant"); setTimeout(function() { $(".trac-scroll").scrollToTop() }, 1); $(".trac-disable-on-submit").disableOnSubmit(); }); </script> <!-- # include 'site_head.html' (layout.html) --> <link rel="stylesheet" type="text/css" href="//www.edgewall.org/css/projects013.css" /> <script type="text/javascript"><!-- window.cookieconsent_options = {"message":"This website uses cookies to ensure you get the best experience on our website","dismiss":"Got it!","learnMore":"More info","link":null,"theme":"dark-bottom", "domain": "edgewall.org"}; //--></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js"></script> <script type="text/javascript"> jQuery(function($) { var $ntg = $("#newticketguide"); if ($ntg.length) $("#propertyform").prepend($ntg.detach()); }); </script> <!-- end of site_head.html --> <!-- # endblock head (content inherited from layout.html) --> <link rel="alternate" type="application/x-wiki" href="/wiki/TracBackup?action=edit&version=" title="Edit this page"/> <script> jQuery(function($) { wikiColumn($("#wikipage")); }); </script> <!-- # endblock head (placeholder in theme.html) --> </head> <body> <!-- # block body (content inherited from theme.html) --> <!-- # include 'site_header.html' (theme.html) --> <!-- site_header_trac.html --> <div id="wrapper"> <div id="topbar"> <a id="home-link" href="//www.edgewall.org/">Edgewall Software</a> </div> <div id="ew-header"> <div id="topnav"><ul> <li><a href="//www.edgewall.org/">Home</a></li> <li class="active"> <a class="trac" href="//trac.edgewall.org/">Trac</a> </li> <li> <a href="//trac-hacks.org/">Trac Hacks</a> </li> <li class=""> <a class="genshi" href="//genshi.edgewall.org/">Genshi</a> </li> <li class=""> <a class="babel" href="//babel.edgewall.org/">Babel</a> </li> <li class=""> <a class="bitten" href="//bitten.edgewall.org/">Bitten</a> </li></ul> </div> </div> <div id="ew-main"> <div id="ew-content"> <div> <script src="//www.google-analytics.com/urchin.js" type="text/javascript"></script> <script type="text/javascript">_uacct = "UA-598265-1";urchinTracker();</script> <div id="left"> <div class="block"> <ul> <li><a href="/">Home</a></li> <li><a href="/wiki/TracDownload">Download</a></li> <li><a href="/wiki/TracGuide">Documentation</a></li> <li><a href="/wiki/MailingList">Mailing Lists</a></li> <li><a href="/wiki/TracLicense">License</a></li> <li><a href="/wiki/TracFaq">FAQ</a></li> </ul> </div> </div> </div><!-- /site_header_trac.html --> <!-- end of site_header.html --> <div id="banner"> <div id="header"> <a id="logo" href="//trac.edgewall.org/"> <img alt="Trac" height="73" src="//www.edgewall.org/gfx/trac_logo.png" width="236" /></a> </div> <form id="search" action="/search" method="get"> <div> <label for="proj-search">Search:</label> <input type="text" id="proj-search" name="q" size="18" value="" /> <input type="submit" value="Search" /> </div> </form> <div id="metanav" class="nav"> <ul><li class="first"><a href="/login">Login</a></li><li ><a href="/prefs">Preferences</a></li><li ><a href="/wiki/TracGuide">Help/Guide</a></li><li class="last"><a href="/about">About Trac</a></li></ul> </div> </div> <div id="mainnav" class="nav"> <ul><li class="active first"><a href="/wiki">Wiki</a></li><li ><a href="/timeline">Timeline</a></li><li ><a href="/roadmap">Roadmap</a></li><li ><a href="/browser">Browse Source</a></li><li ><a href="/report">View Tickets</a></li><li ><a href="/wiki/NewTicket">New Ticket</a></li><li class="last"><a href="/search">Search</a></li></ul> </div> <div id="main" > <div id="pagepath" class="noprint"> <a class="pathentry first" title="View WikiStart" href="/wiki">wiki:</a><a href="/wiki/TracBackup" title="View TracBackup" class="pathentry">TracBackup</a></div> <div id="ctxtnav" class="nav"> <h2>Context Navigation</h2> <ul> <li class="first"><span id="vote" title="Vote count (+1, -1)"><img alt="Up-vote" src="/chrome/vote/aupgray.png" /><span id="votes">+0</span><img alt="Down-vote" src="/chrome/vote/adownmod.png" /></span></li> <li ><a href="/wiki/WikiStart">Start Page</a></li> <li ><a href="/wiki/TitleIndex">Index</a></li> <li class="last"><a href="/wiki/TracBackup?action=history">History</a></li> </ul> <hr /> </div> <!-- # block content (placeholder in theme.html) --> <div id="content" class="wiki narrow"> <div class="wikipage searchable"> <div id="wikipage" class="trac-content borderless"><div class="wikiextras box shadow icon information yellow"><p> This page documents the 1.4 (latest stable) release. Documentation for other releases can be found <a class="wiki" href="/wiki/TitleIndex#TracGuide:BackupandTranslations">here</a>. </p> </div><h1 class="section" id="TracBackup">Trac Backup</h1> <p> </p><div class="wiki-toc"><h4>Table of Contents</h4><ul><li class="False"><a class="False" href="/wiki/TracGuide">Index</a></li><li class="False"><a class="False" href="/wiki/TracInstall">Installation</a></li><li class="False"><a class="False" href="/wiki/TracInterfaceCustomization">Customization</a></li><li class="False"><a class="False" href="/wiki/TracPlugins">Plugins</a></li><li class="False"><a class="False" href="/wiki/TracUpgrade">Upgrading</a></li><li class="False"><a class="False" href="/wiki/TracIni">Configuration</a></li><li class="False"><a class="False" href="/wiki/TracAdmin">Administration</a></li><li class="active"><a class="False" href="/wiki/TracBackup">Backup</a></li><li class="False"><a class="False" href="/wiki/TracLogging">Logging</a></li><li class="False"><a class="False" href="/wiki/TracPermissions">Permissions</a></li><li class="False"><a class="False" href="/wiki/TracWiki">The Wiki</a></li><li class="False"><a class="False" href="/wiki/WikiFormatting">Wiki Formatting</a></li><li class="False"><a class="False" href="/wiki/TracTimeline">Timeline</a></li><li class="False"><a class="False" href="/wiki/TracBrowser">Repository Browser</a></li><li class="False"><a class="False" href="/wiki/TracRevisionLog">Revision Log</a></li><li class="False"><a class="False" href="/wiki/TracChangeset">Changesets</a></li><li class="False"><a class="False" href="/wiki/TracTickets">Tickets</a></li><li class="False"><a class="False" href="/wiki/TracWorkflow">Workflow</a></li><li class="False"><a class="False" href="/wiki/TracRoadmap">Roadmap</a></li><li class="False"><a class="False" href="/wiki/TracQuery">Ticket Queries</a></li><li class="False"><a class="False" href="/wiki/TracBatchModify">Batch Modify</a></li><li class="False"><a class="False" href="/wiki/TracReports">Reports</a></li><li class="False"><a class="False" href="/wiki/TracRss">RSS Support</a></li><li class="False"><a class="False" href="/wiki/TracNotification">Notification</a></li></ul></div><p> </p> <p> Trac backups are a copied snapshot of the entire <a class="wiki" href="/wiki/TracEnvironment">project environment</a> directory, including the database. Backups can be created using the <code>hotcopy</code> command of <a class="wiki" href="/wiki/TracAdmin">trac-admin</a>. </p> <p> <strong>Note</strong>: Trac uses the <code>hotcopy</code> nomenclature to match that of <a class="ext-link" href="https://subversion.apache.org/"><span class="icon"></span>Subversion</a>. </p> <h2 class="section" id="CreatingaBackup">Creating a Backup</h2> <p> Create a backup of a live <a class="wiki" href="/wiki/TracEnvironment">TracEnvironment</a> by running: </p> <div class="wiki-code"><div class="code"><pre>$ trac-admin /path/to/projenv hotcopy /path/to/backupdir </pre></div></div><p> The database will be locked while hotcopy is running. </p> <p> The resulting backup directory is safe to handle using standard file-based backup tools like <code>tar</code> or <code>dump</code>/<code>restore</code>. </p> <p> Please note, the <code>hotcopy</code> command will not overwrite a target directory. When the target exists the operation will end with an error: <code>Command failed: [Errno 17] File exists:</code> This is discussed in <a href="https://trac.edgewall.org/intertrac/%233198" title="#3198 in The Trac Project">#3198</a>. </p> <h2 class="section" id="RestoringaBackup">Restoring a Backup</h2> <p> To restore an environment from a backup, stop the process running Trac, ie the web server or <a class="wiki" href="/wiki/TracStandalone">tracd</a>, restore the contents of your backup to your <a class="wiki" href="/wiki/TracEnvironment">project environment</a> directory and restart the process. </p> <p> If you are using a database other than SQLite, you'll need to restore the database from the dump file. The dump file is saved in the environment <code>db</code> directory. </p> <p> To restore a PostgreSQL database backup, use the command: </p> <div class="wiki-code"><div class="code"><pre>$ psql -U <user> -d <database> -f /path/to/postgresql.dump </pre></div></div><p> The <code><database></code> option is the same as the <a class="wiki" href="/wiki/TracEnvironment#DatabaseConnectionStrings">database connection string</a> in the <a class="wiki" href="/wiki/TracIni#trac-database-option">[trac] database</a> option of the project's <code>trac.ini</code> file. </p> <p> Similarly, for MySQL: </p> <div class="wiki-code"><div class="code"><pre>$ mysql -u <user> -p <database> < /path/to/mysql.dump </pre></div></div><hr /> <p> See also: <a class="wiki" href="/wiki/TracAdmin">TracAdmin</a>, <a class="wiki" href="/wiki/TracEnvironment">TracEnvironment</a>, <a href="https://trac.edgewall.org/intertrac/TracMigrate" title="TracMigrate in The Trac Project">TracMigrate</a> </p> </div> <div class="trac-modifiedby"> <span> <a href="/wiki/TracBackup?action=diff&version=39" title="Version 39 by figaro: Update link">Last modified</a> <a class="timeline" href="/timeline?from=2022-04-19T23%3A29%3A35%2B02%3A00&precision=second" title="See timeline at Apr 19, 2022, 11:29:35 PM">3 years ago</a> </span> <span class="trac-print"> Last modified on Apr 19, 2022, 11:29:35 PM </span> </div> </div> <div id="attachments"> </div> <div class="buttons"> <form method="get" action="/wiki/TracBackup" id="modifypage"> <div> <input type="hidden" name="action" value="edit" /> <input type="submit" value="Edit this page" /> </div> </form> <form method="get" action="/attachment/wiki/TracBackup/" id="attachfile"> <div> <input type="hidden" name="action" value="new" /> <input type="submit" id="attachfilebutton" value="Attach file"/> </div> </form> </div> <div class="trac-help"> <strong>Note:</strong> See <a href="/wiki/TracWiki">TracWiki</a> for help on using the wiki. </div> </div> <!-- # block content (content inherited from layout.html) --> <script> jQuery.loadStyleSheet("/pygments/trac.css", "text/css"); </script> <div id="altlinks"> <h3>Download in other formats:</h3> <ul> <li class="last first"> <a rel="nofollow" href="/wiki/TracBackup?format=txt" class=""> Plain Text</a> </li> </ul> </div> <!-- # endblock content (content inherited from layout.html) --> <!-- # endblock content (placeholder in theme.html) --> </div> <div id="footer"><hr/> <a id="tracpowered" href="https://trac.edgewall.org/" ><img src="/chrome/common/trac_logo_mini.png" height="30" width="107" alt="Trac Powered"/></a> <p class="left"> Powered by <a href="/about"><strong>Trac 1.4.3</strong></a> <br /> By <a href="http://www.edgewall.org/">Edgewall Software</a> . </p> <p class="right">Visit the Trac open source project at<br /><a href="//trac.edgewall.org/">https://trac.edgewall.org/</a></p> </div> <!-- # include 'site_footer.html' (theme.html) --> <!-- site_footer_trac.html --> </div><!-- #ew-content --> </div> </div> <div id="ew-footer"> <p><a href="mailto:info@edgewall.com">info@edgewall.com</a></p> <p>Copyright © 2003-2024 Edgewall Software. All rights reserved.</p> </div> <div id="right"> <div id="ohloh-badge"> <a href="//www.openhub.net/p/trac"> <img src="//www.openhub.net/p/trac/widgets/project_thin_badge.gif" /> </a> </div> <script type="text/javascript"><!-- google_ad_client = "pub-3746245347013177"; google_ad_width = 120; google_ad_height = 600; google_ad_format = "120x600_as"; google_ad_channel ="9044578517"; google_ad_type = "text_image"; google_color_border = "8b8d8d"; /*google_color_border = "6b6d6d";*/ google_color_bg = "6b6d6d"; /*google_color_bg = "4b4d4d";*/ google_color_link = "336699"; google_color_url = "E2B200"; google_color_text = "8c8c8c"; /*google_color_text = "cccccc";*/ //--></script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <!-- /site_footer_trac.html --> <!-- end of site_footer.html --> <!-- # endblock body (content inherited from theme.html) --> </body> </html>