Author: Dave Moore
Page:
1
2
Oracle provides many useful utilities like tnsping.exe, dbv.exe and wrap.exe. Unfortunately there has been very less or even no advice on how to use these utilities. The wrap utility is very easy to use so if you have code you would like to protect then wrap it up. In this article I will first give a brief overview of Oracle Wrap Utility and then will discuss some great tips about it.
Oracle Wrap Utility:
Oracle allows you to wrap the code inside the following statements
CREATE [OR REPLACE] FUNCTION function_name
CREATE [OR REPLACE] PROCEDURE procedure_name
CREATE [OR REPLACE] PACKAGE package_name
CREATE [OR REPLACE] PACKAGE BODY package_name
CREATE [OR REPLACE] TYPE type_name ... OBJECT
CREATE [OR REPLACE] TYPE BODY type_name |
A common practice is to leave specifications unwrapped and to wrap the implementation of procedures and functions within the package body. You can use wrap with this simple command
c:\ora9i\bin wrap iname=input_file_name
An output file can be specified as a second argument by using this format
c:\ora9i\bin wrap iname=input_file_name oname=output_file_name SQL> CREATE or REPLACE PROCEDURE wrap_it (seed_in NUMBER)
IS
v_rand INTEGER;
BEGIN
DBMS_RANDOM.INITIALIZE (seed_in);
FOR i IN 1..5 LOOP
v_rand := mod(abs(DBMS_RANDOM.RANDOM),45);
dbms_output.put_line(i||': '||v_rand);
END LOOP ;
END;
/
Procedure created.
SQL> exec wrap_it(123456);
1: 37
2: 36
3: 18
4: 8
5: 32
PL/SQL procedure successfully completed.
Now you can take the code for the wrap_it procedure and wrap it. The code for the procedure is in a file named wrap_example.sql.
C:\ora9i>wrap iname=c:\ora9i\admin\wrap_example.sql
…
…
Processing c:\ora9i\admin\wrap_example.sql to wrap_example.plb
Oracle change the file extension to "plb." When we open wrap_example.plb we see many lines of unreadable text. Once we know the procedure works and that the file or script can be wrapped then drop the procedure and re-create it using the plb file. If all goes well, you should be able to execute the procedure as before.
SQL> drop procedure wrap_it;
Procedure dropped.
SQL> @c:\ora9i\wrap_example.plb
Procedure created.
SQL> exec wrap_it(123456);
1: 37
2: 36
3: 18
4: 8
5: 32
PL/SQL procedure successfully completed.
Page:
1
2
More Oracle Articles, Database Articles and DBA Tips
Database Security: Step by step guideline
A Quick Guide to determine Oracle RAM Size!!
Database Benchmarking – Some Facts!
Testing Database Security
Exciting Oracle 11g features you should not miss to know!!
|