设为首页 加入收藏

TOP

Oracle存储过程加密之wrap工具PDF(一)
2017-01-20 08:15:02 】 浏览:301
Tags:Oracle 存储 过程 加密 wrap 工具 PDF

实验环境


操作系统版本


数据库版本


Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


数据库实例名


shdb


wrap路径


Oracleoracle_home/bin目录下有wrap 命令.


/opt/oracle/product/11.2.0/db_1/bin/wrap


实验开始


1.创建一个sql文件,在oracle用户家目录下创建


[oracle@zxt28 ~]$ vim leonarding.sql


create or replace procedure leo(i in number)


as


begin


? ? dbms_output.put_line('input parameter: '||to_char(i));


end;


保存&退出


[oracle@zxt28 ~]$ ll


total 3664228


drwxr-xr-x 7 oracle oinstall? ? ? ?4096 Aug 27? 2013 database


drwxr-xr-x 2 oracle oinstall? ? ? 4096 Jan? 7 15:46 Desktop


-rw-r--r-- 1 oracle oinstall? ? ? ? 128 Jan 14 16:49 leonarding.sql? ? 已经生成


-rwxr-xr-x 1 root? root? ? 1395582860 Oct 17? 2013 p13390677_linux-x86-64_11gR2040_database_1of2.zip


-rwxr-xr-x 1 root? root? ? 1151304589 Oct 17? 2013 p13390677_linux-x86-64_11gR2040_database_2of2.zip


-rwxr-xr-x 1 root? root? ? 1205251894 Oct 16? 2013 p13390677_linux-x86-64_11gR2040_grid.zip


2.Wrap方式加密


用法:


? ? ? ? wrap的用法还是比较简单的,一个命令就可以实现加密,以下是命令的格式


wrap iname=input_file [ oname=output_file ]


iname:指定的是源文件


oname:指定的是转换后加密文件,oname选项可以省略如果省略wrap命令会自动生成文件名一模一样的加密文件,当然你也可以指定自己命名方式,如下所示


[oracle@zxt28 ~]$ wrap iname=leonarding.sql


PL/SQL Wrapper: Release 11.2.0.4.0- 64bit Production on Thu Jan 14 16:57:46 2016


Copyright (c) 1993, 2009, Oracle.? All rights reserved.


Processing leonarding.sql to leonarding.plb? ? 自动生成文件名一模一样的加密文件


[oracle@zxt28 ~]$ ll


total 3664232


drwxr-xr-x 7 oracle oinstall? ? ? 4096 Aug 27? 2013 database


drwxr-xr-x 2 oracle oinstall? ? ? 4096 Jan? 7 15:46 Desktop


-rw-r--r-- 1 oracle oinstall? ? ? ? 322 Jan 14 16:57 leonarding.plb


-rw-r--r-- 1 oracle oinstall? ? ? ? 128 Jan 14 16:49 leonarding.sql


此时文件leonarding.plb的内容就是加密状态,如下所示


[oracle@zxt28 ~]$ vim leonarding.plb


create or replace procedure leo wrapped


a000000


354


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


abcd


7


6f b6


nkxs9EzOsgeU6oDhPIYrMqr6O5cwg5nnm7+fMr2ywFyFodexpcOl0l6lmYEywLIlw4/AdCuP


wMAyW55SPqmpbbcguDSqEVpnEeMcL8b4MJK+J00Xi5SJpxaOFG9si+inGm+ko88RnCMuLuOq


NAMHC8hAsOjoDeGcCk+ZyF0G4Kam2x0svw==


自己指定加密文件命名


[oracle@zxt28 ~]$ rm leonarding.plb


[oracle@zxt28 ~]$ wrap iname=leonarding.sql oname=leo.plb


PL/SQL Wrapper: Release 11.2.0.4.0- 64bit Production on Thu Jan 14 16:59:58 2016


Copyright (c) 1993, 2009, Oracle.? All rights reserved.


Processing leonarding.sql to leo.plb


[oracle@zxt28 ~]$ ll


total 3664232


drwxr-xr-x 7 oracle oinstall? ? ? 4096 Aug 27? 2013 database


drwxr-xr-x 2 oracle oinstall? ? ? 4096 Jan? 7 15:46 Desktop


-rw-r--r-- 1 oracle oinstall? ? ? ? 128 Jan 14 16:49 leonarding.sql


-rw-r--r-- 1 oracle oinstall? ? ? ? 322 Jan 14 16:59 leo.plb


它默认输出是源文件名称加上plb后缀,如果你要自己指定后缀名的话,也可以这样写,wrap iname=leonarding.sql oname=leo.out,当然只要加密之后的文件能被Oracle正确解析就好了。linux是没有扩展名概念的。


notes:如果你拿一个已经加密过的sql文件,再次去用命令加密的话,得到的文件实际上和原来的是一样的,自己可以尝试下。


3.编译加密后的leo.plb存储过程


[oracle@zxt28 ~]$ sqlplus shdb/shdb? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?登录数据库


SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 14 17:24:18 2016


Copyright (c) 1982, 2013, Oracle.? All rights reserved.


Connected to:


Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


With the Partitioning, OLAP, Data Mining and Real Application Testing options


SHDB@shdb> @/home/oracle/leo.plb? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 编译存储过程


Procedure created.


4.运行存储过程leo


SHDB@shdb> set serveroutput on;


SHDB@shdb> exec leo(100);


input parameter: 100


PL/SQL procedure successfully completed.


SHDB@shdb> exec leo(200);


input parameter: 20

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇RedHat5.5 x64 静默安装Oracle 11g 下一篇Oracle的闪回技术--闪回错误的DML..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目