oracle数据库修改、创建配置文件

原创 2016年05月30日 22:58:59

1)       修改配置文件DEFAULT
ALTER PROFILE DEFAULT LIMIT

PASSWORD_LIFE_TIME UNLIMITED

PASSWORD_GRACE_TIME UNLIMITED

PASSWORD_REUSE_TIME UNLIMITED

PASSWORD_REUSE_MAX UNLIMITED

FAILED_LOGIN_ATTEMPTS UNLIMITED

PASSWORD_LOCK_TIME UNLIMITED

PASSWORD_VERIFY_FUNCTION NULL;

2)       启用资源限制
ALTER SYSTEM SET RESOURCE_LIMIT=TRUE;

3)    创建口令校验函数“VF_285”

CREATE OR REPLACE FUNCTION VF_285
(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
   <<findchar>>
   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;


   <<endsearch>>
   -- 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;
/

4)       创建配置文件PRO_271
CREATE PROFILE PRO_271 LIMIT

PASSWORD_LOCK_TIME 9

PASSWORD_REUSE_TIME 30

PASSWORD_VERIFY_FUNCTION VF_285

CPU_PER_SESSION 100

IDLE_TIME 120

LOGICAL_READS_PER_CALL 80     

PRIVATE_SGA 52428800;


版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

java通过配置文件jdbc.properties链接Oracle数据库工具类

package resources;import java.io.IOException; import java.io.InputStream; import java.sql.Connection...

连接Oracle数据库的Hibernate配置文件

连接Oracle数据库的Hibernate配置文件 连接Oracle的Hibernate配置文件有两种格式,一种是xml格式的,另一种是Java属性文件格式的。下面分别给出这两种格式配置文件的代码。...

java连接oracle数据库(利用MyEclipse开发工具反向生成 bean与配置文件)

java连接oracle数据库(反向生成)                      &...

java连接oracle数据库(利用MyEclipse开发工具反向生成 bean与配置文件)

java连接oracle数据库(反向生成)                      ...

使用配置文件自动备份远程oracle数据库

一、编写配置文件quartz.properties,放置在src目录下; #是备份数据库的url db_url=192.168.11.201:1521/orcl #是备份数据库的username db...

【跟我学spring 4.0 】之第七节-spring使用外部属性文件-spring配置连接oracle数据库

使用外部属性文件1.在配置文件里配置Bean时,有时需要在Bean的配置里混入系统部署的细节信息(例如:文件路劲,数据源配置信息等)。而这些部署细节实际上需要和Bean配置相分离。2.Spring提供...

dom4j+xpath读取xml文件配置Oracle数据库连接

今天借助配置Oracle数据库连接的实例,跟大家一起来学习读取xml文件的一种方法(其他读取方法后续介绍)——使用dom4j+xpath。 dom4j是dom4j.org出品的一个开源的XML解析包。...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)