?i»?

Your IP : 3.15.25.159


Current Path : /home/scgforma/www/cloud/core/doc/admin/maintenance/
Upload File :
Current File : /home/scgforma/www/cloud/core/doc/admin/maintenance/restore.html

<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Restoring backup &mdash; Nextcloud 13 Administration Manual 13 documentation</title>
    
    <link rel="stylesheet" href="../_static/" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/main.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/styles.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '13',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../_static/js/jquery-fix.js"></script>
    <script type="text/javascript" src="../_static/bootstrap-3.1.0/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
    <link rel="top" title="Nextcloud 13 Administration Manual 13 documentation" href="../contents.html" />
    <link rel="up" title="Maintenance" href="index.html" />
    <link rel="next" title="How to upgrade" href="upgrade.html" />
    <link rel="prev" title="Backup" href="backup.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#1d2d44">

  </head>
  <body role="document">


<div class="wrap container not-front">
  <div class="content row">
  <main class="main">
    
			<div class="row">
				<div class="col-md-3">
					<div class="sidebar">
            <h1>Nextcloud 13 Administration Manual</h1>
            
            <div class="sidebar-search">
              <form class="headersearch" action="../search.html" method="get">
                <input type="text" value="" name="q" id="q" class="form-control" /> 
                <button  class="btn btn-default" type="submit" id="searchsubmit">Search</button>
              </form>
            </div>
            
							<div class="menu-support-container">
								<ul id="menu-support" class="menu">
									<ul>
                    <li><a href="../contents.html">Table of Contents</a></li>
									</ul>
                  <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release_notes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_server/index.html">Server configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_user/index.html">User management</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_files/index.html">File sharing and management</a></li>
<li class="toctree-l1"><a class="reference internal" href="../file_workflows/index.html">File workflows</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_database/index.html">Database configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../configuration_mimetypes/index.html">Mimetypes management</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Maintenance</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="backup.html">Backup</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Restoring backup</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#restore-folders">Restore folders</a></li>
<li class="toctree-l3"><a class="reference internal" href="#restore-database">Restore database</a></li>
<li class="toctree-l3"><a class="reference internal" href="#restoring">Restoring</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="upgrade.html">How to upgrade</a></li>
<li class="toctree-l2"><a class="reference internal" href="update.html">Upgrade via built-in updater</a></li>
<li class="toctree-l2"><a class="reference internal" href="manual_upgrade.html">Upgrade manually</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_upgrade.html">Upgrade via packages</a></li>
<li class="toctree-l2"><a class="reference internal" href="migrating.html">Migrating to a different server</a></li>
<li class="toctree-l2"><a class="reference internal" href="migrating_owncloud.html">Migrating from ownCloud</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../issues/index.html">Issues and troubleshooting</a></li>
</ul>

								</ul>
							</div>
					</div>
				</div>
        

				<div class="col-md-9">
					<div class="page-content">
            
<ul class="prevnext-title list-unstyled list-inline">
  <li class="prev">
    <a href="backup.html" title="Previous Chapter: Backup"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm">&laquo; Backup</span>
    </a>
  </li>
  <li class="next">
    <a href="upgrade.html" title="Next Chapter: How to upgrade"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm">How to upgrade &raquo;</span>
    </a>
  </li>
</ul>
						
  <div class="section" id="restoring-backup">
<h1>Restoring backup<a class="headerlink" href="#restoring-backup" title="Permalink to this headline">¶</a></h1>
<p>To restore a Nextcloud installation there are four main things you need to
restore:</p>
<ol class="arabic simple">
<li>The configuration directory</li>
<li>The data directory</li>
<li>The database</li>
<li>The theme directory</li>
</ol>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You must have both the database and data directory. You cannot
complete restoration unless you have both of these.</p>
</div>
<p>When you have completed your restoration, see the <code class="docutils literal"><span class="pre">Setting</span> <span class="pre">Strong</span> <span class="pre">Directory</span>
<span class="pre">Permissions</span></code> section of <a class="reference internal" href="../installation/installation_wizard.html"><em>Installation wizard</em></a>.</p>
<p>Also make sure to run the <a class="reference internal" href="../configuration_server/occ_command.html#maintenance-commands-label"><span>maintenance:data-fingerprint</span></a> command
afterwards, to ensure your sync clients can recover from the restored backup.</p>
<div class="section" id="restore-folders">
<h2>Restore folders<a class="headerlink" href="#restore-folders" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This guide assumes that your previous backup is called
&#8220;nextcloud-dirbkp&#8221;</p>
</div>
<p>Simply copy your configuration and data folder (or even your whole Nextcloud
install and data folder) to your Nextcloud environment. You could use this command:</p>
<div class="highlight-python"><div class="highlight"><pre>rsync -Aax nextcloud-dirbkp/ nextcloud/
</pre></div>
</div>
</div>
<div class="section" id="restore-database">
<h2>Restore database<a class="headerlink" href="#restore-database" title="Permalink to this headline">¶</a></h2>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Before restoring a backup you need to make sure to delete all existing database tables.</p>
</div>
<p>The easiest way to do this is to drop and recreate the database.
SQLite does this automatically.</p>
<div class="section" id="mysql">
<h3>MySQL<a class="headerlink" href="#mysql" title="Permalink to this headline">¶</a></h3>
<p>MySQL is the recommended database engine. To restore MySQL:</p>
<div class="highlight-python"><div class="highlight"><pre>mysql -h [server] -u [username] -p[password] -e &quot;DROP DATABASE nextcloud&quot;
mysql -h [server] -u [username] -p[password] -e &quot;CREATE DATABASE nextcloud&quot;
</pre></div>
</div>
<p>If you use UTF8 with multibyte support (e.g. for emoijs in filenames), use:</p>
<div class="highlight-python"><div class="highlight"><pre>mysql -h [server] -u [username] -p[password] -e &quot;DROP DATABASE nextcloud&quot;
mysql -h [server] -u [username] -p[password] -e &quot;CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci&quot;
</pre></div>
</div>
</div>
<div class="section" id="postgresql">
<h3>PostgreSQL<a class="headerlink" href="#postgresql" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>PGPASSWORD=&quot;password&quot; psql -h [server] -U [username] -d nextcloud -c &quot;DROP DATABASE \&quot;nextcloud\&quot;;&quot;
PGPASSWORD=&quot;password&quot; psql -h [server] -U [username] -d nextcloud -c &quot;CREATE DATABASE \&quot;nextcloud\&quot;;&quot;
</pre></div>
</div>
</div>
</div>
<div class="section" id="restoring">
<h2>Restoring<a class="headerlink" href="#restoring" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This guide assumes that your previous backup is called
&#8220;nextcloud-sqlbkp.bak&#8221;</p>
</div>
<div class="section" id="id1">
<h3>MySQL<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<p>MySQL is the recommended database engine. To restore MySQL:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">mysql</span> <span class="o">-</span><span class="n">h</span> <span class="p">[</span><span class="n">server</span><span class="p">]</span> <span class="o">-</span><span class="n">u</span> <span class="p">[</span><span class="n">username</span><span class="p">]</span> <span class="o">-</span><span class="n">p</span><span class="p">[</span><span class="n">password</span><span class="p">]</span> <span class="p">[</span><span class="n">db_name</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">nextcloud</span><span class="o">-</span><span class="n">sqlbkp</span><span class="o">.</span><span class="n">bak</span>
</pre></div>
</div>
</div>
<div class="section" id="sqlite">
<h3>SQLite<a class="headerlink" href="#sqlite" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>rm data/owncloud.db
sqlite3 data/owncloud.db &lt; nextcloud-sqlbkp.bak
</pre></div>
</div>
</div>
<div class="section" id="id2">
<h3>PostgreSQL<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre>PGPASSWORD=&quot;password&quot; pg_restore -c -d nextcloud -h [server] -U [username]
nextcloud-sqlbkp.bak
</pre></div>
</div>
</div>
</div>
</div>


            
<ul class="prevnext-title list-unstyled list-inline">
  <li class="prev">
    <a href="backup.html" title="Previous Chapter: Backup"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm">&laquo; Backup</span>
    </a>
  </li>
  <li class="next">
    <a href="upgrade.html" title="Next Chapter: How to upgrade"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm">How to upgrade &raquo;</span>
    </a>
  </li>
</ul>
					</div>
				</div>
			</div>
  </main>  
  </div>
</div>
  </body>
</html>