# .bash_profile
export ORACLE_SID=myorcldb
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
sqlplus -s "/as sysdba" @digo.sql|tee -a digo.log
conn system/oracle
SET LINESIZE 130;
--SET WRAP OFF
--COL sql_text FORMAT A80;
col time format 999999;
COL sid FORMAT 999999999;
COL serial# FORMAT 999999999;
COL TIME FORMAT 999999999;
COL program FORMAT a40;
col sql_text FORMAT a40;
COL TABLESPACE_NAME FORMAT a20
COL FILE_NAME FORMAT a20
COL AUTOEXTENSIBLE FORMAT a10
COL TOTAL_SIZE FORMAT 999999
COL USED_SIZE FORMAT 99999
COL USED_RATIO FORMAT 999999
col component for a40;
col cur_size for a10;
col min_size for a10;
col name for a30
col value for a30
select value from v$diag_info where name='Diag Trace';SELECT program, sid,serial# , TIME,sql_text
FROM (
SELECT a.program
,a.SID
,a.serial#
,to_char(ELAPSED_TIME/(1000000 * decode(executions,null,1,0,1,executions)),999999.99 ) TIME
, substr(REPLACE(trim (b.sql_text),' ',''),1,30) sql_text
FROM v$session a
,v$sqlarea b
WHERE a.sql_address = b.address
AND A.STATUS ='ACTIVE') ;
SELECT '-----------SESSION LIST-----',
Count(*) TOTAL_SESSION,
Count( DECODE( Status, 'ACTIVE', 1, NULL)) active_cnt,
Count( DECODE( server, 'DEDICATED', 1, null)) dedicated_cnt,
Count( Decode (TYPE, 'BACKGROUND', 1, null)) back_cnt
FROM V$SESSION
WHERE TYPE <>'BACKGROUND';
select a.sid, a.serial#,
--b.type, c.object_name, a.program, a.lockwait,
--a.logon_time, a.process, a.osuser, a.terminal ,
d.sql_text
from v$session a, v$lock b, dba_objects c,v$sqlarea d
where a.sid = b.sid
and b.id1 = c.object_id
and b.type = 'TM'
AND a.sql_address=d.address(+);
SELECT DISTINCT X.TABLESPACE_NAME,X.FILE_NAME,X.AUTOEXTENSIBLE
,TOTAL_SIZE / 1024 / 1024 TOTAL_SIZE
,USED_SIZE / 1024 / 1024 USED_SIZE
,(ROUND(USED_SIZE / TOTAL_SIZE, 2)) * 100 USED_RATIO
FROM (SELECT TABLESPACE_NAME,AUTOEXTENSIBLE,FILE_NAME, SUM(BYTES) TOTAL_SIZE
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME,AUTOEXTENSIBLE,FILE_NAME) X
,(SELECT TABLESPACE_NAME, SUM(BYTES) USED_SIZE
FROM DBA_EXTENTS
GROUP BY TABLESPACE_NAME) Y
WHERE X.TABLESPACE_NAME = Y.TABLESPACE_NAME(+)
AND Y.USED_SIZE > .9 * X.TOTAL_SIZE;
select program, pga_used_mem,pga_used_mem/1024/1024, pga_alloc_mem, pga_max_mem
from v$process;
select round(sum(pga_used_mem)/1024/1024, 1) as pga_used from v$process;
select component,
round(current_size/1024/1024, 2)||'MB' as cur_size,
round(min_size/1024/1024, 2)||'MB' as min_size
from v$sga_dynamic_components
where component = 'ASM Buffer Cache';
select component,
round(current_size/1024/1024, 2)||'MB' as cur_size,
round(min_size/1024/1024, 2)||'MB' as min_size
from v$sga_dynamic_components
where component = 'ASM Buffer Cache'
;
select name, issys_modifiable, value
from v$parameter
where name in ('sga_target','sga_max_size','db_cache_size',
'shared_pool_size','shared_pool_reserved_size',
'java_pool_size','streams_pool_size','large_pool_size',
'pga_aggregate_target','workarea_size_policy','processes');
SQL>
--alter system set sga_target=1g scope=spfile; or
--alter system set sga_max_size=1g scope=spfile;
--alter system set pga_aggregate_target=50m scope=spfile;
--alter system set shared_pool_size=200m scope=spfile;
--alter system set shared_pool_reserved_size=50m scope=spfile;
--alter system set db_cache_size=100m scope=spfile;
--alter system set streams_pool_size=100m scope=spfile;
--alter system set java_pool_size=50m;
--alter system set processes=500 scope=spfile;
select name, round(bytes/1024/1024, 2)||'MB' as memory
from v$sgainfo;
col window_name format a20
col client_name format a33
col TOTAL_CPU_LAST_7_DAYS format a32
col MEAN_JOB_DURATION format a32
select CLIENT_NAME, STATUS, MEAN_JOB_DURATION, TOTAL_CPU_LAST_7_DAYS from DBA_AUTOTASK_CLIENT;
col WINDOW_NAME for a18
col RESOURCE_PLAN for a25
col REPEAT_INTERVAL for a60
col DURATION for a20
select --a.WINDOW_GROUP_NAME, a.ENABLED,
c.WINDOW_NAME, c.RESOURCE_PLAN,
c.REPEAT_INTERVAL, c.DURATION--, c.ENABLED, c.ACTIVE
from DBA_SCHEDULER_WINDOW_GROUPS a,
DBA_SCHEDULER_WINGROUP_MEMBERS b,
DBA_SCHEDULER_WINDOWS c
where a.WINDOW_GROUP_NAME ='MAINTENANCE_WINDOW_GROUP'
and a.WINDOW_GROUP_NAME = b.WINDOW_GROUP_NAME
and b.WINDOW_NAME = c.WINDOW_NAME;
col GROUP_OR_SUBPLAN for a25
select a.plan, GROUP_OR_SUBPLAN, type, CPU_P1, CPU_P2, MAX_UTILIZATION_LIMIT
from DBA_RSRC_PLANS a, DBA_RSRC_PLAN_DIRECTIVES b
where a.PLAN='DEFAULT_MAINTENANCE_PLAN'
and a.plan = b.plan
order by 2;
col GROUP_OR_SUBPLAN for a30
select GROUP_OR_SUBPLAN,TYPE,CPU_P1,CPU_P2,CPU_P3
from DBA_RSRC_PLAN_DIRECTIVES
where PLAN='ORA$AUTOTASK_SUB_PLAN'
order by type desc;
select PLAN, GROUP_OR_SUBPLAN,TYPE,CPU_P1,CPU_P2,CPU_P3
from DBA_RSRC_PLAN_DIRECTIVES
where PLAN='ORA$AUTOTASK_HIGH_SUB_PLAN'
order by type desc;
col JOB_CLASS_NAME for a27
col RESOURCE_CONSUMER_GROUP for a26
col comments for a60
select JOB_CLASS_NAME, RESOURCE_CONSUMER_GROUP, COMMENTS--, SERVICE, LOGGING_LEVEL, LOG_HISTORY
from DBA_SCHEDULER_JOB_CLASSES;
exit;
<<EOF