--检查数据库的等待事件 from v$session_waitwhere event not like 'SQL%' and event not like 'rdbms%' --找出系统中耗时的操作select b.username username,a.disk_reads reads, a.executions exec,a.disk_reads/decode(a.executions,0,1,a.executions) rds_exec_ratio, …
DB2最佳分页语句 SELECT * FROM ( SELECT inner2_.*, ROWNUMBER() OVER(ORDER BY ORDER OF inner2_) AS rownumber_ FROM ( ROWS ONLY) AS inner2_ ) AS inner1_ ORDER BY rownumber_ DB2简单离线备份命令 db2 backup db learning to e: 备份成功.此备份映像的时间戳记是: db2 restore db learning fro…
连续最大: SELECT M.* FROM #temp MINNER JOIN (SELECT ISNULL(A.score,0)-b.score AS score,B.id FROM #temp AS BLEFT JOIN #temp A ON A.id=B.id+1 ) N ON M.id=N.id WHERE n.score<0 如果ID不连续,用rownum代替…
原文:SQL Server修改标识列方法(备忘) SQL Server修改标识列方法 ----允许对系统表进行更新 exec sp_configure 'allow updates',1 reconfigure with override GO ----取消标识列标记 update syscolumns set colstat = 0 where id = object_id('tablename') and colstat = 1 GO --插入id=8001-8003的行 ... ----恢…