在 Oracle 存储过程中所包含的商业秘密,有时不愿意被第三方人员看到,可以通过对存储过程加密来实现。 有两种加密存储过程的方法:这里重点介绍 wrap: Wrap 是 Oracle 所提供的操作系统级的命令 ,其加密的原理就是先对源码进行 lz 压缩 lzstr ,然后对压
在Oracle存储过程中所包含的商业秘密,有时不愿意被第三方人员看到,可以通过对存储过程加密来实现。
有两种加密存储过程的方法:这里重点介绍wrap:
Wrap是Oracle所提供的操作系统级的命令,其加密的原理就是先对源码进行lz压缩lzstr,然后对压缩数据进行SHA-1运算得到40位的加密串shstr,然后将加密串与压缩串拼接得到shstr+lzstr,然后对拼接后的字符串进行Oracle双字符转换(转换表)。最后将转换后的字符串进行base64编码,最终得到wrap的加密串。Oracle本身没有提供unwrap工具,wrap语法如下:
wrap iname=input_file [oname=output_file] |
参数iname为要加密的文件名,oname为加密后的文件名。如果省略oname,那么将会自动产生一个同名的加密文件名,且后缀为plb。
我们来演示一下wrap工具的用法。首先创建一个名称为test.txt的文件:
[oracle@pigeon ~]$ which wrap
/u01/product/10.2.0/bin/wrap #wrap所在目录
[oracle@pigeon ~]$ wrap iname=test.txt
PL/SQL Wrapper: Release 10.2.0.1.0- Production on Mon Jan 17 15:14:11 2011
Copyright (c) 1993, 2004, Oracle. All rights reserved.
Processing test.txt to test.plb
[oracle@pigeon ~]$ ls
autostartosw.sh Desktop l0db.sh raw.txt sde2.dmp sde.dmp startdb.sh stop.pigeon test.plb(新生成一个同名不同后缀的文件) test.txt
下面分别查看两个文件的内容:
[oracle@pigeon ~]$ more test.txt
create or replace procedure test
is
begin
dbms_output.put_line('welcome to oracle!');
end;
/
[oracle@pigeon ~]$ more test.plb
create or replace procedure test wrapped
a000000
354
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
7
49 85
zzrHcdOhOYaYaHu+gE2KKyNe6L4wg5nnm7+fMr2ywFznUrLL7pt0i8DAMv7ShsBSm7JK/iiy
veeysx0GMCyuJOqygZt3bl3kaMMC8c8C5FHbXW7D6TIu9tHqJB/2Oab7j44p
/
[oracle@pigeon ~]$
下面使用密文创建与调用创建的procedure
[oracle@pigeon ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 17 15:16:06 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected.
--复制密文:
SQL> create or replace procedure test wrapped
2 a000000
3 354
4 abcd
5 abcd
6 abcd
7 abcd
8 abcd
9 abcd
10 abcd
11 abcd
12 abcd
13 abcd
14 abcd
15 abcd
16 abcd
17 abcd
18 abcd
19 7
20 49 85
21 zzrHcdOhOYaYaHu+gE2KKyNe6L4wg5nnm7+fMr2ywFznUrLL7pt0i8DAMv7ShsBSm7JK/iiy
22 veeysx0GMCyuJOqygZt3bl3kaMMC8c8C5FHbXW7D6TIu9tHqJB/2Oab7j44p
23
24 /
Procedure created.
当需要加密的文件很多时,也可以这样:
SQL> start /home/oracle/test.plb;
Procedure created.
SQL>
SQL> set serveroutput on;
SQL> exec test;#执行test过程,正确输出
welcome to oracle!
PL/SQL procedure successfully completed.
SQL>
现在就可以把文件test.plb发给客户使用了,而不必担心你的源代码的暴露。

The main difference between MySQL and SQLite is the design concept and usage scenarios: 1. MySQL is suitable for large applications and enterprise-level solutions, supporting high performance and high concurrency; 2. SQLite is suitable for mobile applications and desktop software, lightweight and easy to embed.

Indexes in MySQL are an ordered structure of one or more columns in a database table, used to speed up data retrieval. 1) Indexes improve query speed by reducing the amount of scanned data. 2) B-Tree index uses a balanced tree structure, which is suitable for range query and sorting. 3) Use CREATEINDEX statements to create indexes, such as CREATEINDEXidx_customer_idONorders(customer_id). 4) Composite indexes can optimize multi-column queries, such as CREATEINDEXidx_customer_orderONorders(customer_id,order_date). 5) Use EXPLAIN to analyze query plans and avoid

Using transactions in MySQL ensures data consistency. 1) Start the transaction through STARTTRANSACTION, and then execute SQL operations and submit it with COMMIT or ROLLBACK. 2) Use SAVEPOINT to set a save point to allow partial rollback. 3) Performance optimization suggestions include shortening transaction time, avoiding large-scale queries and using isolation levels reasonably.

Scenarios where PostgreSQL is chosen instead of MySQL include: 1) complex queries and advanced SQL functions, 2) strict data integrity and ACID compliance, 3) advanced spatial functions are required, and 4) high performance is required when processing large data sets. PostgreSQL performs well in these aspects and is suitable for projects that require complex data processing and high data integrity.

The security of MySQL database can be achieved through the following measures: 1. User permission management: Strictly control access rights through CREATEUSER and GRANT commands. 2. Encrypted transmission: Configure SSL/TLS to ensure data transmission security. 3. Database backup and recovery: Use mysqldump or mysqlpump to regularly backup data. 4. Advanced security policy: Use a firewall to restrict access and enable audit logging operations. 5. Performance optimization and best practices: Take into account both safety and performance through indexing and query optimization and regular maintenance.

How to effectively monitor MySQL performance? Use tools such as mysqladmin, SHOWGLOBALSTATUS, PerconaMonitoring and Management (PMM), and MySQL EnterpriseMonitor. 1. Use mysqladmin to view the number of connections. 2. Use SHOWGLOBALSTATUS to view the query number. 3.PMM provides detailed performance data and graphical interface. 4.MySQLEnterpriseMonitor provides rich monitoring functions and alarm mechanisms.

The difference between MySQL and SQLServer is: 1) MySQL is open source and suitable for web and embedded systems, 2) SQLServer is a commercial product of Microsoft and is suitable for enterprise-level applications. There are significant differences between the two in storage engine, performance optimization and application scenarios. When choosing, you need to consider project size and future scalability.

In enterprise-level application scenarios that require high availability, advanced security and good integration, SQLServer should be chosen instead of MySQL. 1) SQLServer provides enterprise-level features such as high availability and advanced security. 2) It is closely integrated with Microsoft ecosystems such as VisualStudio and PowerBI. 3) SQLServer performs excellent in performance optimization and supports memory-optimized tables and column storage indexes.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
