Viewed100K+ times! This question is You Asked Hi Tom,
I am analyzing a database using OEM (Database Control) console with ADDM.
Some Huge SQL statemente are procedures used by the application running on this database.
Unfortunately some packages and procedures are encripted (wrapped).
So I would to know if it is possible to look on this code (unwrapping it) obviously?
Any information about that will be really appreciated.
And just another one question, is it possible to monitor 9i databases using 10g Grid Control?
I would like to take advantage of ADDM to monitor 9i databases.
Thanks in advance.
Kind regards,
Francisco Mtz.
and Tom said...We don't provide a native mechanism for unwrapping PL/SQL, but there are tools on the internet. We don't support or guarantee the correctness of validity of such tools.
So there is no way to see the code out of the box, just the SQL.
You cannot use ADDM on 9i since most of ADDM is actually "in the database". So, while you can use 10g Grid control on 9i, you would still be using the 9i tuning pack against 9i for tuning.
Most all of the functionality (true functionality - not the GUI stuff you see, but the real work) is in the database.
Rating (18 ratings)
Is this answer out of date? If it is, please let us know via a Comment Comments Comment Thanks for your answer.Francisco Mtz., June 08, 2006 - 4:15 pm UTC
Connor and Chris don't just spend all day on AskTOM. You can also catch regular content via Connor's blog and Chris's blog. Or if video is more your thing, check out Connor's latest video and Chris's latest video from their Youtube channels. And of course, keep up to date with AskTOM via the official twitter account. More to Explore PL/SQL demos Check out more PL/SQL tutorials on our LiveSQL tool.
When you get an error with an Oracle DBMS_ package, there's a line number given to be able to troubleshoot. However, most of them are wrapped to have their code compact, with comments stripped, when loading it in the dictionary. Opening the file with a CREATE OR REPLACE PACKAGE BODY shows only random printable characters:
This is to run on only in a lab, why not a container started from Oracle 23c Free edition (docker run
container-registry.oracle.com/database/free), and is for educational purpose only. Nothing is encrypted when wrapped, but that doesn't give you any right on the code. This is not Open Source!
After flipping through all these pages I had some second thoughts about publishing an unwrapper, especially since David, Pete and Anton were a bit secretive about certain details such as the substitution table. Obviously, I decided to publish it nonetheless. Is this really harmful? There are already a couple of other 10g unwrappers available, such as:
HI, I have downloaded the jar file, but unable to configure/install the unwrap utility into sqldeveloper. I am unable to find the procedure to do that as you specified in Installation section. Can you please help me on this?
Just one question: How did you take that snapshot of screen? I mean Cutting Edges on the Bottom (0r any side of the image) ;-) What tool/utility you used? Please tell me the way. I googled it but could not able to find out.
SQL Developer 1.x, 2.x, 3.x are based on the Extension Software Development Kit (ESDK) version 1. SQL Developer 4.x requires the use of ESDK version 2. Unfortunately these versions are not compatible. So I decided to support the newest SQL Developer version only. I suggest to update to the latest SQL Developer version (currently 4.1.5) since this is a prerequisite for this extension.
The error message is correct. This coded has been wrapped with a pre Oracle 10g wrap utility. See also FAQ Is unwrapping code processed by the PL/SQL Wrapper of Oracle7, Oracle8, Oracle8i or Oracle9i supported?
I am using SqlDev Version 19.2.1.247 now. I have tried and installed the Unwrapper utility under Check for Updates using Install from Local file option
(Path: C:\Users\Unwrapper_for_SQLDev_1.0.0.zip). Unfortunately, there is no unwrap option listed while right click on SQL window after restarted.
Please help.
A possible reason for the issue you are describing is that you have installed SQL Developer in a protected folder, e.g. under C:\Program Files. Installations have to be done as Administrator. See also -unwrapper-sqldev/blob/main/FAQ.md#i-cannot-install-any-extension-on-windows for more information.
Very good and useful tool.
I read your initial post and the articles you have mentioned. I am searching for a feature that is not covered by any of the tools I have seen. I want to be able to unwrap the code in the database and not in a file. Would it be possible to have some pl/sql code that allows to wrap/unwrap the code in the internal structures of Oracle?
Thanks for your tool, Phil!
What do you suggest for this error? I was given a Package Spec & Body together in one file. Even if I took the spec off & tried unwrapping the body by itself, same error (slightly different character counts). Did the source file get corrupted somehow during the extraction?
Hi:
We have a requirement to upgrade a custom application built on Oracle7 to 10g. There are some wrapped procedures which could not be migrated. Is there any toll available to unwarp the same and reqrap after migration to 10g?
Thanks
Murali
Hi,
I came across your blog and I am trying to unwrap a PL/SQL package in 9i, But it fails. If I am not mistaken, Base 64 encoding is in 10g not in 9i. I tried unwrap utility online but it fails saying not a valid wrapped code.
Thanks
Renuka
@Mark
What your looking at is the output from the compression, not from base64 decoding. And in the compressed output the same character wil not always map to the same output character, it will depend on the place in the origin al string and the characters before it.
Great findings, thanks for sharing it with us. However, I have some questions
I tried to follow the steps as per your printscreens and also insatlled the objects from your attached file.
I am getting null value from your last printscreen step(viz. I took the last part of the code from your attached file)
Can you also post the real code for unwrapping :-), if thats possible
Nice post, the 10g wrap mechanism is in my opinion much weaker than the 9i and lower mechanism. The problem with the 9i mechanism is that the symbol table is visible, with 10g to 11g that is not so BUT as you have shown the mechanism is weaker as full reversal is possible. With 9i its simply the internal state of the PL/SQL compiler, i.e. DIANA written out to disk as IDL. The unwrap process for 9i is a feature of the design of DIANA (Goos et al) as DIANA was intended for low memory older machines where code would be stored in an intermediate format and it should be possible to reconstruct the source code. writing an unwrapper for 9i and lower; a complete one is unfortunately a much bigger task than 10g. So in my opinion, we gained a hidden symbol table but a much weaker mechanism to hide our code in 10g.
All wrapped PL/SQL objects can be broken down in a header and a body (BASE64). The header contains information about the version of the database it was wrapped on, the type of object and the length of both wrapped and unwrapped text. The body contains the actual wrapped code that is BASE64 coded (to be able to copy/past it).
As mentioned before, the wrapped PL/SQL text is BASE64 coded and needs to be decoded before you can actually start unwrapping (decrypting). The first 20 bytes of the BASE64 decoded body contains a SHA1 hash value for the wrapped (encrypted) body. The remaining of the body is a coded (using a codetable) compressed stream of bytes that contains the source text.
PL/SQL provides different kinds of functionality to the user, in which that unwrapper is the one of functionality that is provided by the PL/SQL. Sometimes we need to hide the code from the end-user, so SQL developers wrap the code, and that means it hides the functionality from the user because of security reasons. There are conditions where you wish to examine the wellspring of a wrapped PL/SQL bundle, technique, or capacity. By using PL/SQL unwrapped, we can easily find out the migration error, or we can say that we can find the root cause faster as compared to other processes.
In the above example, we try to create the function to make the addition of two numbers. Here we initialize the two variables with integer data types such as P_INT1and P_INT2 with integer data types as shown in the above procedure. After that, we make the addition of two numbers and return the sum of numbers. Here we created a very simple function. The final result of the above PL/SQL function we illustrated by using the following screenshot as follows.
In the above example, we use the wrap command with the name keyword as shown; after that, we need to write the file name that we need to wrap. The final result of the above command we illustrated by using the following screenshot as follows.
1. Firstly, we just need to right-click in our code and click on the unwrap command. For this command, first, we need to install the PL/SQL unwrapper package on our oracle SQL developer.
After right click shows the unwrap command as shown in the following screenshot as follows.
2. In the second, we can directly use an online tool to unwrap the code. Here we will see how we can unwrap code by using the online tool as follows.
In the online tool, we need to copy the wrapped code and click on the unwrap button. After completing the execution, it shows the result as shown in the following screenshot as follows.
We hope from this article you learn PL/SQL unwrapper. From the above article, we have learned the basic syntax of the unwrapped, and we also see different examples of the unwrapped. From this article, we learned how and when we use PL/SQL unwrapper.
3a8082e126