Skip to content

Instantly share code, notes, and snippets.

@kshimi
kshimi / settings.json
Created July 4, 2020 13:37
Windows Terminal settings
// This file was initially generated by Windows Terminal 1.0.1401.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@kshimi
kshimi / noto.css
Created December 26, 2019 01:09
Noto font against Meiryo on Chrome stylish
@font-face {
font-family: 'meiryo';
src: local('Noto sans CJK JP Regular');
}
@font-face {
font-family: 'メイリオ';
src: local('Noto sans CJK JP Regular');
}
@kshimi
kshimi / iceberg.json
Created September 6, 2019 09:17
Iceberg color scheme for Windows Terminal
{
"name": "Iceberg",
"foreground": "#c6c8d1",
"background": "#161821",
"black": "#161821",
"red": "#e27878",
"green": "#b4be82",
"yellow": "#e2a478",
"blue": "#84a0c6",
"purple": "#a093c7",
@kshimi
kshimi / oradefaultsetting.sql
Created March 14, 2019 10:03
Oracle release 11g strict default constraint
-- 監査取得設定確認
select USER_NAME,PRIVILEGE,SUCCESS,FAILURE from DBA_PRIV_AUDIT_OPTS
   order by PRIVILEGE;
select USER_NAME,AUDIT_OPTION,SUCCESS,FAILURE from DBA_STMT_AUDIT_OPTS
   order by AUDIT_OPTION;
-- 監査OFF設定
@rdbms\admin\undoaud.sql
-- Defaultプロファイル制限確認
@kshimi
kshimi / check_lock.sql
Created March 14, 2019 10:01
Oracle check lock status
select
l.type
,ltype.Name
,ltype.description
,decode(l.lmode,
1, 'Null',
2, '行共有(SS)',
3, '行排他(SX)',
4, '共有(S)',
5, '共有/行排他(SSX)',
@kshimi
kshimi / check_heavy_query.sql
Created March 14, 2019 10:00
Oracle check heavy query
select --*
sql_text,
sql_id,
sharable_mem,
fetches, executions,
first_load_time, last_load_time, last_active_time,
disk_reads,
cpu_time, elapsed_time
plsql_exec_time, rows_processed,
parsing_schema_name,
@kshimi
kshimi / check_fragmentation.sql
Created March 14, 2019 09:59
SQLServer check fragmentation
-- Find the average fragmentation percentage of all indexes
-- in the HumanResources.Employee table.
SELECT
 i.index_id, name
 , s.avg_fragmentation_in_percent
 , s.avg_fragment_size_in_pages
 , s.fragment_count, s.page_count
FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, NULL) AS s
JOIN sys.indexes AS i ON a.object_id = b.object_id AND a.index_id = b.index_id
where s.avg_fragmentation_in_percent > 30
@kshimi
kshimi / rebuild_index.sql
Created March 14, 2019 09:57
SQLServer rebuild index
DECLARE @SchemaName sysname, @TableName sysname, @IndexName sysname
DECLARE @basesql nvarchar(max), @sql nvarchar(max)
SET @basesql = 'ALTER INDEX @1 On @2 REBUILD WITH ( FILLFACTOR = 50 ) '
DECLARE IXC CURSOR FOR
SELECT
OBJECT_SCHEMA_NAME(i.object_id) As SchemaName
, OBJECT_NAME(i.object_id) AS TableName
, i.name AS IndexName
@kshimi
kshimi / column_comment.sql
Created March 14, 2019 09:56
SQLServer get column comment
--カラムの説明
SELECT
t.name AS 'TableName',
c.name AS 'ColumnName',
ep.name AS 'PropertyName',
ep.value AS 'PropertyValue'
FROM
sys.tables t
INNER JOIN
sys.columns c
@kshimi
kshimi / check_lock.sql
Created March 14, 2019 09:55
SQLServer check lock status
SELECT
resource_type AS type
,resource_associated_entity_id as entity_id
,( CASE WHEN resource_type = 'OBJECT' THEN
OBJECT_NAME( resource_associated_entity_id )
ELSE
( SELECT
OBJECT_NAME( OBJECT_ID )
FROM
sys.partitions