Search code examples
oracleoracle10goracle-sqldeveloper

How to restaure a dropped package in oracle


i've dropped an important package of my project (involuntarily) i now i want to restaure it. Please can you help me ?

Here's what i tried to do :

RESTAURE PACKAGE package_name;

I work with oracle sql developer


Solution

  • There is no restore package command. If you've dropped the package, you may need to get it back from your source control system.

    If you're reasonably lucky, you may be able to run a flashback query to see the source. Assuming you dropped it less than 20 minutes ago (otherwise adjust the timestamp you're flashing back to)

    select type, line, text
      from all_source as of timestamp systimestamp - interval '20' minute
     where owner = <<schema owner>>
       and name = <<name of package>>
       and type in ('PACKAGE', 'PACKAGE BODY')
     order by type, line;
    

    Oracle retains the undo data necessary to do a flashback query for a limited period of time. If it has been too long since you dropped the package, Oracle may well not be able to show you what the code looks like.