<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Backup &#8211; EV Blog</title>
	<atom:link href="https://blog.elevatedvision.co.uk/category/backup/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.elevatedvision.co.uk</link>
	<description></description>
	<lastBuildDate>Thu, 25 Jan 2024 11:48:15 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.2</generator>

<image>
	<url>https://blog.elevatedvision.co.uk/wp-content/uploads/2023/12/cropped-EV-Website-Icon-60x60-1.png</url>
	<title>Backup &#8211; EV Blog</title>
	<link>https://blog.elevatedvision.co.uk</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>DJI Terra &#8211; Single Point of Failure &#8211; Mission.db</title>
		<link>https://blog.elevatedvision.co.uk/dji-terra-single-point-of-failure-mission-db/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dji-terra-single-point-of-failure-mission-db</link>
					<comments>https://blog.elevatedvision.co.uk/dji-terra-single-point-of-failure-mission-db/#respond</comments>
		
		<dc:creator><![CDATA[Robert]]></dc:creator>
		<pubDate>Thu, 25 Jan 2024 00:08:25 +0000</pubDate>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[DJI]]></category>
		<category><![CDATA[Mission.db]]></category>
		<category><![CDATA[Terra]]></category>
		<category><![CDATA[Uncategorised]]></category>
		<guid isPermaLink="false">https://blog.elevatedvision.co.uk/?p=348</guid>

					<description><![CDATA[In this article I’m going to show a method for backing up a file that DJI Terra heavily relies on, it uses this file to store all project information and is in effect a single point of failure. The file lives in the DJI Cache and is called Mission.DB. The reason why this file should &#8230;<p class="read-more"> <a class="" href="https://blog.elevatedvision.co.uk/dji-terra-single-point-of-failure-mission-db/"> <span class="screen-reader-text">DJI Terra &#8211; Single Point of Failure &#8211; Mission.db</span> Read More &#187;</a></p>]]></description>
										<content:encoded><![CDATA[<p>In this article I’m going to show a method for backing up a file that DJI Terra heavily relies on, it uses this file to store all project information and is in effect a single point of failure. The file lives in the DJI Cache and is called <strong>Mission.DB</strong>.</p>
<p>The reason why this file should be backed up regularly is because if it gets corrupted, you cannot load your projects.</p>
<p>I’ve seen a couple of posts about this file corrupting, and although Terra may be the culprit there are other more likely reasons a file can become corrupted such as a power outage during a write operation, or a disk issue, so to be safe and not sorry, here’s how to protect the file.</p>
<p>The method we’ll use here is a PowerShell script that runs on a schedule in the background, it’ll create backup’s of Mission.DB and call them mission.db.backup.&lt;Serial Number&gt;, e.g. <strong>missions.db.backup.1</strong></p>
<p>We’re going to need to create a new file and a new scheduled task, but before we get underway go and find your DJI Cache folder, make a note of the full path as we’ll refer to it in the rest of this article as <strong>&lt;DJI Cache Folder&gt;</strong>.</p>
<p>You can find the DJI Cache from within DJI Terra preferences as shown below:</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-85.png"><img fetchpriority="high" decoding="async" width="604" height="1194" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-73.png" border="0"></a></p>
<p>Let’s create that file now, mash that Windows key and type in Notepad and press Enter</p>
<p>When it opens paste in the script from below, and after pasting you <u>must </u>change the DJICacheFolder variable on the first line, make sure it correctly reflects your DJI cache folder:</p>
<p></p>
<p># Variables to control the script</p>
<p>$DJICacheFolder = &#8220;<strong>D:\PSTest</strong>&#8220;<br />
$RemoveFilesOlderThan = &#8220;-7&#8221;</p>
<p># Get the last backup sequence number so we can increment it<br />
$currentBackupSerialNumber = Get-ChildItem -Path $DJICacheFolder -Filter mission.db.backup* | Sort-Object CreationTime -Descending | Select-Object -First 1<br />
$nextBackupSerialNumber = $currentBackupSerialNumber.BaseName + &#8220;.&#8221; + ([int]$currentBackupSerialNumber.Extension.Split(&#8216;.&#8217;)[1] + 1)</p>
<p># Create a backup of the Mission.db file<br />
Write-Host &#8220;Next serial = &#8221; + $nextBackupSerialNumber<br />
Copy-Item -Force -Path D:\mission.db -Destination $DJICacheFolder\$nextBackupSerialNumber </p>
<p># Remove files older than X days old<br />
Get-ChildItem -Path $DJICacheFolder -Filter mission.db.backup.* | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays($RemoveFilesOlderThan)) } | Remove-Item</p>
<p></p>
<p>I’ve included the script as a screenshot just in case your web browser is changing anything when your copy the script above:</p>
<p></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-86.png"><img decoding="async" width="955" height="297" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-74.png" border="0"></a></p>
<p>Now save the file to your DJI Cache and call it <strong>MissionDBBackup.PS1</strong>, before saving change <strong>Save as type</strong> to <strong>All Files (*.*)</strong>, if you don’t do this the file will be appended with <strong>.TXT</strong> and things won’t work.</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-87.png"><img decoding="async" width="532" height="164" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-75.png" border="0"></a></p>
<p>Check that the file is in the DJI cache folder, is correctly named and has the PS1 file extension not .TXT</p>
<p>Now open Microsoft Windows Task Scheduler, you can do this in a variety of ways, pressing the Windows key and typing Task Scheduler should get you there.</p>
<p>Once opened right-click the <strong>Task Scheduler Library </strong>text and select <strong>New Folder</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-71.png"><img loading="lazy" decoding="async" width="606" height="682" title="image" style="border-image: none; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-59.png" border="0"></a></p>
<p>Choose a name for the folder, anything from Custom to your company name</p>
<p></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-72.png"><img loading="lazy" decoding="async" width="606" height="236" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-60.png" border="0"></a></p>
<p>First select the new folder and then right-click and select <strong>Create Basic Task</strong></p>
<p></p>
<p></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-74.png"><img loading="lazy" decoding="async" width="606" height="834" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-62.png" border="0"></a></p>
<p>The task needs a descriptive name, I’ve chosen <strong>DJI Terra – Backup Mission.db</strong>, once entered press <strong>Next</strong></p>
<p></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-70.png"><img loading="lazy" decoding="async" width="606" height="426" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-58.png" border="0"></a></p>
<p>Keep the setting as they are, select <strong>Next</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-75.png"><img loading="lazy" decoding="async" width="606" height="426" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-63.png" border="0"></a></p>
<p>Same as above, don’t change anything simply select <strong>Next</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-76.png"><img loading="lazy" decoding="async" width="606" height="426" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-64.png" border="0"></a></p>
<p>We want to run a program when this scheduled task is told to run, so make sure <strong>Start a program</strong> is selected and select <strong>Next</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-77.png"><img loading="lazy" decoding="async" width="606" height="426" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-65.png" border="0"></a></p>
<p><p>For the <strong>Program/script</strong> text box enter the following: <strong>powershell.exe</strong></p>
<p>For the <strong>Add arguments (optional)</strong> text box enter the following after replacing the <strong>&lt;DJI Cache Folder&gt;</strong> references to become the path to your DJI Cache: <strong>-ExecutionPolicy Bypass –File &lt;DJI Cache Folder&gt;\MissionDBBackup.PS1</strong>, when done select Next</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-88.png"><img loading="lazy" decoding="async" width="606" height="426" title="image" style="border-image: none; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-76.png" border="0"></a></p>
<p>Select that tick box to open the task’s properties and then select <strong>Finish</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-89.png"><img loading="lazy" decoding="async" width="606" height="426" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-77.png" border="0"></a></p>
<p>You should see the properties sheet appear showing the <strong>General</strong> tab, select <strong>Run whether user is logged on or not</strong>, this stops the PowerShell window appearing for a second when the task runs, select the <strong>Triggers</strong> tab after you are done</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-90.png"><img loading="lazy" decoding="async" width="606" height="461" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-78.png" border="0"></a></p>
<p>Click that trigger called <strong>Daily </strong>and select <strong>Edit</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-80.png"><img loading="lazy" decoding="async" width="606" height="461" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-68.png" border="0"></a></p>
<p>Now tick <strong>Repeat task every</strong> and choose <strong>1 hour</strong>,<strong> </strong>or choose however long in-between backups you prefer, you could set this to every 12 hours so at least one backup is made each day if the computer is turned on. Tick <strong>Stop task if it runs longer than</strong> and set that to <strong>30 minutes</strong>. Now select the <strong>Conditions</strong> tab </p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-81.png"><img loading="lazy" decoding="async" width="606" height="531" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-69.png" border="0"></a></p>
<p>Untick <strong>Start the task only if the computer is on AC power</strong> which will let the backup run if you are using a laptop. Select the <strong>Settings</strong> tab.</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-82.png"><img loading="lazy" decoding="async" width="606" height="461" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-70.png" border="0"></a></p>
<p>Tick <strong>Run task as soon as possible after a scheduled start is missed</strong>, this will trigger the backup straight away if you’ve left the computer off for a long time and turn it back on. You can set the other options as shown in the shot below, when done select <strong>OK</strong></p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-83.png"><img loading="lazy" decoding="async" width="606" height="461" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-71.png" border="0"></a></p>
<p>Because we set the task to run as non-interactive\hidden, we need to punch in some credentials for the task to run under, this should be your local account</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-91.png"><img loading="lazy" decoding="async" width="606" height="494" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-79.png" border="0"></a></p>
<p>You should see your new Task appear in the folder you created</p>
<p><a href="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image-84.png"><img loading="lazy" decoding="async" width="606" height="291" title="image" style="margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" alt="image" src="https://blog.elevatedvision.co.uk/wp-content/uploads/2024/01/image_thumb-72.png" border="0"></a></p>
<p>To check this all works, right click your new task and select Run. </p>
<p>Do you see a new backup file in your DJI Cache folder? If so you’re good to go. </p>
<p>And to recover if mission.db does get corrupted or accidently deleted just make sure Terra is closed, rename mission.db to mission.db.faulty, and get one of the latest backups and rename it to mission.db, start Terra see what gives, replace with older backups until you get a non-corrupted copy of the file.</p>
<p></p>
<p>If it isn’t working things that can go wrong are:</p>
<ul>
<li>PowerShell cannot find the script, is it named correctly, is the file extension set to PS1?</li>
<li>The script or the scheduled task cannot find the DJI Cache folder, do you have the path to your DJI Cache set correctly in the script and task?</li>
<li>Worth checking that you have not typed something in wrongly somewhere, go back and double check what you entered</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.elevatedvision.co.uk/dji-terra-single-point-of-failure-mission-db/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
