Tuesday, April 8, 2014

SQL to list useful information from from the database history file using SYSPROC.ADMIN_LIST_HIST table function

"SELECT 
  SUBSTR(FIRSTLOG,1,20) AS FIRSTLOG
 ,SUBSTR(LASTLOG,1,20) AS LASTLOG
 ,SUBSTR(TABSCHEMA,1,8) as TABSCHEMA
 ,SUBSTR(TABNAME,1,15) as TABNAME
 ,CASE OPERATION
                WHEN 'A' THEN 'Create table space'
                WHEN 'B' THEN 'Backup'
                WHEN 'C' THEN 'Load copy'
                WHEN 'D' THEN 'Dropped table'
                WHEN 'F' THEN 'Roll forward'
                WHEN 'G' THEN 'Reorganize table'
                WHEN 'L' THEN 'Load'
                WHEN 'N' THEN 'Rename table space'
                WHEN 'O' THEN 'Drop table space'
                WHEN 'Q' THEN 'Quiesce'
                WHEN 'R' THEN 'Restore'
                WHEN 'T' THEN 'Alter table space'
                WHEN 'U' THEN 'Unload'
                WHEN 'X' THEN 'Archive log'
   END AS OPERATION
  ,CASE 
                WHEN OPERATION ='X' AND OPERATIONTYPE = 'P' THEN 'Primary log path'
                WHEN OPERATION ='X' AND OPERATIONTYPE = 'M' THEN 'Secondary (mirror) log path'
                WHEN OPERATION ='X' AND OPERATIONTYPE = 'F' THEN 'Failover archive path'
                WHEN OPERATION ='X' AND OPERATIONTYPE = '1' THEN 'Primary log archive method'
                WHEN OPERATION ='X' AND OPERATIONTYPE = '2' THEN 'Secondary log archive method'
                WHEN OPERATION ='B' AND OPERATIONTYPE = 'F' THEN 'Offline'
                WHEN OPERATION ='B' AND OPERATIONTYPE = 'N' THEN 'Online'
                WHEN OPERATION ='B' AND OPERATIONTYPE = 'I' THEN 'Incremental offline'
                WHEN OPERATION ='B' AND OPERATIONTYPE = 'O' THEN 'Incremental online'
                WHEN OPERATION ='B' AND OPERATIONTYPE = 'D' THEN 'Delta offline'
                WHEN OPERATION ='B' AND OPERATIONTYPE = 'E' THEN 'Delta online'
                WHEN OPERATION ='F' AND OPERATIONTYPE = 'E' THEN 'End of logs'
                WHEN OPERATION ='F' AND OPERATIONTYPE = 'P' THEN 'Point in time'
                WHEN OPERATION ='L' AND OPERATIONTYPE = 'I' THEN 'Insert'
                WHEN OPERATION ='L' AND OPERATIONTYPE = 'R' THEN 'Replace'
                WHEN OPERATION ='T' AND OPERATIONTYPE = 'C' THEN 'Add containers'
                WHEN OPERATION ='T' AND OPERATIONTYPE = 'R' THEN 'Rebalance'
                WHEN OPERATION ='Q' AND OPERATIONTYPE = 'S' THEN 'Quiesce share'
                WHEN OPERATION ='Q' AND OPERATIONTYPE = 'U' THEN 'Quiesce update'
                WHEN OPERATION ='Q' AND OPERATIONTYPE = 'X' THEN 'Quiesce exclusive'
                WHEN OPERATION ='Q' AND OPERATIONTYPE = 'Z' THEN 'Quiesce reset'
   END AS OPERATIONTYPE
 ,START_TIME
 ,END_TIME
 ,SQLCODE
FROM TABLE(SYSPROC.ADMIN_LIST_HIST()) AS LISTHISTORY
"


1 Comments:

At March 4, 2022 at 7:44 AM , Blogger zarryquave said...

Casinosto Slots Casino: 50% Up To 100 FS - Dr.D.MCD
Casinosto Slots Casino offers a unique gameplay 진주 출장샵 experience, 밀양 출장샵 and 논산 출장마사지 it's not just a 경상남도 출장마사지 new game. As you've likely 강원도 출장마사지 already guessed, Casinosto is a provider of online

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home