Skip to content

Windows – set Affinity of a process

Set the affinity of a process to allocate it to one or more CPUs – for a process taking too much cpu. Obviously, you need to know something about the process concerned. This is more… 

Oracle – Table Import Progress

select substr(sql_text,instr(sql_text,’INTO “‘),30) table_name, rows_processed, round((sysdate-to_date(first_load_time,’yyyy-mm-dd hh24:mi:ss’))*24*60,1) minutes, trunc(rows_processed/((sysdate-to_date(first_load_time,’yyyy-mm-dd hh24:mi:ss’))*24*60)) rows_per_min from sys.v_$sqlarea where sql_text like ‘INSERT %INTO “%’ and command_type = 2 and open_versions > 0;select substr(sql_text,instr(sql_text,’INTO “‘),30) table_name, rows_processed, round((sysdate-to_date(first_load_time,’yyyy-mm-dd hh24:mi:ss’))*24*60,1) minutes, trunc(rows_processed/((sysdate-to_date(first_load_time,’yyyy-mm-dd… 

SQL Server – Identifying Locking

— Locking select cmd,* from sys.sysprocesses where blocked > 0 SELECT command, s.text, start_time, percent_complete, CAST(((DATEDIFF(s,start_time,GetDate()))/3600) as varchar) + ‘ hour(s), ‘ + CAST((DATEDIFF(s,start_time,GetDate())%3600)/60 as varchar) + ‘min, ‘ + CAST((DATEDIFF(s,start_time,GetDate())%60) as varchar) + ‘… 

SQL Server – subtotals in rows

How to add a subtotal row in sql This comes from: http://stackoverflow.com/questions/19387650/how-to-add-a-subtotal-row-in-sql Name Score A 2 B 3 A 1 B 3 Name Score A 2 A 1 Subtotal 3 B 3 B 3 Subtotal… 

Oracle v$sqlarea

select substr(sql_text, 1, 100), PHYSICAL_READ_REQUESTS, PHYSICAL_READ_BYTES, executions, last_load_time from v$sqlarea order by last_load_time desc

SQL Server – Query all Databases

exec sp_msforeachdb ‘use [?]; SELECT ”?”, MAX(TotalSpaceMB) as MaxObjSizeMB FROM ( SELECT t.NAME AS TableName, i.name as indexName, (sum(a.total_pages) * 8) / 1024 as TotalSpaceMB FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID =…