View Row level auditing.sql
-- | |
-- I was asked how to incorporate row level auditing detail into tables. | |
-- While Temporal tables with Generated columns is a powerful combination, | |
-- the following example demonstrates a different approach. | |
-- | |
-- One fun aspect about the solution is the use of INCLUDE SQL on the triggers... | |
-- | |
-------------------------------------------------------------------------------------------------- | |
-------------------------------------------------------------------------------------------------- |
View Protect the IFS root for *PUBLIC
-- | |
-- When an IFS directory includes W (write), you are exposed to malware attacks | |
-- Use this to review and overcome this topic for the all important ROOT directory | |
-- | |
-- For help on this or related security topics, contact Robert and team... | |
-- http://ibm.biz/IBMiSecurity | |
-- Robert Andrews - robert.andrews@us.ibm.com | |
-- | |
stop; |
View Gist look at the library list
-- | |
-- Use NAMING(*SYS) - system naming mode to leverage the power of the library list | |
-- | |
cl: crtlib lib1; | |
cl: crtlib lib3; | |
cl: crtlib lib2; | |
cl:CRTDUPOBJ OBJ(QSQPTABL) FROMLIB(QSYS2) OBJTYPE(*FILE) TOLIB(LIB1) DATA(*YES); | |
cl:CRTDUPOBJ OBJ(QSQPTABL) FROMLIB(QSYS2) OBJTYPE(*FILE) TOLIB(LIB2) DATA(*YES); | |
cl:CRTDUPOBJ OBJ(QSQPTABL) FROMLIB(QSYS2) OBJTYPE(*FILE) TOLIB(LIB3) DATA(*YES); | |
cl: addlible lib1; |
View auditing a job queue
-- To be able to audit holding of a job queue, you need to: | |
-- 1) Enable object auditing | |
-- 2) Configure object auditing for specific job queues | |
cl: CHGSYSVAL SYSVAL(QAUDCTL) VALUE('*AUDLVL *OBJAUD *NOQTEMP'); | |
cl: CHGOBJAUD OBJ(QGPL/KIDDIEJOBQ) OBJTYPE(*JOBQ) OBJAUD(*CHANGE); | |
stop; | |
-- | |
-- T-ZC audit journal entry: | |
-- https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzarl/rzarlf77.htm |
View Interactive Users and usage.sql
-- | |
-- description: What are ALL my interactive users doing right now? (summary) | |
-- ==== | |
-- | |
select j.authorization_name as user_name, u.text_description as description, | |
count(*) as job_count | |
from qsys2.user_info as u | |
join table ( | |
qsys2.active_job_info( | |
subsystem_list_filter => 'QINTER', detailed_info => 'ALL') |
View Managing MSGW jobs.sql
-- | |
-- Find active jobs (in QBATCH) that are in message wait status | |
-- | |
with msgw_jobs (jn) as ( | |
select job_name | |
from table ( | |
qsys2.active_job_info(subsystem_list_filter => 'QBATCH') | |
) x | |
where job_status = 'MSGW' | |
) |
View Well isnt that special.sql
-- | |
-- Complete review of special authorities granted to user profiles | |
-- | |
select user_name, ordinal_position, ltrim(element) as special_authority | |
from qsys2.user_info, table ( | |
systools.split(rtrim(special_authorities), ' ') | |
) b | |
where user_name not in (select authorization_name | |
from qsys2.authids | |
where authorization_attr = 'GROUP'); |
View Library sizes and more.sql
-- category: IBM i Services | |
-- description: Librarian - Library Info | |
-- minvrm: V7R3M0 | |
-- | |
create or replace variable coolstuff.library_report_stmt varchar(10000) for sbcs data default | |
'create or replace table coolstuff.library_sizes | |
(library_name, schema_name, | |
-- qsys2.library_info() columns |
View Who am i.sql
-- | |
-- Who am i? | |
-- | |
select s.host_name, e.host_name, 'IBM i ' concat os_version concat '.' concat os_release as ibmi_level, | |
serial_number, machine_type, machine_model, | |
ipl_mode, ipl_type, attention_light, | |
total_cpus, e.configured_cpus, | |
configured_memory, total_memory, | |
s.* | |
from sysibmadm.env_sys_info e, qsys2.system_status_info s; |
NewerOlder