#! /bin/bash
#List processes based on %cpu and memory usage
echo "Start Time" `date`
# By default, it display the list of processes based on the cpu and memory usage #
if [ $# -eq 0 ]
then
echo "List of processes based on the %cpu Usage"
ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu # sorted based on %cpu
echo "List of processes based on the memory Usage"
ps -e -orss=,args= | sort -b -k1,1n # sorted bases rss value
# If arguements are given (mem/cpu)
else
case "$1" in
mem)
echo "List of processes based on the memory Usage"
ps -e -orss=,args= | sort -b -k1,1n
;;
cpu)
echo "List of processes based on the %cpu Usage"
ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu
;;
*)
echo "Invalid Argument Given \n"
echo "Usage : $0 mem/cpu"
exit 1
esac
fi
echo "End Time" `date`
exit 0
===
$ processes.sh
$ processes.sh mem
$ processes.sh cpu
Search This Blog
Total Pageviews
Friday, 30 July 2010
who is using high CPU percentage
apt-amd-02:/home/anujs/Downloads # cat uniqU.sh
#! /bin/bash
w > /tmp/a
echo "Total number of unique users logged in currently"
cat /tmp/a| sed '1,2d' | awk '{print $1}' | uniq | wc -l
echo ""
echo "List of unique users logged in currently"
cat /tmp/a | sed '1,2d'| awk '{print $1}' | uniq
echo ""
echo "The user who is using high %cpu"
cat /tmp/a | sed '1,2d' | awk '$7 > maxuid { maxuid=$7; maxline=$0 }; END { print maxuid, maxline }'
echo ""
echo "List of users logged in and what they are doing"
cat /tmp/a
#! /bin/bash
w > /tmp/a
echo "Total number of unique users logged in currently"
cat /tmp/a| sed '1,2d' | awk '{print $1}' | uniq | wc -l
echo ""
echo "List of unique users logged in currently"
cat /tmp/a | sed '1,2d'| awk '{print $1}' | uniq
echo ""
echo "The user who is using high %cpu"
cat /tmp/a | sed '1,2d' | awk '$7 > maxuid { maxuid=$7; maxline=$0 }; END { print maxuid, maxline }'
echo ""
echo "List of users logged in and what they are doing"
cat /tmp/a
find out Free memory ( shell script )
$ cat mem.sh
#! /bin/bash
# Total memory space details
echo "Memory Space Details"
free -t -m | grep "Total" | awk '{ print "Total Memory space : "$2 " MB";
print "Used Memory Space : "$3" MB";
print "Free Memory : "$4" MB";
}'
echo "Swap memory Details"
free -t -m | grep "Swap" | awk '{ print "Total Swap space : "$2 " MB";
print "Used Swap Space : "$3" MB";
print "Free Swap : "$4" MB";
}'
#! /bin/bash
# Total memory space details
echo "Memory Space Details"
free -t -m | grep "Total" | awk '{ print "Total Memory space : "$2 " MB";
print "Used Memory Space : "$3" MB";
print "Free Memory : "$4" MB";
}'
echo "Swap memory Details"
free -t -m | grep "Swap" | awk '{ print "Total Swap space : "$2 " MB";
print "Used Swap Space : "$3" MB";
print "Free Swap : "$4" MB";
}'
Thursday, 29 July 2010
Oracle Tablespace free space and fragmentation
Script – Tablespace free space and fragmentation
set linesize 150
column tablespace_name format a20 heading 'Tablespace'
column sumb format 999,999,999
column extents format 9999
column bytes format 999,999,999,999
column largest format 999,999,999,999
column Tot_Size format 999,999 Heading 'Total| Size(Mb)'
column Tot_Free format 999,999,999 heading 'Total Free(MB)'
column Pct_Free format 999.99 heading '% Free'
column Chunks_Free format 9999 heading 'No Of Ext.'
column Max_Free format 999,999,999 heading 'Max Free(Kb)'
set echo off
PROMPT FREE SPACE AVAILABLE IN TABLESPACES
select a.tablespace_name,sum(a.tots/1048576) Tot_Size,
sum(a.sumb/1048576) Tot_Free,
sum(a.sumb)*100/sum(a.tots) Pct_Free,
sum(a.largest/1024) Max_Free,sum(a.chunks) Chunks_Free
from
(
select tablespace_name,0 tots,sum(bytes) sumb,
max(bytes) largest,count(*) chunks
from dba_free_space a
group by tablespace_name
union
select tablespace_name,sum(bytes) tots,0,0,0 from
dba_data_files
group by tablespace_name) a
group by a.tablespace_name
order by pct_free;
set linesize 150
column tablespace_name format a20 heading 'Tablespace'
column sumb format 999,999,999
column extents format 9999
column bytes format 999,999,999,999
column largest format 999,999,999,999
column Tot_Size format 999,999 Heading 'Total| Size(Mb)'
column Tot_Free format 999,999,999 heading 'Total Free(MB)'
column Pct_Free format 999.99 heading '% Free'
column Chunks_Free format 9999 heading 'No Of Ext.'
column Max_Free format 999,999,999 heading 'Max Free(Kb)'
set echo off
PROMPT FREE SPACE AVAILABLE IN TABLESPACES
select a.tablespace_name,sum(a.tots/1048576) Tot_Size,
sum(a.sumb/1048576) Tot_Free,
sum(a.sumb)*100/sum(a.tots) Pct_Free,
sum(a.largest/1024) Max_Free,sum(a.chunks) Chunks_Free
from
(
select tablespace_name,0 tots,sum(bytes) sumb,
max(bytes) largest,count(*) chunks
from dba_free_space a
group by tablespace_name
union
select tablespace_name,sum(bytes) tots,0,0,0 from
dba_data_files
group by tablespace_name) a
group by a.tablespace_name
order by pct_free;
Oracle IO Scripts ... very useful
Check IO Scripts from Metalink How To Calculate IOPS of an Oracle Database V$SYSMETRIC – last 15 and 60 seconds V$SYSMETRIC_SUMMARY – values last hour (last snapshot) like avg, max, min etc V$SYSMETRIC_HISTORY – last hour for 1 minute, last 3 mintes for 15 second deltas DBA_HIST_SYSMETRIC_SUMMARY – hour summaries for last week. break on day set pagesize 1000 linesize 5000 col day for a8 col metric_name for 30 select to_char(begin_time,'DD-Mon') Day, A.METRIC_NAME, to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'00',maxval,0)),'999999999999999') "00", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'01',maxval,0)),'999999999999999') "01", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'02',maxval,0)),'999999999999999') "02", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'03',maxval,0)),'999999999999999') "03", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'04',maxval,0)),'999999999999999') "04", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'05',maxval,0)),'999999999999999') "05", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'06',maxval,0)),'999999999999999') "06", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'07',maxval,0)),'999999999999999') "07", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'08',maxval,0)),'999999999999999') "08", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'09',maxval,0)),'999999999999999') "09", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'10',maxval,0)),'999999999999999') "10", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'11',maxval,0)),'999999999999999') "11", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'12',maxval,0)),'999999999999999') "12", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'13',maxval,0)),'999999999999999') "13", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'14',maxval,0)),'999999999999999') "14", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'15',maxval,0)),'999999999999999') "15", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'16',maxval,0)),'999999999999999') "16", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'17',maxval,0)),'999999999999999') "17", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'18',maxval,0)),'999999999999999') "18", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'19',maxval,0)),'999999999999999') "19", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'20',maxval,0)),'999999999999999') "20", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'21',maxval,0)),'999999999999999') "21", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'22',maxval,0)),'999999999999999') "22", to_char(sum(decode(substr(to_char(BEGIN_TIME,'HH24'),1,2),'23',maxval,0)),'999999999999999') "23" from dba_hist_sysmetric_summary A where A.METRIC_NAME in ('Host CPU Utilization (%)', 'Average Active Sessions', 'Session Count', 'SQL Service Response Time', 'User Transaction Per Sec', 'Temp Space Used', 'Total PGA Allocated' ) and BEGIN_TIME > trunc(sysdate) - 7 group by A.METRIC_NAME, to_char(begin_time,'DD-Mon') order by to_char(begin_time,'DD-Mon'),a.metric_name ; 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 -------- ---------------------------------------------------------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- 19-Jan Average Active Sessions 37 32 32 32 33 32 32 32 32 32 32 32 32 32 32 32 31 32 32 32 32 38 34 32 set linesize 500 col day for a11 select to_char(begin_time,'DD-MON-YY') Day, round(max(decode(to_char(begin_time,'HH24'),'00',maxval,NULL)),2) "00", round(max(decode(to_char(begin_time,'HH24'),'01',maxval,NULL)),2) "01", round(max(decode(to_char(begin_time,'HH24'),'02',maxval,NULL)),2) "02", round(max(decode(to_char(begin_time,'HH24'),'03',maxval,NULL)),2) "03", round(max(decode(to_char(begin_time,'HH24'),'04',maxval,NULL)),2) "04", round(max(decode(to_char(begin_time,'HH24'),'05',maxval,NULL)),2) "05", round(max(decode(to_char(begin_time,'HH24'),'06',maxval,NULL)),2) "06", round(max(decode(to_char(begin_time,'HH24'),'07',maxval,NULL)),2) "07", round(max(decode(to_char(begin_time,'HH24'),'08',maxval,NULL)),2) "08", round(max(decode(to_char(begin_time,'HH24'),'09',maxval,NULL)),2) "09", round(max(decode(to_char(begin_time,'HH24'),'10',maxval,NULL)),2) "10", round(max(decode(to_char(begin_time,'HH24'),'11',maxval,NULL)),2) "11", round(max(decode(to_char(begin_time,'HH24'),'12',maxval,NULL)),2) "12", round(max(decode(to_char(begin_time,'HH24'),'13',maxval,NULL)),2) "13", round(max(decode(to_char(begin_time,'HH24'),'14',maxval,NULL)),2) "14", round(max(decode(to_char(begin_time,'HH24'),'15',maxval,NULL)),2) "15", round(max(decode(to_char(begin_time,'HH24'),'16',maxval,NULL)),2) "16", round(max(decode(to_char(begin_time,'HH24'),'17',maxval,NULL)),2) "17", round(max(decode(to_char(begin_time,'HH24'),'18',maxval,NULL)),2) "18", round(max(decode(to_char(begin_time,'HH24'),'19',maxval,NULL)),2) "19", round(max(decode(to_char(begin_time,'HH24'),'20',maxval,NULL)),2) "20", round(max(decode(to_char(begin_time,'HH24'),'21',maxval,NULL)),2) "21", round(max(decode(to_char(begin_time,'HH24'),'21',maxval,NULL)),2) "22", round(max(decode(to_char(begin_time,'HH24'),'21',maxval,NULL)),2) "23" from dba_hist_sysmetric_SUMMARY A where BEGIN_TIME > sysdate - 7 and A.METRIC_NAME in('Average Active Sessions') group by to_char(begin_time,'DD-MON-YY') / set lines 500 pages 50000 alter session set nls_date_format='dd-mm-yyyy hh24:mi'; col Phys_Read_Total_Bps for 999999999999 col Phys_Write_Total_Bps for 999999999999 col Redo_Bytes_per_sec for 999999999999 col Phys_Read_IOPS for 999999999999 col Phys_write_IOPS for 999999999999 col Phys_redo_IOPS for 999999999999 col OS_LOad for 999999999999 col DB_CPU_Usage_per_sec for 999999999999 col Host_CPU_util for 999999999999 col Network_bytes_per_sec for 999999999999 col Phys_IO_Tot_MBps for 999999999999 col Phys_IOPS_Tot for 999999999999 spool io_max_checkup.log select min(begin_time), max(end_time), sum(case metric_name when 'Physical Read Total Bytes Per Sec' then maxval end) Phys_Read_Tot_Bps, sum(case metric_name when 'Physical Write Total Bytes Per Sec' then maxval end) Phys_Write_Tot_Bps, sum(case metric_name when 'Redo Generated Per Sec' then maxval end) Redo_Bytes_per_sec, sum(case metric_name when 'Physical Read Total IO Requests Per Sec' then maxval end) Phys_Read_IOPS, sum(case metric_name when 'Physical Write Total IO Requests Per Sec' then maxval end) Phys_write_IOPS, sum(case metric_name when 'Redo Writes Per Sec' then maxval end) Phys_redo_IOPS, sum(case metric_name when 'Current OS Load' then maxval end) OS_LOad, sum(case metric_name when 'CPU Usage Per Sec' then maxval end) DB_CPU_Usage_per_sec, sum(case metric_name when 'Host CPU Utilization (%)' then maxval end) Host_CPU_util, --NOTE 100% = 1 loaded RAC node sum(case metric_name when 'Network Traffic Volume Per Sec' then maxval end) Network_bytes_per_sec, snap_id from dba_hist_sysmetric_summary group by snap_id order by snap_id; select min(begin_time), max(end_time), sum(case metric_name when 'Physical Read Total Bytes Per Sec' then maxval end)/1024/1024 + sum(case metric_name when 'Physical Write Total Bytes Per Sec' then maxval end)/1024/1024 + sum(case metric_name when 'Redo Generated Per Sec' then maxval end)/1024/1024 Phys_IO_Tot_MBps, sum(case metric_name when 'Physical Read Total IO Requests Per Sec' then maxval end) + sum(case metric_name when 'Physical Write Total IO Requests Per Sec' then maxval end) + sum(case metric_name when 'Redo Writes Per Sec' then maxval end) Phys_IOPS_Tot, sum(case metric_name when 'Current OS Load' then maxval end) OS_LOad, sum(case metric_name when 'CPU Usage Per Sec' then maxval end) DB_CPU_Usage_per_sec, sum(case metric_name when 'Host CPU Utilization (%)' then maxval end) Host_CPU_util, --NOTE 100% = 1 loaded RAC node sum(case metric_name when 'Network Traffic Volume Per Sec' then maxval end) Network_bytes_per_sec, snap_id from dba_hist_sysmetric_summary group by snap_id order by snap_id; spool off spool io_maxtot_summary.log
Saturday, 24 July 2010
Primary key validation for new rows only ......
Anuj:orcl>create table test ( a number );
Table created.
Anuj:orcl>insert into test ( a ) values ( 1 ) ;
1 row created.
Anuj:orcl>/
1 row created.
Anuj:orcl>/
1 row created.
Anuj:orcl>insert into test ( a ) values (2 ) ;
1 row created.
Anuj:orcl>alter table test add constraint test_pk primary key ( a ) novalidate ;
alter table test add constraint test_pk primary key ( a ) novalidate
*
ERROR at line 1:
ORA-02437: cannot validate (SYS.test_PK) - primary key violated
Anuj:orcl>create index test_i on test ( a );
Index created.
Anuj:orcl>alter table test add constraint test_pk primary key ( a ) novalidate ;
Table altered.
Anuj:orcl>select * from test ;
A
----------
1
1
1
2
Anuj:orcl>insert into test ( a ) values (2 ) ;
insert into test ( a ) values (2 )
*
ERROR at line 1:
ORA-00001: unique constraint (SYS.test_PK) violated
Table created.
Anuj:orcl>insert into test ( a ) values ( 1 ) ;
1 row created.
Anuj:orcl>/
1 row created.
Anuj:orcl>/
1 row created.
Anuj:orcl>insert into test ( a ) values (2 ) ;
1 row created.
Anuj:orcl>alter table test add constraint test_pk primary key ( a ) novalidate ;
alter table test add constraint test_pk primary key ( a ) novalidate
*
ERROR at line 1:
ORA-02437: cannot validate (SYS.test_PK) - primary key violated
Anuj:orcl>create index test_i on test ( a );
Index created.
Anuj:orcl>alter table test add constraint test_pk primary key ( a ) novalidate ;
Table altered.
Anuj:orcl>select * from test ;
A
----------
1
1
1
2
Anuj:orcl>insert into test ( a ) values (2 ) ;
insert into test ( a ) values (2 )
*
ERROR at line 1:
ORA-00001: unique constraint (SYS.test_PK) violated
Friday, 16 July 2010
Oracle 10g when transactions will finish rolling back
select sum(distinct(ktuxesiz)) from x$ktuxe; value should be very less ....
@rollback_active.sql
set serveroutput on
set feedback off
prompt
prompt transactions that are rolling back ...
prompt
declare
cursor tx is
select
s.username,
t.xidusn,
t.xidslot,
t.xidsqn,
x.ktuxesiz
from
sys.x$ktuxe x,
sys.v_$transaction t,
sys.v_$session s
where
x.inst_id = userenv('Instance') and
x.ktuxesta = 'ACTIVE' and
x.ktuxesiz > 1 and
t.xidusn = x.ktuxeusn and
t.xidslot = x.ktuxeslt and
t.xidsqn = x.ktuxesqn and
s.saddr = t.ses_addr;
user_name varchar2(30);
xid_usn number;
xid_slot number;
xid_sqn number;
used_ublk1 number;
used_ublk2 number;
begin
open tx;
loop
fetch tx into user_name, xid_usn, xid_slot, xid_sqn, used_ublk1;
exit when tx%notfound;
if tx%rowcount = 1
then
sys.dbms_lock.sleep(10);
end if;
select
sum(ktuxesiz)
into
used_ublk2
from
sys.x$ktuxe
where
inst_id = userenv('Instance') and
ktuxeusn = xid_usn and
ktuxeslt = xid_slot and
ktuxesqn = xid_sqn and
ktuxesta = 'ACTIVE';
if used_ublk2 < used_ublk1
then
sys.dbms_output.put_line(
user_name ||
'''s transaction ' ||
xid_usn || '.' ||
xid_slot || '.' ||
xid_sqn ||
' will finish rolling back at approximately ' ||
to_char(
sysdate + used_ublk2 / (used_ublk1 - used_ublk2) / 6 / 60 / 24,
'HH24:MI:SS DD-MON-YYYY'
)
);
end if;
end loop;
if user_name is null
then
sys.dbms_output.put_line('No transactions appear to be rolling back.');
end if;
end;
/
@rollback_active.sql
set serveroutput on
set feedback off
prompt
prompt transactions that are rolling back ...
prompt
declare
cursor tx is
select
s.username,
t.xidusn,
t.xidslot,
t.xidsqn,
x.ktuxesiz
from
sys.x$ktuxe x,
sys.v_$transaction t,
sys.v_$session s
where
x.inst_id = userenv('Instance') and
x.ktuxesta = 'ACTIVE' and
x.ktuxesiz > 1 and
t.xidusn = x.ktuxeusn and
t.xidslot = x.ktuxeslt and
t.xidsqn = x.ktuxesqn and
s.saddr = t.ses_addr;
user_name varchar2(30);
xid_usn number;
xid_slot number;
xid_sqn number;
used_ublk1 number;
used_ublk2 number;
begin
open tx;
loop
fetch tx into user_name, xid_usn, xid_slot, xid_sqn, used_ublk1;
exit when tx%notfound;
if tx%rowcount = 1
then
sys.dbms_lock.sleep(10);
end if;
select
sum(ktuxesiz)
into
used_ublk2
from
sys.x$ktuxe
where
inst_id = userenv('Instance') and
ktuxeusn = xid_usn and
ktuxeslt = xid_slot and
ktuxesqn = xid_sqn and
ktuxesta = 'ACTIVE';
if used_ublk2 < used_ublk1
then
sys.dbms_output.put_line(
user_name ||
'''s transaction ' ||
xid_usn || '.' ||
xid_slot || '.' ||
xid_sqn ||
' will finish rolling back at approximately ' ||
to_char(
sysdate + used_ublk2 / (used_ublk1 - used_ublk2) / 6 / 60 / 24,
'HH24:MI:SS DD-MON-YYYY'
)
);
end if;
end loop;
if user_name is null
then
sys.dbms_output.put_line('No transactions appear to be rolling back.');
end if;
end;
/
Monday, 5 July 2010
Size of oracle Control File
Size of control files
SYS@orcl> select sum((cffsz+1)*cfbsz)/1024/1024 "Control File Size(MB)" from x$kcccf;
Control File Size(MB)
---------------------
20.203125
SYS@orcl> select sum((cffsz+1)*cfbsz)/1024/1024 "Control File Size(MB)" from x$kcccf;
Control File Size(MB)
---------------------
20.203125
How to stop oracle Trace ?
Stop trace dump
1. Get the process number from trace file.
Example :
-rw-rw—- 1 dba 184034 Jan 29 17:02 test_diag_17701.trc
2. 18701 is the process number from trace file.
SQL> oradebug setospid 17701
Oracle pid: 3, Unix process pid: 17701,
SQL> oradebug close_trace;
Statement processed.
1. Get the process number from trace file.
Example :
-rw-rw—- 1 dba 184034 Jan 29 17:02 test_diag_17701.trc
2. 18701 is the process number from trace file.
SQL> oradebug setospid 17701
Oracle pid: 3, Unix process pid: 17701,
SQL> oradebug close_trace;
Statement processed.
Friday, 2 July 2010
Data pump status .... is job running ?
col JOB_NAME format a20
col OPERATION format a10
col JOB_MODE format a10
col STATE format a10
Select job_name, operation, job_mode, state from user_datapump_jobs where STATE!='NOT RUNNING'
SQL> r
1* Select job_name, operation, job_mode, state from user_datapump_jobs where STATE!='NOT RUNNING'
JOB_NAME OPERATION JOB_MODE STATE
-------------------- ---------- ---------- ----------
SYS_IMPORT_TABLE_08 IMPORT TABLE EXECUTING
set lines 200 pages 100 numwidth 7
col program for a38
col username for a10
col spid for a7
col date format a20
col job_name format a20
col status format a10
select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') "DATE", s.program, s.sid,
s.status, s.username, d.job_name, p.spid, s.serial#, p.pid
from v$session s, v$process p, dba_datapump_sessions d
where p.addr=s.paddr and s.saddr=d.saddr;
DATE PROGRAM SID STATUS USERNAME JOB_NAME SPID SERIAL# PID
-------------------- -------------------------------------- ------- ---------- ---------- -------------------- ------- ------- -------
2010-07-13 09:44:21 udi@ln-ora-01tst (TNS V1-V3) 143 INACTIVE SYS SYS_IMPORT_TABLE_13 14130 2 23
2010-07-13 09:44:21 oracle@ln-ora-01tst (DM00) 146 ACTIVE SYS SYS_IMPORT_TABLE_13 14132 60 24
2010-07-13 09:44:21 oracle@ln-ora-01tst (DW01) 140 ACTIVE SYS SYS_IMPORT_TABLE_13 14134 3 25
2010-07-13 09:44:21 oracle@ln-ora-01tst (DW02) 137 ACTIVE SYS SYS_IMPORT_TABLE_13 14136 2 26
-bash-3.00$ impdp "'/ as sysdba'" attach=SYS_IMPORT_TABLE_08
Import: Release 10.2.0.4.0 - 64bit Production on Friday, 02 July, 2010 14:58:09
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Job: SYS_IMPORT_TABLE_08
Owner: SYS
Operation: IMPORT
Creator Privs: TRUE
GUID: 8A5433675F594D74E0440003BA0AE183
Start Time: Thursday, 01 July, 2010 14:10:58
Mode: TABLE
Instance: ccdb
Max Parallelism: 1
EXPORT Job Parameters:
CLIENT_COMMAND '/******** AS SYSDBA' directory=datapump1 DUMPFILE=pumpuat_1405.dmp SCHEMAS=(PROD1,UAT2,ESEARCH)
IMPORT Job Parameters:
Parameter Name Parameter Value:
CLIENT_COMMAND '/******** AS SYSDBA' DIRECTORY=dir DUMPFILE=pumpuat_1405.dmp REMAP_SCHEMA=prod1:test TABLES=user_sites LOGFILE=user_sites01july.log TABLE_EXISTS_ACTION=APPEND
TABLE_EXISTS_ACTION APPEND
State: EXECUTING
Bytes Processed: 0
Current Parallelism: 1
Job Error Count: 0
Dump File: /opt/oracle/backup/pumpuat_1405.dmp
Worker 1 Status:
State: EXECUTING
Object Schema: TEST
Object Name: USER_SITES
Object Type: SCHEMA_EXPORT/TABLE/TABLE_DATA
Completed Objects: 1
Completed Rows: 239,889,948
Completed Bytes: 10,016,441,128
Percent Done: 100
Worker Parallelism: 1
col OPERATION format a10
col JOB_MODE format a10
col STATE format a10
Select job_name, operation, job_mode, state from user_datapump_jobs where STATE!='NOT RUNNING'
SQL> r
1* Select job_name, operation, job_mode, state from user_datapump_jobs where STATE!='NOT RUNNING'
JOB_NAME OPERATION JOB_MODE STATE
-------------------- ---------- ---------- ----------
SYS_IMPORT_TABLE_08 IMPORT TABLE EXECUTING
set lines 200 pages 100 numwidth 7
col program for a38
col username for a10
col spid for a7
col date format a20
col job_name format a20
col status format a10
select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') "DATE", s.program, s.sid,
s.status, s.username, d.job_name, p.spid, s.serial#, p.pid
from v$session s, v$process p, dba_datapump_sessions d
where p.addr=s.paddr and s.saddr=d.saddr;
DATE PROGRAM SID STATUS USERNAME JOB_NAME SPID SERIAL# PID
-------------------- -------------------------------------- ------- ---------- ---------- -------------------- ------- ------- -------
2010-07-13 09:44:21 udi@ln-ora-01tst (TNS V1-V3) 143 INACTIVE SYS SYS_IMPORT_TABLE_13 14130 2 23
2010-07-13 09:44:21 oracle@ln-ora-01tst (DM00) 146 ACTIVE SYS SYS_IMPORT_TABLE_13 14132 60 24
2010-07-13 09:44:21 oracle@ln-ora-01tst (DW01) 140 ACTIVE SYS SYS_IMPORT_TABLE_13 14134 3 25
2010-07-13 09:44:21 oracle@ln-ora-01tst (DW02) 137 ACTIVE SYS SYS_IMPORT_TABLE_13 14136 2 26
-bash-3.00$ impdp "'/ as sysdba'" attach=SYS_IMPORT_TABLE_08
Import: Release 10.2.0.4.0 - 64bit Production on Friday, 02 July, 2010 14:58:09
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Job: SYS_IMPORT_TABLE_08
Owner: SYS
Operation: IMPORT
Creator Privs: TRUE
GUID: 8A5433675F594D74E0440003BA0AE183
Start Time: Thursday, 01 July, 2010 14:10:58
Mode: TABLE
Instance: ccdb
Max Parallelism: 1
EXPORT Job Parameters:
CLIENT_COMMAND '/******** AS SYSDBA' directory=datapump1 DUMPFILE=pumpuat_1405.dmp SCHEMAS=(PROD1,UAT2,ESEARCH)
IMPORT Job Parameters:
Parameter Name Parameter Value:
CLIENT_COMMAND '/******** AS SYSDBA' DIRECTORY=dir DUMPFILE=pumpuat_1405.dmp REMAP_SCHEMA=prod1:test TABLES=user_sites LOGFILE=user_sites01july.log TABLE_EXISTS_ACTION=APPEND
TABLE_EXISTS_ACTION APPEND
State: EXECUTING
Bytes Processed: 0
Current Parallelism: 1
Job Error Count: 0
Dump File: /opt/oracle/backup/pumpuat_1405.dmp
Worker 1 Status:
State: EXECUTING
Object Schema: TEST
Object Name: USER_SITES
Object Type: SCHEMA_EXPORT/TABLE/TABLE_DATA
Completed Objects: 1
Completed Rows: 239,889,948
Completed Bytes: 10,016,441,128
Percent Done: 100
Worker Parallelism: 1
Oracle 10g Datapump Session Wait Information
set lines 150 pages 100 numwidth 7
col program for a30
col username for a10
col spid for a7
col date for a20
col job_name for a20
col STATUS for a10
SQL> select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') "DATE", s.program, s.sid, s.serial#,
s.status, s.username, d.job_name, p.spid, p.pid
from v$session s, v$process p, dba_datapump_sessions d
where p.addr=s.paddr and s.saddr=d.saddr; 2 3 4
DATE PROGRAM SID SERIAL# STATUS USERNAME JOB_NAME SPID PID
-------------------- ------------------------------ ------- ------- ---------- ---------- -------------------- ------- -------
2010-07-02 10:24:39 oracle@xxx-cccora-01tst (DM00) 119 921 ACTIVE SYS SYS_IMPORT_TABLE_08 19832 40
2010-07-02 10:24:39 oracle@xxx-cccora-01tst (DW01) 124 4 ACTIVE SYS SYS_IMPORT_TABLE_08 19834 44
-- In SQL*Plus, activate SQL tracing with DBMS_SYSTEM and SID/SERIAL#
-- Syntax: DBMS_SYSTEM.SET_EV([SID],[SERIAL#],[EVENT],[LEVEL],'')
-- Example to SQL_TRACE Worker process with level 4 (Bind values):
execute sys.dbms_system.set_ev(119,921,10046,4,'');
-- and stop tracing:
execute sys.dbms_system.set_ev(119,921,10046,0,'');
-- Example to SQL_TRACE Master Control process with level 8 (Waits):
execute sys.dbms_system.set_ev(119,921,10046,8,'');
-- and stop tracing:
execute sys.dbms_system.set_ev(119,921,10046,0,'');
SQL> execute sys.dbms_system.set_ev(119,921,10046,12,'');
PL/SQL procedure successfully completed.
SQL> execute sys.dbms_system.set_ev(124,4,10046,12,'');
PL/SQL procedure successfully completed.
-- Activate SQL tracing database wide,
-- Be careful: all processes will be traced !
CONNECT / as sysdba
ALTER SYSTEM SET EVENTS '10046 trace name context forever, level 12';
- Start the Import/export Data Pump or Import Data Pump job, e.g.:
impdp system/XXXX DIRECTORY=dir DUMPFILE=pumpuat_1405.dmp REMAP_SCHEMA=scott:test TABLES=user_site LOGFILE=user_site.log
-- Unset event immediately after Data Pump job ends:
ALTER SYSTEM SET EVENTS '10046 trace name context off';
To Check session trace is on ?
SQL> select sid,serial#,SQL_TRACE,SQL_TRACE_WAITS,SQL_TRACE_BINDS from v$session;
SID SERIAL# SQL_TRACE SQL_TRACE_WAITS SQL_TRACE_BINDS
------- ------- ------------------------ --------------- ---------------
119 921 ENABLED TRUE TRUE <<<<<<<<---------
124 4 ENABLED TRUE TRUE <<<<<<<<---------
127 218 DISABLED FALSE FALSE
134 636 DISABLED FALSE FALSE
140 199 DISABLED FALSE FALSE
147 4 DISABLED FALSE FALSE
col program for a30
col username for a10
col spid for a7
col date for a20
col job_name for a20
col STATUS for a10
SQL> select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') "DATE", s.program, s.sid, s.serial#,
s.status, s.username, d.job_name, p.spid, p.pid
from v$session s, v$process p, dba_datapump_sessions d
where p.addr=s.paddr and s.saddr=d.saddr; 2 3 4
DATE PROGRAM SID SERIAL# STATUS USERNAME JOB_NAME SPID PID
-------------------- ------------------------------ ------- ------- ---------- ---------- -------------------- ------- -------
2010-07-02 10:24:39 oracle@xxx-cccora-01tst (DM00) 119 921 ACTIVE SYS SYS_IMPORT_TABLE_08 19832 40
2010-07-02 10:24:39 oracle@xxx-cccora-01tst (DW01) 124 4 ACTIVE SYS SYS_IMPORT_TABLE_08 19834 44
-- In SQL*Plus, activate SQL tracing with DBMS_SYSTEM and SID/SERIAL#
-- Syntax: DBMS_SYSTEM.SET_EV([SID],[SERIAL#],[EVENT],[LEVEL],'')
-- Example to SQL_TRACE Worker process with level 4 (Bind values):
execute sys.dbms_system.set_ev(119,921,10046,4,'');
-- and stop tracing:
execute sys.dbms_system.set_ev(119,921,10046,0,'');
-- Example to SQL_TRACE Master Control process with level 8 (Waits):
execute sys.dbms_system.set_ev(119,921,10046,8,'');
-- and stop tracing:
execute sys.dbms_system.set_ev(119,921,10046,0,'');
SQL> execute sys.dbms_system.set_ev(119,921,10046,12,'');
PL/SQL procedure successfully completed.
SQL> execute sys.dbms_system.set_ev(124,4,10046,12,'');
PL/SQL procedure successfully completed.
-- Activate SQL tracing database wide,
-- Be careful: all processes will be traced !
CONNECT / as sysdba
ALTER SYSTEM SET EVENTS '10046 trace name context forever, level 12';
- Start the Import/export Data Pump or Import Data Pump job, e.g.:
impdp system/XXXX DIRECTORY=dir DUMPFILE=pumpuat_1405.dmp REMAP_SCHEMA=scott:test TABLES=user_site LOGFILE=user_site.log
-- Unset event immediately after Data Pump job ends:
ALTER SYSTEM SET EVENTS '10046 trace name context off';
To Check session trace is on ?
SQL> select sid,serial#,SQL_TRACE,SQL_TRACE_WAITS,SQL_TRACE_BINDS from v$session;
SID SERIAL# SQL_TRACE SQL_TRACE_WAITS SQL_TRACE_BINDS
------- ------- ------------------------ --------------- ---------------
119 921 ENABLED TRUE TRUE <<<<<<<<---------
124 4 ENABLED TRUE TRUE <<<<<<<<---------
127 218 DISABLED FALSE FALSE
134 636 DISABLED FALSE FALSE
140 199 DISABLED FALSE FALSE
147 4 DISABLED FALSE FALSE
Subscribe to:
Posts (Atom)
Oracle DBA
anuj blog Archive
- ► 2011 (362)