Disk management-view disk information-you can regularly use the results of df-h to enter an External Log File. Then, you can use Oracle's "External table" to access this "External Log File". For example, -- Step 1: write a script to regularly import disk information to the log file: [oracle @ localhost ~] $ More/data/obase/tbs_info/disk_info.sh #! /Bin/bash # source/home/oracle /. bash_profile cd/data/obase/tbs_info/echo "-------- Disk Used Info of Server: 10.4.1.12 --------">/data/obase/tbs_info/disk_info.log echo "-------- DateTime: 'date' ------- ">/data/obase/tbs_info/disk_info.log df-h>/data/obase/tbs_info/disk_info.log -- Step 2: regularly execute scripts with crontab (for example: run the command at every hour (once every hour): [oracle @ localhost ~] $ Crontab-e 59 ****/data/obase/tbs_info/disk_info.sh>/data/obase/tbs_info/disk_info.log -- Step 2: Create the TBS_INFO directory, and grant the lym User read and write permissions. Create directory TBS_INFO AS '/data/obase/tbs_info/'; grant read, write on directory TBS_INFO to lym; -- Step 3: monitor disk space usage of each database server: select dbms_metadata.get_ddl ('table', 'disk _ info') from dual; ----------------------------------------------------- 3.1 statement for creating an external TABLE: create table "LYM ". "DISK_INFO" ("TEXT" VARCHAR2 (150) organization external (TYPE ORACLE_LOADER default directory "TBS_INFO" ACCESS PARAMETERS (records delimited by newline nobadfile nodiscardfile nologfile) LOCATION ('disk _ info. log') reject limit unlimited -- 3.2. create or replace function disk_info_func RETURN VARCHAR2 /********************** **************************************** * ****************** function: monitor the usage of each disk space on the Oracle database server (10.4.1.12, 10.4.1.13, and 10.4.1.21) **. If the occupied space exceeds 80% of the total space, the disk space information is obtained! **************************************** * **********************************/V_cnt12 NUMBER (18, 0 ); v_cnt13 NUMBER (4000); v_cnt21 NUMBER (4000); v_disk_info VARCHAR2 (); v_disk_info_all VARCHAR2 (); begin select count (*) AS cnt INTO v_cnt12 FROM disk_info @ tdw12_lym WHERE (text LIKE '% 8 _ \ % 'escape' \ 'OR text LIKE' % 9 _ \ % 'escape '\' OR text LIKE '% 100 \ %' escape '\') AND text LIKE '%/dev /Sdb % ') OR (text like' % 9 _ \ % 'escape '\' OR text LIKE '% 100 \ % 'escape '\') AND text not like '%/dev/sdb %'); SELECT count (*) AS cnt INTO v_cnt13 FROM disk_info @ tdw13_lym WHERE (text LIKE '% 8 _ \ % 'escape' \ 'OR text LIKE' % 9 _ \ % 'escape '\' OR text LIKE '% 100 \ %' escape '\') AND text LIKE '%/dev/sdb % ') OR (text like '% 9 _ \ % 'escape' \ 'OR text LIKE' % 100 \ % 'escape '\') AND text NOT LIKE '%/dev/sdb %'); SELECT count (*) AS cnt INTO v_cnt21 FROM disk_info WHERE (text LIKE '% 8_\% 'escape' \ 'OR text LIKE' % 9 _ \ % 'escape '\' OR text LIKE '% 100 \ %' escape '\') AND text LIKE '%/dev/sdb % ') OR (text like '% 9 _ \ % 'escape' \ 'OR text LIKE' % 100 \ % 'escape '\') AND text not like '%/dev/sdb %'); v_disk_info: = ''; v_disk_info_all: =''; IF v_cnt12> 0 then for i12 IN (SELECT Text as disk_info FROM disk_info @ tdw12_lym order by rowid) LOOP v_disk_info: = i12.disk _ info; v_disk_info_all: = v_disk_info_all | v_disk_info | chr (10); end loop; end if; IF v_cnt13> 0 then for i13 IN (SELECT text as disk_info FROM disk_info @ tdw13_lym order by rowid) LOOP v_disk_info: = i13.disk _ info; v_disk_info_all: = v_disk_info_all | v_disk_info | chr (10); end loop; end if; IF v_cnt21> 0 N for i21 IN (SELECT text as disk_info FROM disk_info order by rowid) LOOP v_disk_info: = i21.disk _ info; v_disk_info_all: = v_disk_info_all | v_disk_info | chr (10); end loop; end if; IF v_disk_info_all is null then v_disk_info_all: = 'all disks' space are OK! '; End if; RETURN v_disk_info_all; END;/-- * 3.3. create a stored procedure call function, obtain the disk space usage information: create or replace procedure get_disk_info_proc /**************************** ****************************************: monitor the usage of each disk space on the Oracle database server (10.4.1.12, 10.4.1.13, and 10.4.1.21) **. If the occupied space exceeds 80% of the total space, an alert will be sent by email! **************************************** * **********************************/V_disk_info varchar2 (4000 ); begin select DISK_INFO_FUNC () INTO v_disk_info FROM dual; IF v_disk_info <> 'all disks' space are OK! 'Then PROCSENDEMAIL (v_disk_info, 'disk Space Emergency !!! ', 'Ymluo @ corp.tudou.com', '2017 @ 139.com ', '10. 5.101.1 ', '25', '0', NULL, 'bit 7'); end if; -- dbms_output.put_line (v_disk_info); END;/-- * 3.4. create Job timed monitoring -- job 1.1 -- execute variable job_disk_info_proc number every 15 minutes; begin dbms_job.submit (: job_disk_info_proc, 'Get _ disk_info_proc; ', sysdate, 'sysdate + 100 '); end;