设为首页收藏本站

Botang唐波's Oracle Station

查看: 196|回复: 0

课程第32次(2018-08-24星期五)

[复制链接]

744

主题

1117

帖子

8077

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
8077
发表于 2018-8-24 20:52:54 | 显示全部楼层 |阅读模式
Skillset 1
Section 7装agent:
wget http://station37.example.com:488 ... agentDownload.linux
./agentDownload.linux -b  /u01/app/oracle/product/11.1.0/ -m station37.example.com -r 4889

[oracle@station38 ~]$ sudo /u01/app/oracle/product/agent10g/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/agent10g

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[oracle@station38 ~]$


[oracle@station38 bin]$ ./emctl secure  agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
Agent successfully stopped...   Done.
Securing agent...   Started.
Enter Agent Registration Password :           
Agent successfully restarted...   Done.
Securing agent...   Successful.
[oracle@station38 bin]$ ./emctl upload  agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully
[oracle@station38 bin]$
1.png



Section3:
  1. CREATE OR REPLACE FUNCTION verify_function_11G
  2. (username varchar2,
  3.   password varchar2,
  4.   old_password varchar2)
  5.   RETURN boolean IS
  6.    n boolean;
  7.    m integer;
  8.    differ integer;
  9.    isdigit boolean;
  10.    ischar  boolean;
  11.    ispunct boolean;
  12.    db_name varchar2(40);
  13.    digitarray varchar2(20);
  14.    punctarray varchar2(25);
  15.    chararray varchar2(52);
  16.    i_char varchar2(10);
  17.    simple_password varchar2(10);
  18.    reverse_user varchar2(32);
  19. ----------------------
  20.    part1 varchar2(30);
  21. ----------------------
  22.    part2 varchar2(30);
  23. BEGIN
  24.    digitarray:= '0123456789';
  25.    chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  26.    -- Check for the minimum length of the password
  27.    IF length(password) < 8 THEN
  28.       raise_application_error(-20001, 'Password length less than 8');
  29.    END IF;
  30. --------------------------------
  31.    IF length(password) > 30 THEN
  32.       raise_application_error(-20900, 'Password length more than 30');
  33.    END IF;

  34.    -- Check if the password is same as the username or username(1-100)
  35.    IF NLS_LOWER(password) = NLS_LOWER(username) THEN
  36.      raise_application_error(-20002, 'Password same as or similar to user');
  37.    END IF;
  38. ----------------------------------------------------------------------
  39.    IF length(password)>length(username)
  40.    THEN
  41.       part1 := SUBSTR(password, 1, length(username));
  42.       part2 := SUBSTR(password, length(username)+1);
  43.       FOR i IN 1..(10**(length(part2)+1)-1)
  44.       LOOP
  45.        i_char := to_char(i);
  46.        if NLS_LOWER(username)|| i_char = NLS_LOWER(password) THEN
  47.         raise_application_error(-20005, 'Password same as or similar to user name ');
  48.        END IF;
  49.       END LOOP;
  50.    END IF;  
  51.    -- Check if the password is same as the username reversed
  52.    
  53.    FOR i in REVERSE 1..length(username) LOOP
  54.      reverse_user := reverse_user || substr(username, i, 1);
  55.    END LOOP;
  56.    IF NLS_LOWER(password) = NLS_LOWER(reverse_user) THEN
  57.      raise_application_error(-20003, 'Password same as username reversed');
  58.    END IF;

  59.    -- Check if the password is the same as server name and or servername(1-100)
  60.    select name into db_name from sys.v$database;
  61.    if NLS_LOWER(db_name) = NLS_LOWER(password) THEN
  62.       raise_application_error(-20004, 'Password same as or similar to server name');
  63.    END IF;
  64.    FOR i IN 1..100 LOOP
  65.       i_char := to_char(i);
  66.       if NLS_LOWER(db_name)|| i_char = NLS_LOWER(password) THEN
  67.         raise_application_error(-20005, 'Password same as or similar to server name ');
  68.       END IF;
  69.     END LOOP;

  70.    -- Check if the password is too simple. A dictionary of words may be
  71.    -- maintained and a check may be made so as not to allow the words
  72.    -- that are too simple for the password.
  73.    IF NLS_LOWER(password) IN ('welcome1', 'database1', 'account1', 'user1234', 'password1', 'oracle123', 'computer1', 'abcdefg1', 'change_on_install') THEN
  74.       raise_application_error(-20006, 'Password too simple');
  75.    END IF;

  76.    -- Check if the password is the same as oracle (1-100)
  77.     simple_password := 'oracle';
  78.     FOR i IN 1..100 LOOP
  79.       i_char := to_char(i);
  80.       if simple_password || i_char = NLS_LOWER(password) THEN
  81.         raise_application_error(-20007, 'Password too simple ');
  82.       END IF;
  83.     END LOOP;

  84.    -- Check if the password contains at least one letter, one digit
  85.    -- 1. Check for the digit
  86.    isdigit:=FALSE;
  87.    m := length(password);
  88.    FOR i IN 1..10 LOOP
  89.       FOR j IN 1..m LOOP
  90.          IF substr(password,j,1) = substr(digitarray,i,1) THEN
  91.             isdigit:=TRUE;
  92.              GOTO findchar;
  93.          END IF;
  94.       END LOOP;
  95.    END LOOP;

  96.    IF isdigit = FALSE THEN
  97.       raise_application_error(-20008, 'Password must contain at least one digit, one character');
  98.    END IF;
  99.    -- 2. Check for the character
  100.    <<findchar>>
  101.    ischar:=FALSE;
  102.    FOR i IN 1..length(chararray) LOOP
  103.       FOR j IN 1..m LOOP
  104.          IF substr(password,j,1) = substr(chararray,i,1) THEN
  105.             ischar:=TRUE;
  106.              GOTO endsearch;
  107.          END IF;
  108.       END LOOP;
  109.    END LOOP;
  110.    IF ischar = FALSE THEN
  111.       raise_application_error(-20009, 'Password must contain at least one \
  112.               digit, and one character');
  113.    END IF;


  114.    <<endsearch>>
  115.    -- Check if the password differs from the previous password by at least
  116.    -- 3 letters
  117.    IF old_password IS NOT NULL THEN
  118.      differ := length(old_password) - length(password);

  119.      differ := abs(differ);
  120.      IF differ < 3 THEN
  121.        IF length(password) < length(old_password) THEN
  122.          m := length(password);
  123.        ELSE
  124.          m := length(old_password);
  125.        END IF;

  126.        FOR i IN 1..m LOOP
  127.          IF substr(password,i,1) != substr(old_password,i,1) THEN
  128.            differ := differ + 1;
  129.          END IF;
  130.        END LOOP;

  131.        IF differ < 3 THEN
  132.          raise_application_error(-20011, 'Password should differ from the \
  133.             old password by at least 3 characters');
  134.        END IF;
  135.      END IF;
  136.    END IF;
  137.    -- Everything is fine; return TRUE ;   
  138.    RETURN(TRUE);
  139. END;
  140. /

  141. -- This script alters the default parameters for Password Management
  142. -- This means that all the users on the system have Password Management
  143. -- enabled and set to the following values unless another profile is
  144. -- created with parameter values set to different value or UNLIMITED
  145. -- is created and assigned to the user.

  146. ALTER PROFILE DEFAULT LIMIT
  147. PASSWORD_VERIFY_FUNCTION verify_function_11G;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Botang唐波's Oracle Station   

GMT+8, 2018-11-18 02:07 , Processed in 0.102412 second(s), 27 queries .

快速回复 返回顶部 返回列表