How to delete a Not Found Dashboard

Hi all,
In my list of dashboards, there is a dashboard which I don’t know why - now when I choose it, it says “Dashboard not found”. I decided to create another one and I want to delete the old one from the list of dashboards, but there is no Delete option. Can anyone show me how to do it?

Thanks in advance

Looks like something is wrong with the uid if you’re on Grafana v5.

Inspect the dashboard row in the database using SELECT * FROM dashboard. Please paste the output of the row that you cannot choose here since it would be interesting to know how this have happened.

Then you can delete the dashboard manually in the database table using DELETE FROM dashboard WHERE id =<insert id of your dashboard that you cannot choose here>.

Marcus

Thank you so much. I will do it and tell you the result.
Have a nice day :sunny:

Hi,
I tried to delete but it shows an error:

Error: database disk image is malformed

Below is the output of SELECT command. Sorry I have to remove some part of it because of privacy.

79|59|influxdb|InfluxDB|{“annotations”:{“list”:[]},“editable”:true,“gnetId”:null,“graphTooltip”:1,“hideControls”:false,“id”:79,“links”:[{“icon”:“external link”,“includeVars”:true,“keepTime”:true,“tags”:[],“type”:“dashboards”}],“refresh”:“5m”,“rows”:[{“collapse”:false,“height”:“100px”,“panels”:[{“cacheTimeout”:null,“colorBackground”:false,“colorValue”:true,“colors”:[“rgba(50, 172, 45, 0.97)”,“rgba(237, 129, 40, 0.89)”,“rgba(245, 54, 54, 0.9)”],“datasource”:null,“decimals”:1,“editable”:true,“error”:false,“format”:“none”,“gauge”:{“maxValue”:100,“minValue”:0,“show”:false,“thresholdLabels”:false,“thresholdMarkers”:true},“id”:9,“interval”:null,“links”:[],“mappingType”:1,“mappingTypes”:[{“name”:“value to text”,“value”:1},{“name”:“range to text”,“value”:2}],“maxDataPoints”:100,“nullPointMode”:“connected”,“nullText”:null,“postfix”:"",“postfixFontSize”:“50%”,“prefix”:“Current”,“prefixFontSize”:“50%”,“rangeMaps”:[{“from”:“null”,“text”:“N/A”,“to”:“null”}],“span”:4,“sparkline”:{“fillColor”:“rgba(31, 118, 189, 0.18)”,“full”:true,“lineColor”:“rgb(31, 120, 193)”,“show”:true},“timezone”:“browser”,“title”:“InfluxDB”,“version”:59}|9|2016-04-28 12:31:44|2018-01-09 12:21:42|15|||

Seems like your sqlite database is corrupt and that would be the first thing for you to fix. I Google’d sqlite Error: database disk image is malformed and there’s a lot of posts explaining how to fix these kinds of problem, for example http://www.froebe.net/blog/2015/05/27/error-sqlite-database-is-malformed-solved/.

Marcus

Yes, I tried to fix it, but then it returned a zero size database. Then I followed this link to fix it https://stackoverflow.com/questions/44602759/sqlite3-recreates-empty-database-from-dump-file, but it created an incomplete database file. I guess that the database creation stopped at the point of corruption. I will try to fix it and update to you.
Thanks for your support :slight_smile:

Hi, I tried for some time fixing the DB, but it’s somehow corrupted. Currently our Grafana still runs normally, but I wonder if it will fail in the future. Is there anyway to export all Grafana data (dashboards, profiles, datasources, etc.) and import them to a new db?

Yeah the link I included describes how to generate a sql script with all structures and data and then create a new sqlite database from it.

Marcus

Sorry but I did follow that guide before, but in the exported db, there are some corrupted lines like this - which I guess they are the reason why when I create the database and load the exported schema & data, it failed because of errors

INSERT INTO “dashboard_version” VALUES(8,79,56,56,56,‘2017-06-29 08:44:37’,6,’’,X’7B22616E6E6F746174696F6E73223A7B226C697374223A5B5D7D2C226564697461626C65223A747275652C22676E65744964223A6E756C6C2C226772617068546F6F6C746970223A302C2268696465436F6E74726F6C73223A66616C73652C226964223A37392C226C696E6B73223A5B7B2269636F6E223A2265787465726E616C206C696E6B222C22696E636C75646556617273223A747275652C226B65657054696D65223A747275652C2274616773223A5B5D2C2274797065223A2264617368626F61726473227D5D2C2
(omit many lines because it’s too long)

Your sure it’s not just encoded data in a certain way. Please try to create a new database from that script - you don’t need to overwrite the existing one - copy that to some backup place temporarily.

I did it. It created with some error, and then on Grafan dashboard, it lacks of many dashboards, something like I had 20 dashboards but now there’re only 5

Oh right. I don’t have any other suggestion right now other than you might be able to extract all/some missing dashboard json from the dashboard table/data column - manual work.

It’s always recommended to take backups often. If you’re running a larger Grafana installation with a lot of users and/or want something more reliable I would suggest to look at using MySql or Postgres as internal database for Grafana.