-- ----------------------------------------------------------------------------------- -- File Name : https://oracle-base.com/dba/monitoring/tuning.sql -- Author : Tim Hall -- Description : Displays several performance indicators and comments on the value. -- Requirements : Access to the V$ views. -- Call Syntax : @tuning -- Last Modified: 15/07/2000 -- ----------------------------------------------------------------------------------- SET SERVEROUTPUT ON SET LINESIZE 1000 SET FEEDBACK OFF SELECT * FROM v$database; PROMPT DECLARE v_value NUMBER; FUNCTION Format(p_value IN NUMBER) RETURN VARCHAR2 IS BEGIN RETURN LPad(To_Char(Round(p_value,2),'990.00') || '%',8,' ') || ' '; END; BEGIN -- -------------------------- -- Dictionary Cache Hit Ratio -- -------------------------- SELECT (1 - (Sum(getmisses)/(Sum(gets) + Sum(getmisses)))) * 100 INTO v_value FROM v$rowcache; DBMS_Output.Put('Dictionary Cache Hit Ratio : ' || Format(v_value)); IF v_value < 90 THEN DBMS_Output.Put_Line('Increase SHARED_POOL_SIZE parameter to bring value above 90%'); ELSE DBMS_Output.Put_Line('Value Acceptable.'); END IF; -- ----------------------- -- Library Cache Hit Ratio -- ----------------------- SELECT (1 -(Sum(reloads)/(Sum(pins) + Sum(reloads)))) * 100 INTO v_value FROM v$librarycache; DBMS_Output.Put('Library Cache Hit Ratio : ' || Format(v_value)); IF v_value < 99 THEN DBMS_Output.Put_Line('Increase SHARED_POOL_SIZE parameter to bring value above 99%'); ELSE DBMS_Output.Put_Line('Value Acceptable.'); END IF; -- ------------------------------- -- DB Block Buffer Cache Hit Ratio -- ------------------------------- SELECT (1 - (phys.value / (db.value + cons.value))) * 100 INTO v_value FROM v$sysstat phys, v$sysstat db, v$sysstat cons WHERE phys.name = 'physical reads' AND db.name = 'db block gets' AND cons.name = 'consistent gets'; DBMS_Output.Put('DB Block Buffer Cache Hit Ratio : ' || Format(v_value)); IF v_value < 89 THEN DBMS_Output.Put_Line('Increase DB_BLOCK_BUFFERS parameter to bring value above 89%'); ELSE DBMS_Output.Put_Line('Value Acceptable.'); END IF; -- --------------- -- Latch Hit Ratio -- --------------- SELECT (1 - (Sum(misses) / Sum(gets))) * 100 INTO v_value FROM v$latch; DBMS_Output.Put('Latch Hit Ratio : ' || Format(v_value)); IF v_value < 98 THEN DBMS_Output.Put_Line('Increase number of latches to bring the value above 98%'); ELSE DBMS_Output.Put_Line('Value acceptable.'); END IF; -- ----------------------- -- Disk Sort Ratio -- ----------------------- SELECT (disk.value/mem.value) * 100 INTO v_value FROM v$sysstat disk, v$sysstat mem WHERE disk.name = 'sorts (disk)' AND mem.name = 'sorts (memory)'; DBMS_Output.Put('Disk Sort Ratio : ' || Format(v_value)); IF v_value > 5 THEN DBMS_Output.Put_Line('Increase SORT_AREA_SIZE parameter to bring value below 5%'); ELSE DBMS_Output.Put_Line('Value Acceptable.'); END IF; -- ---------------------- -- Rollback Segment Waits -- ---------------------- SELECT (Sum(waits) / Sum(gets)) * 100 INTO v_value FROM v$rollstat; DBMS_Output.Put('Rollback Segment Waits : ' || Format(v_value)); IF v_value > 5 THEN DBMS_Output.Put_Line('Increase number of Rollback Segments to bring the value below 5%'); ELSE DBMS_Output.Put_Line('Value acceptable.'); END IF; -- ------------------- -- Dispatcher Workload -- ------------------- SELECT NVL((Sum(busy) / (Sum(busy) + Sum(idle))) * 100,0) INTO v_value FROM v$dispatcher; DBMS_Output.Put('Dispatcher Workload : ' || Format(v_value)); IF v_value > 50 THEN DBMS_Output.Put_Line('Increase MTS_DISPATCHERS to bring the value below 50%'); ELSE DBMS_Output.Put_Line('Value acceptable.'); END IF; END; / PROMPT SET FEEDBACK ON
Monday, October 24, 2016
Tning.sql - performance analyser
- ORDS (oracle Rest Data services)
- ORDS (oracle Rest Data services)
Oracle now support data services - running on standalone machines, means no need of weblogic , glassfish application/ tools,
installation / is simple need to define
Port and Image in
standalone.http.port=8080
standalone.static.images=/home/oracle/apex/images
Based on the installation in the linked article, you will find the standalone settings in the following file.
/home/oracle/ords-3.0.7-conf/ords/standalone/standalone.properties
-------------
you can always star the service using
cd ~/ords-3.0.7
$JAVA_HOME/bin/java -jar ords.war
ctrl+C will stop the service, for production environment , use Nohup to run the process in backgrond and you can kill the process when you want to stop.
Oracle now support data services - running on standalone machines, means no need of weblogic , glassfish application/ tools,
installation / is simple need to define
Port and Image in
standalone.http.port=8080
standalone.static.images=/home/oracle/apex/images
Based on the installation in the linked article, you will find the standalone settings in the following file.
/home/oracle/ords-3.0.7-conf/ords/standalone/standalone.properties
-------------
you can always star the service using
cd ~/ords-3.0.7
$JAVA_HOME/bin/java -jar ords.war
ctrl+C will stop the service, for production environment , use Nohup to run the process in backgrond and you can kill the process when you want to stop.
Sunday, October 23, 2016
Script to get Details ASM - Oracle Given Script 1
SPOOL ASM<#>_GENERIC_ASM_METADATA.html
-- ASM VERSIONS 10.1, 10.2, 11.1, 11.2 & 12.1
SET MARKUP HTML ON
SET ECHO ON
SET PAGESIZE 200
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
SELECT 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , SYSDATE " " FROM DUAL;
SELECT 'INSTANCE NAME: ==)> ' , INSTANCE_NAME " " FROM V$INSTANCE;
SELECT 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " FROM V$SESSION WHERE PROGRAM LIKE '%SMON%';
SELECT * FROM V$INSTANCE;
SELECT * FROM GV$INSTANCE;
SELECT * FROM V$ASM_DISKGROUP;
SELECT GROUP_NUMBER, DISK_NUMBER, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE, OS_MB, TOTAL_MB, FREE_MB, NAME, FAILGROUP, PATH
FROM V$ASM_DISK ORDER BY GROUP_NUMBER, FAILGROUP, DISK_NUMBER;
SELECT * FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;
SELECT SUBSTR(D.NAME,1,16) AS ASMDISK, D.MOUNT_STATUS, D.STATE,
DG.NAME AS DISKGROUP FROM V$ASM_DISKGROUP DG, V$ASM_DISK D
WHERE DG.GROUP_NUMBER = D.GROUP_NUMBER;
SELECT * FROM V$ASM_CLIENT;
SELECT DG.NAME AS DISKGROUP, SUBSTR(C.INSTANCE_NAME,1,12) AS INSTANCE,
SUBSTR(C.DB_NAME,1,12) AS DBNAME, SUBSTR(C.SOFTWARE_VERSION,1,12) AS SOFTWARE,
SUBSTR(C.COMPATIBLE_VERSION,1,12) AS COMPATIBLE
FROM V$ASM_DISKGROUP DG, V$ASM_CLIENT C
WHERE DG.GROUP_NUMBER = C.GROUP_NUMBER;
SELECT * FROM V$ASM_ATTRIBUTE;
SELECT * FROM V$ASM_OPERATION;
SELECT * FROM GV$ASM_OPERATION;
SELECT * FROM V$VERSION;
SELECT * FROM V$ASM_ACFSSNAPSHOTS;
SELECT * FROM V$ASM_ACFSVOLUMES;
SELECT * FROM V$ASM_FILESYSTEM;
SELECT * FROM V$ASM_VOLUME;
SELECT * FROM V$ASM_VOLUME_STAT;
SELECT * FROM V$ASM_USER;
SELECT * FROM V$ASM_USERGROUP;
SELECT * FROM V$ASM_USERGROUP_MEMBER;
SELECT * FROM V$ASM_DISK_IOSTAT;
SELECT * FROM V$ASM_DISK_STAT;
SELECT * FROM V$ASM_DISKGROUP_STAT;
SELECT * FROM V$ASM_TEMPLATE;
SHOW PARAMETER
SHOW SGA
!echo "SELECT '" > /tmp/GPNPTOOL.SQL 2> /dev/null
! $ORACLE_HOME/bin/gpnptool get >> /tmp/GPNPTOOL.SQL 2>> /dev/null
!echo "' FROM DUAL;" >> /tmp/GPNPTOOL.SQL 2>> /dev/null
! cat /tmp/GPNPTOOL.SQL
SET ECHO OFF
--DISPLAYS INFORMATION ABOUT THE CONTENTS OF THE SPFILE.
SELECT * FROM V$SPPARAMETER ORDER BY 2;
SELECT * FROM GV$SPPARAMETER ORDER BY 3;
--DISPLAYS INFORMATION ABOUT THE INITIALIZATION PARAMETERS THAT ARE CURRENTLY IN EFFECT IN THE INSTANCE.
SELECT * FROM V$SYSTEM_PARAMETER ORDER BY 2;
SELECT * FROM GV$SYSTEM_PARAMETER ORDER BY 3;
-- 12C ACFS VIEWS
SELECT * FROM V$ASM_ACFS_ENCRYPTION_INFO;
SELECT * FROM V$ASM_ACFSREPL;
SELECT * FROM V$ASM_ACFSREPLTAG;
SELECT * FROM V$ASM_ACFS_SEC_ADMIN;
SELECT * FROM V$ASM_ACFS_SEC_CMDRULE;
SELECT * FROM V$ASM_ACFS_SEC_REALM;
SELECT * FROM V$ASM_ACFS_SEC_REALM_FILTER;
SELECT * FROM V$ASM_ACFS_SEC_REALM_GROUP;
SELECT * FROM V$ASM_ACFS_SEC_REALM_USER;
SELECT * FROM V$ASM_ACFS_SEC_RULE;
SELECT * FROM V$ASM_ACFS_SEC_RULESET;
SELECT * FROM V$ASM_ACFS_SEC_RULESET_RULE;
SELECT * FROM V$ASM_ACFS_SECURITY_INFO;
SELECT * FROM V$ASM_ACFSTAG;
-- 12C ASM AUDIT VIEWS
SELECT * FROM V$ASM_AUDIT_CLEAN_EVENTS;
SELECT * FROM V$ASM_AUDIT_CLEANUP_JOBS;
SELECT * FROM V$ASM_AUDIT_CONFIG_PARAMS;
SELECT * FROM V$ASM_AUDIT_LAST_ARCH_TS;
-- 12C ASM ESTIMATE VIEW
SELECT * FROM V$ASM_ESTIMATE;
SELECT * FROM GV$ASM_ESTIMATE;
SPOOL OFF
EXIT
-- ASM VERSIONS 10.1, 10.2, 11.1, 11.2 & 12.1
SET MARKUP HTML ON
SET ECHO ON
SET PAGESIZE 200
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
SELECT 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , SYSDATE " " FROM DUAL;
SELECT 'INSTANCE NAME: ==)> ' , INSTANCE_NAME " " FROM V$INSTANCE;
SELECT 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " FROM V$SESSION WHERE PROGRAM LIKE '%SMON%';
SELECT * FROM V$INSTANCE;
SELECT * FROM GV$INSTANCE;
SELECT * FROM V$ASM_DISKGROUP;
SELECT GROUP_NUMBER, DISK_NUMBER, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE, OS_MB, TOTAL_MB, FREE_MB, NAME, FAILGROUP, PATH
FROM V$ASM_DISK ORDER BY GROUP_NUMBER, FAILGROUP, DISK_NUMBER;
SELECT * FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;
SELECT SUBSTR(D.NAME,1,16) AS ASMDISK, D.MOUNT_STATUS, D.STATE,
DG.NAME AS DISKGROUP FROM V$ASM_DISKGROUP DG, V$ASM_DISK D
WHERE DG.GROUP_NUMBER = D.GROUP_NUMBER;
SELECT * FROM V$ASM_CLIENT;
SELECT DG.NAME AS DISKGROUP, SUBSTR(C.INSTANCE_NAME,1,12) AS INSTANCE,
SUBSTR(C.DB_NAME,1,12) AS DBNAME, SUBSTR(C.SOFTWARE_VERSION,1,12) AS SOFTWARE,
SUBSTR(C.COMPATIBLE_VERSION,1,12) AS COMPATIBLE
FROM V$ASM_DISKGROUP DG, V$ASM_CLIENT C
WHERE DG.GROUP_NUMBER = C.GROUP_NUMBER;
SELECT * FROM V$ASM_ATTRIBUTE;
SELECT * FROM V$ASM_OPERATION;
SELECT * FROM GV$ASM_OPERATION;
SELECT * FROM V$VERSION;
SELECT * FROM V$ASM_ACFSSNAPSHOTS;
SELECT * FROM V$ASM_ACFSVOLUMES;
SELECT * FROM V$ASM_FILESYSTEM;
SELECT * FROM V$ASM_VOLUME;
SELECT * FROM V$ASM_VOLUME_STAT;
SELECT * FROM V$ASM_USER;
SELECT * FROM V$ASM_USERGROUP;
SELECT * FROM V$ASM_USERGROUP_MEMBER;
SELECT * FROM V$ASM_DISK_IOSTAT;
SELECT * FROM V$ASM_DISK_STAT;
SELECT * FROM V$ASM_DISKGROUP_STAT;
SELECT * FROM V$ASM_TEMPLATE;
SHOW PARAMETER
SHOW SGA
!echo "SELECT '" > /tmp/GPNPTOOL.SQL 2> /dev/null
! $ORACLE_HOME/bin/gpnptool get >> /tmp/GPNPTOOL.SQL 2>> /dev/null
!echo "' FROM DUAL;" >> /tmp/GPNPTOOL.SQL 2>> /dev/null
! cat /tmp/GPNPTOOL.SQL
SET ECHO OFF
--DISPLAYS INFORMATION ABOUT THE CONTENTS OF THE SPFILE.
SELECT * FROM V$SPPARAMETER ORDER BY 2;
SELECT * FROM GV$SPPARAMETER ORDER BY 3;
--DISPLAYS INFORMATION ABOUT THE INITIALIZATION PARAMETERS THAT ARE CURRENTLY IN EFFECT IN THE INSTANCE.
SELECT * FROM V$SYSTEM_PARAMETER ORDER BY 2;
SELECT * FROM GV$SYSTEM_PARAMETER ORDER BY 3;
-- 12C ACFS VIEWS
SELECT * FROM V$ASM_ACFS_ENCRYPTION_INFO;
SELECT * FROM V$ASM_ACFSREPL;
SELECT * FROM V$ASM_ACFSREPLTAG;
SELECT * FROM V$ASM_ACFS_SEC_ADMIN;
SELECT * FROM V$ASM_ACFS_SEC_CMDRULE;
SELECT * FROM V$ASM_ACFS_SEC_REALM;
SELECT * FROM V$ASM_ACFS_SEC_REALM_FILTER;
SELECT * FROM V$ASM_ACFS_SEC_REALM_GROUP;
SELECT * FROM V$ASM_ACFS_SEC_REALM_USER;
SELECT * FROM V$ASM_ACFS_SEC_RULE;
SELECT * FROM V$ASM_ACFS_SEC_RULESET;
SELECT * FROM V$ASM_ACFS_SEC_RULESET_RULE;
SELECT * FROM V$ASM_ACFS_SECURITY_INFO;
SELECT * FROM V$ASM_ACFSTAG;
-- 12C ASM AUDIT VIEWS
SELECT * FROM V$ASM_AUDIT_CLEAN_EVENTS;
SELECT * FROM V$ASM_AUDIT_CLEANUP_JOBS;
SELECT * FROM V$ASM_AUDIT_CONFIG_PARAMS;
SELECT * FROM V$ASM_AUDIT_LAST_ARCH_TS;
-- 12C ASM ESTIMATE VIEW
SELECT * FROM V$ASM_ESTIMATE;
SELECT * FROM GV$ASM_ESTIMATE;
SPOOL OFF
EXIT
Subscribe to:
Posts (Atom)