This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest' | |
module OracleStmtUtils | |
def stmt_to_sqlid(stmt) | |
d1, d2, msb, lsb = Digest::MD5.digest(stmt + "\x00").unpack('IIII') | |
sqln = msb * (2 ** 32) + lsb | |
stop = Math.log(sqln, Math::E) / Math.log(32, Math::E) + 1 | |
sqlid = String.new | |
alphabet = '0123456789abcdfghjkmnpqrstuvwxyz' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
# that enables you to choose a character from a menu of options. If you are on Lion | |
# try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
# for input. | |
# | |
# It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
# as it means you cannot press and hold h/j/k/l to move through your file. You have | |
# to repeatedly press the keys to navigate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g prefix C-a | |
set -sg escape-time 1 | |
set -sg base-index 1 | |
setw -g pane-base-index 1 | |
setw -g mode-keys vi | |
set -g mouse on | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# ----------------------------------------------------------------------------- | |
# Rails Development Vagrantfile | |
# ----------------------------------------------------------------------------- | |
# | |
# Server Info: | |
# | |
# Ubuntu 12.04 32-bit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
holders.*, | |
' IS BLOCKING ' is_blocking, | |
waiters.* | |
from | |
( | |
select | |
dw.holding_session, | |
hs.username, | |
do.object_name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
'alter table ' || table_name || ' modify ( ' || column_name || ' varchar(' || char_length || ' char) );' | |
from | |
user_tab_columns | |
where | |
data_type = 'VARCHAR2' | |
and | |
char_used = 'B' | |
order by | |
table_name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alter table [tableName] compress for oltp; | |
alter table [tableName] move; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTE: | |
Oracle9i: estimate_percent defaults to NULL which is COMPUTE | |
Oracle10g: estimate_percent defaults to to_estimate_percent_type (get_param('ESTIMATE_PERCENT')) | |
-- ******************************** | |
-- * Generating Schema Statistics * | |
-- ******************************** | |
execute dbms_stats.gather_schema_stats(ownname=>'SCHEMAOWNER',estimate_percent=>NULL,cascade=>TRUE,degree=>dbms_stats.default_degree) | |
execute dbms_stats.gather_schema_stats(ownname=>'SCHEMAOWNER',estimate_percent=>NULL,cascade=>TRUE,degree=>dbms_stats.default_degree,method_opt=>'FOR ALL INDEXED COLUMNS SIZE AUTO') | |
execute dbms_stats.gather_schema_stats(ownname=>'SCHEMAOWNER',estimate_percent=>NULL,cascade=>TRUE,degree=>dbms_stats.default_degree,method_opt=>'FOR ALL INDEXED COLUMNS SIZE 1') -- No Histograms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ROW MOVEMENT is required to move rows. | |
-- SHRINK SPACE COMPACT moves the rows without resetting the high water mark. | |
-- SHRINK SPACE moves the rows and resets the high water mark which temporarily locks the table. | |
-- May need to rebuild the indexes after a shrink. | |
alter table [tableName] enable row movement; | |
alter table [tableName] shrink space compact; | |
alter table [tableName] shrink space; | |
alter index [indexName] shrink space compact; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace trigger [SCHEMA_NAME]_startsqltracing after logon on [SCHEMA_NAME].schema | |
begin | |
execute immediate 'alter session set timed_statistics=true'; | |
execute immediate 'alter session set max_dump_file_size=unlimited'; | |
execute immediate 'alter session set events ''10046 trace name context forever, level 12'''; | |
end; | |
/ | |
create or replace trigger [SCHEMA_NAME]_endsqltracing before logoff on [SCHEMA_NAME].schema |