Skip to content

Instantly share code, notes, and snippets.

@RichVRed
RichVRed / ideal ops.md
Created May 18, 2017 01:03 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

Meta-Information =============================================================
Site Name:
Site URL:
Client:
Client Point of Contact:
Client Services Point of Contact:
Design Phase =================================================================
#!/bin/sh
sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
@RichVRed
RichVRed / GenerateUnusableIndexRebuildStmts.sql
Created April 28, 2017 23:56 — forked from ryanthames/GenerateUnusableIndexRebuildStmts.sql
Finding and generating rebuild index SQL statements for unusable indexes in Oracle.
select 'alter index '||OWNER||'.'||INDEX_NAME||' rebuild online;'
from DBA_INDEXES
WHERE STATUS = 'UNUSABLE';
@RichVRed
RichVRed / connections_per_machine.sql
Created April 28, 2017 23:56 — forked from ryanthames/connections_per_machine.sql
Find out who's hogging all the connections in Oracle
select machine, count(*)
from v$session
group by machine
order by 2 desc;
select username, osuser, program, module,
machine, terminal, process,
to_char(logon_time, 'YYYY-MM-DD HH24:MI:SS') as logon_time,
status,
case status
when 'ACTIVE' then null
else last_call_et
end as idle_time
from v$session
where type = 'USER';
select username, osuser, program, module,
machine, process,
count(1) as login_count
from v$session
where type = 'USER'
group by username, osuser, program, module,
machine, process;
select s.sid, s.username, s.osuser,
to_char(sm.begin_time, 'HH24:MI:ss') as interval_start,
to_char(sm.end_time, 'HH24:MI:ss') as interval_end,
s.machine, s.process, s.program, s.module,
sm.cpu, sm.pga_memory, sm.logical_reads, sm.physical_reads,
sm.hard_parses, sm.soft_parses,
s.logon_time
from v$session s, v$sessmetric sm
where sm.session_id = s.sid
and s.type = 'USER'
select s.sid, s.username, s.osuser,
s.machine, s.process, s.program, s.module,
q.sql_text, q.optimizer_cost,
s.blocking_session, bs.username as blocking_user,
bs.machine as blocking_machine, bs.module as blocking_module,
bq.sql_text as blocking_sql, s.event as wait_event,
q.sql_fulltext
from v$session s, v$sql q, v$session bs, v$sql bq
where s.sql_id = q.sql_id
and s.blocking_session = bs.sid(+)
select * from
(
select sql_id, sql_text, executions,
elapsed_time, cpu_time, buffer_gets, disk_reads,
elapsed_time / executions as avg_elapsed_time,
cpu_time / executions as avg_cpu_time,
buffer_gets / executions as avg_buffer_gets,
disk_reads / executions as avg_disk_reads
from v$sqlstats