在Oracle数据库中我们可以先用wrap工具对source code加密后再放到DB中去,之前很少用,现因特殊状况需对一些代码加密后再放到数据库中。在下面的示例中,只需一个in,还有一个out即可。
C:UserData>type collect_all_db_account_info.SQL
CREATE OR REPLACE PROCEDURE collect_all_db_account_info IS
CURSOR c_DB_LINK IS
SELECT HOST FROM USER_DB_LINKS;
BEGIN
for r_link in c_db_link loop
EXECUTE IMMEDIATE 'INSERT INTO perfadm.all_db_account_info SELECT DISTINCT v
d.dbid db_id, vd.NAME db_name, d.username, d.PASSWORD,d.account_status, d.defaul
t_tablespace,d.temporary_tablespace, d.PROFILE, d.created, p.SYSDBA,p.SYSOPER, S
YSDATE collect_date FROM v$database@'||r_link.host||' vd, dba_users@'||r_link.ho
st||' d, v$pwfile_users@'||r_link.host||' p WHERE p.username(+) = d.username';
COMMIT;
end loop;
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END collect_all_db_account_info;
/
C:UserData>wrap iname=collect_all_db_account_info.SQL oname=wcollect_all_db_account_info.plb
PL/SQL Wrapper: Release 9.2.0.6.0- Production on Fri Jul 14 15:52:18 2006
Copyright (c) Oracle Corporation 1993, 2001. All Rights Reserved.
Processing collect_all_db_account_info.SQL to wcollect_all_db_account_info.plb
C:UserData>type wcollect_all_db_account_info.plb
CREATE OR REPLACE PROCEDURE collect_all_db_account_info wrapped
0
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
3
7
9200000
1
4
0
12
2 :e: