Thứ Năm, 31 tháng 12, 2020

Các câu lệnh hay dùng để kiểm tra database DB2, alert log, monitor, kill

Check DB

ps -ef |grep sysc

 

bash-4.2$ db2 list active databases

bash-4.2$ db2 list active databases           

Active Databases

 

Database name                          = DBAVN

Applications connected currently       = 56

Database path                          = /db2fs/node0000/db2inst2/NODE0000/SQL00001/MEMBER0000/

 

bash-4.2$ db2 list active databases

SQL1032N  No start database manager command was issued.  SQLSTATE=5701

     


bash-4.2$ db2 connect to <db_name>

Login bang db2

db2 connect to DBAVN1

SQL1013N  The database alias name or database name "EWD" could not be found. 

SQLSTATE=42705

 

db2 connect to DBAVN

 

   Database Connection Information

 

 Database server    = DB2/AIX64 10.5.0

 SQL authorization ID   = DB2I

 

db2 => ?

 

bash-4.2$ db2 get db cfg for DBAVN

  Database Configuration for Database DBAVN

 

 Database configuration release level                = 0x1000

 Database release level                              = 0x1000

 

 Database territory                                  = US

 Database code page                                  = 1208

 Database code set                                   = UTF-8

 Database country/region code                        = 1

 Database collating sequence                         = SYSTEM_819

 Alternate collating sequence          (ALT_COLLATE) =

 Number compatibility                                = OFF

 Varchar2 compatibility                              = OFF

 Date compatibility                                  = OFF

 Database page size                                  = 16384

 

 Statement concentrator                  (STMT_CONC) = OFF

 

 Discovery support for this database   (DISCOVER_DB) = ENABLE

 

 Restrict access                                     = NO

 Default query optimization class     (DFT_QUERYOPT) = 5

 Degree of parallelism                  (DFT_DEGREE) = 1

 Continue upon arithmetic exceptions   (DFT_SQLMATHWARN) = NO

 Default refresh age               (DFT_REFRESH_AGE) = 0

 Default maintained table types for opt (DFT_MTTB_TYPES) = SYSTEM

 Number of frequent values retained (NUM_FREQVALUES) = 10

 Number of quantiles retained        (NUM_QUANTILES) = 20

 

 Decimal floating point rounding mode  (DECFLT_ROUNDING) = ROUND_HALF_EVEN

 

 Backup pending                                      = NO

 

 All committed transactions have been written to disk = NO

 Rollforward pending                                 = NO

 Restore pending                                     = NO

 

 Multi-page file allocation enabled                  = YES

 

 Log retain for recovery status                      = NO

 User exit for logging status                        = YES

 

 Self tuning memory                (SELF_TUNING_MEM) = ON

 Size of database shared memory (4KB)  (DATABASE_MEMORY) = AUTOMATIC(13202504)

 Database memory threshold           (DB_MEM_THRESH) = 100

 Max storage for lock list (4KB)          (LOCKLIST) = AUTOMATIC(2623200)

 Percent. of lock lists per application   (MAXLOCKS) = AUTOMATIC(77)

 Package cache size (4KB)               (PCKCACHESZ) = AUTOMATIC(32663)

 Sort heap thres for shared sorts (4KB) (SHEAPTHRES_SHR) = AUTOMATIC(7228378)

 Sort list heap (4KB)                     (SORTHEAP) = AUTOMATIC(50000)

 

 Database heap (4KB)                        (DBHEAP) = AUTOMATIC(1200)

 Catalog cache size (4KB)          (CATALOGCACHE_SZ) = (MAXAPPLS*5)

 Log buffer size (4KB)                    (LOGBUFSZ) = 2048

 Utilities heap size (4KB)            (UTIL_HEAP_SZ) = AUTOMATIC(1000000)

 SQL statement heap (4KB)                 (STMTHEAP) = 80000

 Default application heap (4KB)         (APPLHEAPSZ) = AUTOMATIC(256)

 Application Memory Size (4KB)         (APPL_MEMORY) = AUTOMATIC(40000)

 Statistics heap size (4KB)           (STAT_HEAP_SZ) = AUTOMATIC(4384)

 

 Interval for checking deadlock (ms)     (DLCHKTIME) = 10000

 Lock timeout (sec)                    (LOCKTIMEOUT) = -1

 

 Changed pages threshold            (CHNGPGS_THRESH) = 60

 Number of asynchronous page cleaners   (NUM_IOCLEANERS) = AUTOMATIC(2)

 Number of I/O servers               (NUM_IOSERVERS) = AUTOMATIC(36)

 Sequential detect flag                  (SEQDETECT) = YES

 Default prefetch size (pages)     (DFT_PREFETCH_SZ) = AUTOMATIC

 

 Track modified pages                     (TRACKMOD) = NO

 

 Default number of containers                        = 1

 Default tablespace extentsize (pages)   (DFT_EXTENT_SZ) = 32

 

 Max number of active applications        (MAXAPPLS) = AUTOMATIC(544)

 Average number of active applications   (AVG_APPLS) = AUTOMATIC(1)

 Max DB files open per application        (MAXFILOP) = 61440

 

 Log file size (4KB)                     (LOGFILSIZ) = 262144

 Number of primary log files            (LOGPRIMARY) = 3

 Number of secondary log files           (LOGSECOND) = 246

 Changed path to log files              (NEWLOGPATH) =

 Path to log files                                   = /db2fs/node0000/db2inst2/NODE0000/SQL00001/LOGSTREAM0000/

 Overflow log path                 (OVERFLOWLOGPATH) =

 Mirror log path                     (MIRRORLOGPATH) =

 First active log file                               = S0007110.LOG

 Block log on disk full            (BLK_LOG_DSK_FUL) = NO

 Block non logged operations        (BLOCKNONLOGGED) = NO

 Percent max primary log space by transaction  (MAX_LOG) = 0

 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

 

 Percent log file reclaimed before soft chckpt (SOFTMAX) = 0

 Target for oldest page in LBP   (PAGE_AGE_TRGT_MCR) = 240

 

 HADR database role                                  = STANDARD

 HADR local host name              (HADR_LOCAL_HOST) =

 HADR local service name            (HADR_LOCAL_SVC) =

 HADR remote host name            (HADR_REMOTE_HOST) =

 HADR remote service name          (HADR_REMOTE_SVC) =

 HADR instance name of remote server  (HADR_REMOTE_INST) =

 HADR timeout value                   (HADR_TIMEOUT) = 120

 HADR target list                 (HADR_TARGET_LIST) =

 HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC

 HADR spool log data limit (4KB)  (HADR_SPOOL_LIMIT) = AUTOMATIC(0)

 HADR log replay delay (seconds) (HADR_REPLAY_DELAY) = 0

 HADR peer window duration (seconds)  (HADR_PEER_WINDOW) = 0

 

 First log archive method             (LOGARCHMETH1) = DISK:/archivelog/DBAVN/

 Archive compression for logarchmeth1 (LOGARCHCOMPR1) = OFF

 Options for logarchmeth1              (LOGARCHOPT1) =

 Second log archive method            (LOGARCHMETH2) = OFF

 Archive compression for logarchmeth2 (LOGARCHCOMPR2) = OFF

 Options for logarchmeth2              (LOGARCHOPT2) =

 Failover log archive path            (FAILARCHPATH) =

 Number of log archive retries on error   (NUMARCHRETRY) = 5

 Log archive retry Delay (secs)     (ARCHRETRYDELAY) = 20

 Vendor options                          (VENDOROPT) =

 

 Auto restart enabled                  (AUTORESTART) = ON

 Index re-creation time and redo index build  (INDEXREC) = SYSTEM (RESTART)

 Log pages during index build        (LOGINDEXBUILD) = OFF

 Default number of loadrec sessions (DFT_LOADREC_SES) = 1

 Number of database backups to retain   (NUM_DB_BACKUPS) = 2

 Recovery history retention (days) (REC_HIS_RETENTN) = 20

 Auto deletion of recovery objects (AUTO_DEL_REC_OBJ) = OFF

 

 TSM management class                (TSM_MGMTCLASS) =

 TSM node name                        (TSM_NODENAME) =

 TSM owner                                   (TSM_OWNER) =

 TSM password                         (TSM_PASSWORD) =

 

 Automatic maintenance                  (AUTO_MAINT) = OFF

   Automatic database backup        (AUTO_DB_BACKUP) = OFF

   Automatic table maintenance      (AUTO_TBL_MAINT) = OFF

  Automatic runstats              (AUTO_RUNSTATS) = OFF

    Real-time statistics        (AUTO_STMT_STATS) = OFF

    Statistical views          (AUTO_STATS_VIEWS) = OFF

    Automatic sampling            (AUTO_SAMPLING) = OFF

  Automatic reorganization           (AUTO_REORG) = OFF

 

 Auto-Revalidation                      (AUTO_REVAL) = DEFERRED

 Currently Committed                    (CUR_COMMIT) = ON

 CHAR output with DECIMAL input    (DEC_TO_CHAR_FMT) = NEW

 Enable XML Character operations    (ENABLE_XMLCHAR) = YES

 WLM Collection Interval (minutes) (WLM_COLLECT_INT) = 0

 Monitor Collect Settings

 Request metrics                   (MON_REQ_METRICS) = EXTENDED

 Activity metrics                  (MON_ACT_METRICS) = EXTENDED

 Object metrics                    (MON_OBJ_METRICS) = EXTENDED

 Routine data                         (MON_RTN_DATA) = NONE

   Routine executable list        (MON_RTN_EXECLIST) = OFF

 Unit of work events                  (MON_UOW_DATA) = NONE

   UOW events with package list    (MON_UOW_PKGLIST) = OFF

   UOW events with executable list (MON_UOW_EXECLIST) = OFF

 Lock timeout events               (MON_LOCKTIMEOUT) = NONE

 Deadlock events                      (MON_DEADLOCK) = HISTORY

 Lock wait events                     (MON_LOCKWAIT) = HISTORY

 Lock wait event threshold           (MON_LW_THRESH) = 5000000

 Number of package list entries     (MON_PKGLIST_SZ) = 32

 Lock event notification level     (MON_LCK_MSG_LVL) = 1

 

 SMTP Server                           (SMTP_SERVER) = 10.3.12.27

 SQL conditional compilation flags     (SQL_CCFLAGS) =

 Section actuals setting           (SECTION_ACTUALS) = NONE

 Connect procedure                    (CONNECT_PROC) = DB2INST2.CONNECT_PROCEDURE

 Adjust temporal SYSTEM_TIME period (SYSTIME_PERIOD_ADJ) = NO

 Log DDL Statements                  (LOG_DDL_STMTS) = NO

 Log Application Information         (LOG_APPL_INFO) = NO

 Default data capture on new Schemas   (DFT_SCHEMAS_DCC) = NO

 Default table organization          (DFT_TABLE_ORG) = ROW

 Default string units                 (STRING_UNITS) = SYSTEM

 National character string mapping   (NCHAR_MAPPING) = GRAPHIC_CU16

 Database is in write suspend state                  = NO

 Extended row size support         (EXTENDED_ROW_SZ) = ENABLE

bash-4.2$ db2 get dbm cfg |grep DIAGPATH

Alert Log

 

Diagnostic data directory path           (DIAGPATH) = /home/db2inst2/sqllib/db2dump/

 Current member resolved DIAGPATH                    = /home/db2inst2/sqllib/db2dump/

 Alternate diagnostic data directory path (ALT_DIAGPATH) =

 Current member resolved ALT_DIAGPATH                =

---

bash-4.2$ ls -lt

total 100384

-rw-rw-rw- 1 db2inst2 db2inst2 7058441 Dec 05 21:44 db2diag.log

drwxrwxr-t 2 db2inst2 db2inst2    256 Nov 24 13:45 stmmlog

-rw-rw-rw- 1 db2inst2 db2inst2 290971 May 15 2017  db2inst2.nfy

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.004

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.005

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.006

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.002

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.003

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.001

-rw-r----- 1 db2inst2 db2inst2 6291316 Apr 20 2017  db2eventlog.000

drwxrwxrwx 2 db2inst2 db2inst2    256 Apr 20 2017  DIAG0000

 

$ db2top

Check tải application

$db2 force application (app_id)

Kill app_id


==================================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile: 0902912888
⚡️ Skype: tranbinh48ca
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: http://bit.ly/ytb_binhoraclemaster
👨 Tiktok: https://www.tiktok.com/@binhoraclemaster?lang=vi
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhoracle
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội

#OracleTutorial #OracleDBA #OracleDatabaseAdministration #học oracle database #oca #ocp #tự học oracle

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master