1、连接上Linux数据库服务器,切换到Oracle数据库用户桌面,打开终端,进入到环境变量$ORACLE_HOME目录

Last login: Fri Dec 11 13:26:18 2015 from 192.168.1.100

[root@Linux主机名 ~]# su - oracle

[oracle@Linux主机名 dbhome_1]$ cd $ORACLE_HOME/rdbms/admin

[oracle@Linux主机名 admin]$

2、查看Oracle11g数据库提供的默认密码复杂度函数脚本(Oracle安装目录下的/rdbms/admin/utlpwdmg.sql文件)

[oracle@Linux主机名 admin]$ cat $ORACLE_HOME/rdbms/admin/utlpwdmg.sql

脚本详细内容详见文章末尾

3、登录Oracle数据库并执行Oracle11g数据库提供的默认密码复杂度函数脚本

[oracle@Linux主机名 admin]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 11 13:33:58 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn /as sysdba

Connected.

SQL> @?/rdbms/admin/utlpwdmg.sql

Function created.

Profile altered.

Function created.

SQL>

4、在PL/SQL中创建用户的资源文件,执行下面语句

CREATE PROFILE 资源文件名 LIMIT

SESSIONS_PER_USER UNLIMITED

CPU_PER_SESSION UNLIMITED

CPU_PER_CALL UNLIMITED

CONNECT_TIME UNLIMITED

IDLE_TIME 600  --10小时连续不活动的话系统自动断开连接

LOGICAL_READS_PER_SESSION UNLIMITED

LOGICAL_READS_PER_CALL UNLIMITED

COMPOSITE_LIMIT UNLIMITED

PRIVATE_SGA UNLIMITED

FAILED_LOGIN_ATTEMPTS 10  --指定锁定用户的登录失败次数为10次,超过10次则系统被自动锁定

PASSWORD_LIFE_TIME 180  --指定用户同一密码锁允许使用的天数为180天

PASSWORD_REUSE_TIME UNLIMITED

PASSWORD_REUSE_MAX UNLIMITED

PASSWORD_LOCK_TIME 1  --指定用户被锁定天数为1天

PASSWORD_GRACE_TIME 10 --数据库发出警告到登录失效前的宽限天数

PASSWORD_VERIFY_FUNCTION verify_function_11G

5、测试更新用户密码

--创建用户并使用自定义的配置文件

create user 用户名 identified by 密码 default tablespace 默认表空间名 temporary tablespace 临时表空间名 profile 资源文件名;

--用户授权

grant connect,resource,exp_full_database,imp_full_database to 用户名;

--更新用户密码为简单的字符串

alter user 用户名 identified by 123456;

--更新用户密码为复杂的字符串

alter user 用户名 identified by Csdn_20151211;

6、结论:发现简单密码无法更新,复杂的密码更新成功。

附:$ORACLE_HOME/rdbms/admin/utlpwdmg.sql脚本源文件内容

Rem

Rem $Header: utlpwdmg.sql 02-aug-2006.08:18:05 asurpur Exp $

Rem

Rem utlpwdmg.sql

Rem

Rem Copyright (c) 2006, Oracle. All rights reserved.

Rem

Rem    NAME

Rem      utlpwdmg.sql - script for Default Password Resource Limits

Rem

Rem    DESCRIPTION

Rem      This is a script for enabling the password management features

Rem      by setting the default password resource limits.

Rem

Rem    NOTES

Rem      This file contains a function for minimum checking of password

Rem      complexity. This is more of a sample function that the customer

Rem      can use to develop the function for actual complexity checks that the

Rem      customer wants to make on the new password.

Rem

Rem    MODIFIED   (MM/DD/YY)

Rem    asurpur     05/30/06 - fix - 5246666 beef up password complexity check

Rem    nireland    08/31/00 - Improve check for username=password. #1390553

Rem    nireland    06/28/00 - Fix null old password test. #1341892

Rem    asurpur     04/17/97 - Fix for bug479763

Rem    asurpur     12/12/96 - Changing the name of password_verify_function

Rem    asurpur     05/30/96 - New script for default password management

Rem    asurpur     05/30/96 - Created

Rem

-- This script sets the default password resource parameters

-- This script needs to be run to enable the password features.

-- However the default resource parameters can be changed based

-- on the need.

-- A default password complexity function is also provided.

-- This function makes the minimum complexity checks like

-- the minimum length of the password, password not same as the

-- username, etc. The user may enhance this function according to

-- the need.

-- This function must be created in SYS schema.

-- connect sys/ as sysdba before running the script

CREATE OR REPLACE FUNCTION verify_function_11G

(username varchar2,

password varchar2,

old_password varchar2)

RETURN boolean IS

n boolean;

m integer;

differ integer;

isdigit boolean;

ischar  boolean;

ispunct boolean;

db_name varchar2(40);

digitarray varchar2(20);

punctarray varchar2(25);

chararray varchar2(52);

i_char varchar2(10);

simple_password varchar2(10);

reverse_user varchar2(32);

BEGIN

digitarray:= '0123456789';

chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

-- Check for the minimum length of the password

IF length(password) < 8 THEN

raise_application_error(-20001, 'Password length less than 8');

END IF;

-- Check if the password is same as the username or username(1-100)

IF NLS_LOWER(password) = NLS_LOWER(username) THEN

raise_application_error(-20002, 'Password same as or similar to user');

END IF;

FOR i IN 1..100 LOOP

i_char := to_char(i);

if NLS_LOWER(username)|| i_char = NLS_LOWER(password) THEN

raise_application_error(-20005, 'Password same as or similar to user name ');

END IF;

END LOOP;

-- Check if the password is same as the username reversed

FOR i in REVERSE 1..length(username) LOOP

reverse_user := reverse_user || substr(username, i, 1);

END LOOP;

IF NLS_LOWER(password) = NLS_LOWER(reverse_user) THEN

raise_application_error(-20003, 'Password same as username reversed');

END IF;

-- Check if the password is the same as server name and or servername(1-100)

select name into db_name from sys.v$database;

if NLS_LOWER(db_name) = NLS_LOWER(password) THEN

raise_application_error(-20004, 'Password same as or similar to server name');

END IF;

FOR i IN 1..100 LOOP

i_char := to_char(i);

if NLS_LOWER(db_name)|| i_char = NLS_LOWER(password) THEN

raise_application_error(-20005, 'Password same as or similar to server name ');

END IF;

END LOOP;

-- Check if the password is too simple. A dictionary of words may be

-- maintained and a check may be made so as not to allow the words

-- that are too simple for the password.

IF NLS_LOWER(password) IN ('welcome1', 'database1', 'account1', 'user1234', 'password1', 'oracle123', 'computer1', 'abcdefg1', 'change_on_install') THEN

raise_application_error(-20006, 'Password too simple');

END IF;

-- Check if the password is the same as oracle (1-100)

simple_password := 'oracle';

FOR i IN 1..100 LOOP

i_char := to_char(i);

if simple_password || i_char = NLS_LOWER(password) THEN

raise_application_error(-20007, 'Password too simple ');

END IF;

END LOOP;

-- Check if the password contains at least one letter, one digit

-- 1. Check for the digit

isdigit:=FALSE;

m := length(password);

FOR i IN 1..10 LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(digitarray,i,1) THEN

isdigit:=TRUE;

GOTO findchar;

END IF;

END LOOP;

END LOOP;

IF isdigit = FALSE THEN

raise_application_error(-20008, 'Password must contain at least one digit, one character');

END IF;

-- 2. Check for the character

<>

ischar:=FALSE;

FOR i IN 1..length(chararray) LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(chararray,i,1) THEN

ischar:=TRUE;

GOTO endsearch;

END IF;

END LOOP;

END LOOP;

IF ischar = FALSE THEN

raise_application_error(-20009, 'Password must contain at least one \

digit, and one character');

END IF;

<>

-- Check if the password differs from the previous password by at least

-- 3 letters

IF old_password IS NOT NULL THEN

differ := length(old_password) - length(password);

differ := abs(differ);

IF differ < 3 THEN

IF length(password) < length(old_password) THEN

m := length(password);

ELSE

m := length(old_password);

END IF;

FOR i IN 1..m LOOP

IF substr(password,i,1) != substr(old_password,i,1) THEN

differ := differ + 1;

END IF;

END LOOP;

IF differ < 3 THEN

raise_application_error(-20011, 'Password should differ from the \

old password by at least 3 characters');

END IF;

END IF;

END IF;

-- Everything is fine; return TRUE ;

RETURN(TRUE);

END;

/

-- This script alters the default parameters for Password Management

-- This means that all the users on the system have Password Management

-- enabled and set to the following values unless another profile is

-- created with parameter values set to different value or UNLIMITED

-- is created and assigned to the user.

ALTER PROFILE DEFAULT LIMIT

PASSWORD_LIFE_TIME 180

PASSWORD_GRACE_TIME 7

PASSWORD_REUSE_TIME UNLIMITED

PASSWORD_REUSE_MAX UNLIMITED

FAILED_LOGIN_ATTEMPTS 10

PASSWORD_LOCK_TIME 1

PASSWORD_VERIFY_FUNCTION verify_function_11G;

-- Below is the older version of the script

-- This script sets the default password resource parameters

-- This script needs to be run to enable the password features.

-- However the default resource parameters can be changed based

-- on the need.

-- A default password complexity function is also provided.

-- This function makes the minimum complexity checks like

-- the minimum length of the password, password not same as the

-- username, etc. The user may enhance this function according to

-- the need.

-- This function must be created in SYS schema.

-- connect sys/ as sysdba before running the script

CREATE OR REPLACE FUNCTION verify_function

(username varchar2,

password varchar2,

old_password varchar2)

RETURN boolean IS

n boolean;

m integer;

differ integer;

isdigit boolean;

ischar  boolean;

ispunct boolean;

digitarray varchar2(20);

punctarray varchar2(25);

chararray varchar2(52);

BEGIN

digitarray:= '0123456789';

chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

punctarray:='!"#$%&()``*+,-/:;<=>?_';

-- Check if the password is same as the username

IF NLS_LOWER(password) = NLS_LOWER(username) THEN

raise_application_error(-20001, 'Password same as or similar to user');

END IF;

-- Check for the minimum length of the password

IF length(password) < 4 THEN

raise_application_error(-20002, 'Password length less than 4');

END IF;

-- Check if the password is too simple. A dictionary of words may be

-- maintained and a check may be made so as not to allow the words

-- that are too simple for the password.

IF NLS_LOWER(password) IN ('welcome', 'database', 'account', 'user', 'password', 'oracle', 'computer', 'abcd') THEN

raise_application_error(-20002, 'Password too simple');

END IF;

-- Check if the password contains at least one letter, one digit and one

-- punctuation mark.

-- 1. Check for the digit

isdigit:=FALSE;

m := length(password);

FOR i IN 1..10 LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(digitarray,i,1) THEN

isdigit:=TRUE;

GOTO findchar;

END IF;

END LOOP;

END LOOP;

IF isdigit = FALSE THEN

raise_application_error(-20003, 'Password should contain at least one digit, one character and one punctuation');

END IF;

-- 2. Check for the character

<>

ischar:=FALSE;

FOR i IN 1..length(chararray) LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(chararray,i,1) THEN

ischar:=TRUE;

GOTO findpunct;

END IF;

END LOOP;

END LOOP;

IF ischar = FALSE THEN

raise_application_error(-20003, 'Password should contain at least one \

digit, one character and one punctuation');

END IF;

-- 3. Check for the punctuation

<>

ispunct:=FALSE;

FOR i IN 1..length(punctarray) LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(punctarray,i,1) THEN

ispunct:=TRUE;

GOTO endsearch;

END IF;

END LOOP;

END LOOP;

IF ispunct = FALSE THEN

raise_application_error(-20003, 'Password should contain at least one \

digit, one character and one punctuation');

END IF;

<>

-- Check if the password differs from the previous password by at least

-- 3 letters

IF old_password IS NOT NULL THEN

differ := length(old_password) - length(password);

IF abs(differ) < 3 THEN

IF length(password) < length(old_password) THEN

m := length(password);

ELSE

m := length(old_password);

END IF;

differ := abs(differ);

FOR i IN 1..m LOOP

IF substr(password,i,1) != substr(old_password,i,1) THEN

differ := differ + 1;

END IF;

END LOOP;

IF differ < 3 THEN

raise_application_error(-20004, 'Password should differ by at \

least 3 characters');

END IF;

END IF;

END IF;

-- Everything is fine; return TRUE ;

RETURN(TRUE);

END;

/

-- This script alters the default parameters for Password Management

-- This means that all the users on the system have Password Management

-- enabled and set to the following values unless another profile is

-- created with parameter values set to different value or UNLIMITED

-- is created and assigned to the user.

-- Enable this if you want older version of the Password Profile parameters

-- ALTER PROFILE DEFAULT LIMIT

-- PASSWORD_LIFE_TIME 60

-- PASSWORD_GRACE_TIME 10

-- PASSWORD_REUSE_TIME 1800

-- PASSWORD_REUSE_MAX UNLIMITED

-- FAILED_LOGIN_ATTEMPTS 3

-- PASSWORD_LOCK_TIME 1/1440

-- PASSWORD_VERIFY_FUNCTION verify_function;

————————————————

版权声明:本文为CSDN博主「疾风铸境」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/xqf222/article/details/50263181

分享到:

oracle数据库密码复杂度查询,Oracle11g R2创建PASSWORD_VERIFY_FUNCTION对应密码复杂度验证函数步骤...相关推荐

  1. Oracle数据库之多表查询

    oracle安装参照: Oracle数据库之安装教程 Oracle数据库总结: Oracle数据库之基本查询 Oracle数据库之单行函数 Oracle数据库之多行函数 Oracle数据库之多表查询 ...

  2. ORACLE数据库多表关联查询效率问题解决方案

    ORACLE数据库多表关联查询效率问题解决方案 参考文章: (1)ORACLE数据库多表关联查询效率问题解决方案 (2)https://www.cnblogs.com/baib/p/5086777.h ...

  3. Oracle数据库中的级联查询、级联删除、级联更新操作教程

    这里整理了Oracle中的三种级联操作,其中Oracle定义外健的时候可以定义级联删除,但是没有级联修改的语法,当然可以用触发器实现,下面我们详细来看Oracle数据库中的级联查询.级联删除.级联更新 ...

  4. Oracle数据库排序和限制查询

    Oracle数据库排序和限制查询 第二章 排序和限制查询 列表 Oracle数据库排序和限制查询 第二章 排序和限制查询 一.排序 语法 知识点: 1.排序使用order by字句,该子句只对查询记录 ...

  5. oracle查询数据都是问号,Oracle数据库PL/SQL Developer查询结果显示问号乱码的解决方法...

    PL SQL Developer,查询结果中的中文变成了一堆问号,SQL语句中的中文被提示invalid character,不能识别. 解决方法: 执行,select userenv('langua ...

  6. Oracle数据库多表连接查询操作以及查询操作的补充

    文章目录 一.查询语句概述 1.查询语句基本语法格式 2.伪表和伪劣 二.单表查询 1.select子句 2.FROM子句 3.WHERE子句 4.DISTINCT关键字 5.GROUP BY子句与聚 ...

  7. Oracle数据库(表、查询语句、条件查询)的使用

    Oracle数据库 表 表是从属于用户的 查询表 查询表(用户名.表名),当前用户查询自己的表时,用户名.可以省略,其他用户查询 别的用户表 ,不能省略,同时必须存在权限. 表结构 表名 列是字段,字 ...

  8. oracle数据库查询需步骤,PLSQL操作Oracle数据库之单表查询SQL语句 看完你就知道了...

    Orcale数据库作为商业级的大型关系型数据库管理系统,以其较高的安全性和强大的可移植性赢得了市场的广泛认可,而PLSQL作为操作Oracle的编程语言的最佳选择,掌握其编程原理及基本的sql操作是掌 ...

  9. oracle数据库多表联合查询

    高级查询(多表连接查询): 等值连接    select s.sname,e.cno,e.degree from student s,score e where s.sno=e.sno; 左外连接 l ...

最新文章

  1. matlab mobile中文版,MATLAB Mobile
  2. 江苏python工资一般多少_会计行业一般工资多少?
  3. CF986C AND Graph
  4. python和php可以一起用吗_Apache同时支持PHP和Python的配置方法
  5. 在查询的结果中添加自增列 两种方法
  6. Promise学习——解决回调地狱问题
  7. upstream directive is not allowed here in
  8. 由for V.S. for each想到的
  9. 二维码在线生成器如何批量制作设备标牌二维码
  10. 健康知识api根据健康知识ID查询详细信息
  11. 系统服务器软件 服务器操作软件,服务器操作系统和服务器软件
  12. WindowsX64下pyinstaller打包code
  13. 论文解读 用于弱监督表面缺陷分割的缺陷注意模板循环对抗网络 (Defect attention template generation cycleGAN for weakly supervised)
  14. python 阮一峰_ES6 Iterator笔记(摘抄至阮一峰的ECMAScript 6入门)
  15. 【精品推荐】130个令你眼前一亮的网站,总有一个你用得着(转)
  16. SecTalks: BNE0x00 - Minotaur靶机
  17. 查看表空间及增加表空间
  18. MASA Blazor入门一看就会
  19. Python—re正则表达式
  20. 【UmiJS 3.x入门】

热门文章

  1. 用PyMC3进行贝叶斯统计分析(代码+实例)
  2. 数字图像处理 第一章 概述
  3. leetcode动态规划(python与c++)
  4. Android之自定义控件入门
  5. log4j 控制台和文件输出乱码问题解决
  6. 计算机术语局部性,【计算机基础】程序的局部性简介
  7. C++学习之路 | PTA乙级—— 1093 字符串A+B (20 分)(精简)
  8. java隋唐演义游戏下载_JAVA多线程
  9. ajax滚动条动态加载,下拉滚动条,动态加载ajax加载数据
  10. android默认exported_android:exported 属性详解-阿里云开发者社区