当前位置: 传客网 > Oracle VS DB2

Oracle VS DB2

2016-12-09 作者:SimonLai

 Item  Oracle  DB2
 Backup --- Online  RMAN,
v$rman_status
 backup database sample to \tmp
db2 list history all for SAMPLE
list history backup since 20161201 for xxx
 Backup -- Offline  expdp/impdp,export/import db2 backup database sample to \tmp,
db2 restore database sample from \tmp taken at 2014061710
 logs alert_sid.log  d2diag.log 
   AWR  OPM and Snapshot in cron job
see snaphost below


     
     
     
     
     
     
     
     
     
     
     
     
     
     
     


---DB2 snapshot---
db2 get snapshot for database on $database      > $rpt_out.snapshot.database.d$timestamp
db2 get snapshot for dbm                        > $rpt_out.snapshot.dbm.d$timestamp
db2 get snapshot for locks on $database         > $rpt_out.snapshot.locks.d$timestamp
db2 get snapshot for applications on $database  > $rpt_out.snapshot.apps.d$timestamp
db2 get snapshot for dynamic sql on $database   > $rpt_out.snapshot.dynsql.d$timestamp
db2 get snapshot for bufferpools on $database   > $rpt_out.snapshot.bufferpools.d$timestamp
db2 get snapshot for tables on $database        > $rpt_out.snapshot.tables.d$timestamp
db2 list applications show detail               > $rpt_out.list.apps.d$timestamp

---Tidy snapshot log---
#=============================================================================
# Get current log usage
#=============================================================================
# logspace currently used
typeset -i lused=`db2 -x 'select int(total_log_used/1024/1024) from sysibmadm.snapdb ' `
# logspace available
typeset -i lsavail=`db2 -x 'select int(total_log_available/1024/1024) from sysibmadm.snapdb ' `
# Total logspace
(( totlog=$lused + $lsavail ))
# Percentage in use
typeset -i Pused=`db2 -x 'select int((float(total_log_used) / float(total_log_used+total_log_available))*100) from sysibmadm.snapdb ' `
# Total log usage high water mark
typeset -i Mlused=`db2 -x 'select int(tot_log_used_top/1024/1024) from sysibmadm.snapdb ' `
# High water mark for Secondary logs used
typeset -i MSecu=`db2 -x 'select int(sec_log_used_top/1024/1024) from sysibmadm.snapdb ' `
# Total secondary logs currently in use
typeset -i secu=`db2 -x 'select int(sec_logs_allocated) from sysibmadm.snapdb ' `
# Defined Log totals
plog=$(db2 get db cfg for $database | grep LOGPRIMARY | awk '{print $8}')
slog=$(db2 get db cfg for $database | grep LOGSECOND  | awk '{print $8}')
lsiz=$(db2 get db cfg for $database | grep LOGFILSIZ  | awk '{print $7}')
(( lsize=$lsiz*4096 ))
(( totplg=$plog*$lsize/1024/1024))
(( totslg=$slog*$lsize/1024/1024))
# Timestamp of last reset
typeset -L -R tstamp=`db2 -x 'select LAST_RESET from sysibmadm.snapdb ' `



相关推荐

返回
顶部