Tuesday, July 12, 2016

Fedora: Enable Root Login with Display Manager

Reference: http://www.tuxmachines.org/node/78008

If it is sddm, then edit /etc/sddm.conf and add MinimumUid=0.
If it is kdm, then edit /usr/share/config/kdm/kdmrc and change
AllowRootLogin=false to AllowRootLogin=true.
The location of those two files may be different on your computer. Typing 'locate kdmrc' or 'locate sddm.conf' may help.
If you can't find sddm.conf, you may need to create one (touch /etc/sddm.conf).
kdmrc should be installed by default.

Friday, June 24, 2016

Oracle: Resize Datafiles

with query as (
    select /*+ NO_MERGE MATERIALIZE */
        file_id,
        tablespace_name,
        max(block_id + blocks) highblock
    from
        dba_extents
    group by
        file_id, tablespace_name
)
select
    'alter database datafile '|| q.file_id || ' resize ' || ceil ((q.highblock * t.block_size + t.block_size)/1024)  || 'K;' cmd
from
    query q,
    dba_tablespaces t
where
    q.tablespace_name = t.tablespace_name;

Oracle: Query Long Run Session


  select
     opname, to_char(start_time, 'yyyy-mm-dd-hh24:mi:ss'),  target,  sofar, totalwork, units, elapsed_seconds, message
  from v$session_longops
  order by start_time desc;


select
   substr(a.spid,1,9) pid,
   substr(b.sid,1,5) sid,
   substr(b.serial#,1,5) ser#,
   substr(b.machine,1,6) box,
   substr(b.username,1,10) username,
   -- b.server,
   substr(b.osuser,1,8) os_user,
   substr(b.program,1,30) program
from
   v$session b,
   v$process a
where
b.paddr = a.addr
and type='USER'
order by spid;


 SELECT DISTINCT *
FROM
  (SELECT to_date(t.START_DATE,'DD.MM.YYYY HH24:MI:SS') Started_Date ,
    s.sid,
    s.username,
    t.status tr_status,
    s.status sess_status,
    NVL(s.program,s.module) Program,
    sq.sql_text
  FROM v$transaction t,
    v$session s,
    v$sql sq
  WHERE t.addr      = s.taddr
  AND s.sql_address = sq.address(+)
  AND t.start_date  < (sysdate-4/24)
  ORDER BY 1
  );