oracle增加md5函数
2015-09-22oracle增加md5函数,md5作为密码实例。
1、oracle增加md5函数
CREATE OR REPLACE FUNCTION MD5(passwd IN VARCHAR2) RETURN VARCHAR2 IS
retval varchar2(32);
BEGIN
retval := Lower(utl_raw.cast_to_raw(
DBMS_OBFUSCATION_TOOLKIT.MD5(INPUT_STRING => passwd))
);
RETURN retval;
END;
或者
CREATE OR REPLACE FUNCTION MD5 (input_string VARCHAR2) return varchar2
IS raw_input RAW(128) := UTL_RAW.CAST_TO_RAW(input_string);
decrypted_raw RAW(2048);
error_in_input_buffer_length EXCEPTION;
BEGIN
sys.dbms_obfuscation_toolkit.MD5(input => raw_input, checksum => decrypted_raw);
return lower(rawtohex(decrypted_raw));
END;
2、实例
select USER_NAME,password from FT_USER where password=md5('$oldpw') order by USER_NAME;
update FT_AGENT_USER set password=md5('$newpw') where password=md5('$oldpw');
select USER_NAME,password from FT_USER where password=md5('$newpw') order by USER_NAME;
commit;
3、dbms_metadata.get_ddl()用于获取对象的DDL,检查md5源码
set line 200
set pagesize 0
set long 99999
set feedback off
set echo off
select dbms_metadata.get_ddl('TABLE','TABLE_NAME','TABLE_OWNER') from dual;
select dbms_metadata.get_ddl('TABLE','TABLE_NAME','TABLE_OWNER') from dual;
select dbms_metadata.get_ddl('INDEX','INDEX_NAME','INDEX_OWNER') from dual;
select dbms_metadata.get_ddl('VIEW','VIEW_NAME','VIEW_OWNER') from dual;
select dbms_metadata.get_ddl('PROCEDURE','PROCEDURE_NAME','PROCEDURE_OWNER') from dual;
select dbms_metadata.get_ddl('FUNCTION','FUNCTION_NAME','FUNCTION_OWNER') from dual;
set pagesize 0
set long 90000
set feedback off
set echo off
spool schema_ddl.sql
SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name,u.owner) FROM DBA_TABLES u;
SELECT DBMS_METADATA.GET_DDL('VIEW',u.view_name,u.owner) FROM DBA_VIEWS u;
SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name,u.owner) FROM DBA_INDEXES u;
select dbms_metadata.get_ddl('PROCEDURE',u.object_name, u.owner) from dba_objects u where u.object_type = 'PROCEDURE';
select dbms_metadata.get_ddl('FUNCTION',u.object_name, u.owner) from dba_objects u where u.object_type = 'FUNCTION';
spool off;
select dbms_metadata.get_ddl('TABLESPACE','TBS_NAME') from dual;
select dbms_metadata.get_ddl('USER','EPAY_USER') from dual;
SELECT DBMS_METADATA.GET_DDL('USER',U.username)
FROM DBA_USERS U;
相关日志
- rman-0level全备份及恢复
- nagios监测dbbak
- oracle限制远程访问
- 给left join关联关系字段加索引
- Oracle ASM
- Oracle Database 18c
- DG两个数据库SID不同
- DG-Dgmgrl
- Oracle中的BLOB和CLOB
- oracle 启动错误:MEMORY_TARGET not supported on this system
- create bigfile tablespace
- Oracle11G新特性:分区表分区默认segment大小64k变为8M
- oracle删除重复行delete repeat
- rollback回滚 (1)
- oracle中drop一个表,让数据文件释放空间
- CentOS 5.11 x64静默安装(slient install)oracle 11.2.0.4 x64
- sqlplus USER/PWD@IP:PORT/SID
- oracle删除所有表
- oracle查询长整数实例
- oracle设置NLS_DATE_FORMAT参数实例
- ORA-00600和ORA-08103错误(oracle10g)
- oracle user passwd用户密码
- oracle导入txt数据文件实例
- conn user as sysdba
- SGA/PGA的设置与调整 (9)
- ORA-01843: not a valid month (3)
- oracle表空间(tablespace)的增删改查(create/drop/rename,move/select) (2)
- rlwrap实现sqlplus使用上下键查历史命令