Thursday 6 December 2018

Linux: how to open a tar file remotely, directly, using ssh

Sometimes we need to open a tar file on a server, but we don't have enough space for the tar file.
Solution: open the file directly on the target server:

host1!oracle:
 $ cat Sanity.tar | ssh oracle@host2 "(cd /u01/app/oracle/users/Florin/; tar xf -)"

Wednesday 5 December 2018

How to find the top queries TEMP space consumers, historical data?

The query below identifies the queries which used more then 5 GB of temp space, during the last 2 days:

select sql_id,max(TEMP_SPACE_ALLOCATED)/(1024*1024*1024) gig
from DBA_HIST_ACTIVE_SESS_HISTORY
where
sample_time > sysdate-2 and
TEMP_SPACE_ALLOCATED > (5*1024*1024*1024)
group by sql_id order by 2
/