Recover unsaved SQL query Scripts in Oracle SQL Developer

If you have the privileges then:

SELECT * FROM v$sql

If not then press F8 to bring up a list of previously ran queries.


This has saved my butt several times.

It is really a problem when you lose unsaved code. For about a month I have been working on a big procedure, and forgot to save the code in SVN. If you read this and remember have such unsaved code, commit it immediately! :) Because everything could happen with your test db. Ok. you're lucky if you were using Oracle SQL Developer, because this program has a great feature - it saves your code in its sql history inspite of eating a big party of your RAM. Open your file explorer and locate this folder:

C:\Users\%USERNAME%\AppData\Roaming\SQL Developer\SqlHistory

You'll find a lot of XML files, and if you're twice lucky, you'll find your lost code. It's wonderful. :) . If you're using another program, try to find a feature like this and maybe it helps you. My condolences if this post doesn't help you, in any case, try to find something good among the next: 1) write your code again, and it will be better than before as you did it once 2) commit your code, so you'll not face such problem in the future