Can you delete evt files in DB2DETAILDEADLOCK? - events

In my IBM DB2 server (it is linux server) I have a problem that db2/db2_1 is 100% used. In this directory I see that in path "/db2/db2_1/db2inst1/NODE0000/SQL00001/db2event/db2detaildeadlock" are a lot of XXXX.evt files that takes some amount of disk space.
linuxprod:/db2/db2_1/db2inst1/NODE0000/SQL00001/db2event/db2detaildeadlock> ll
-rw-r--r-- 1 db2inst1 db2iadm1 2096934 2010-01-11 07:17 00000000.evt
-rw-r--r-- 1 db2inst1 db2iadm1 2089026 2011-12-12 07:12 00000001.evt
-rw-r--r-- 1 db2inst1 db2iadm1 2091422 2012-02-06 06:43 00000002.evt
-rw-r--r-- 1 db2inst1 db2iadm1 2088934 2012-06-04 07:06 00000003.evt
-rw-r--r-- 1 db2inst1 db2iadm1 1662969 2013-03-21 15:54 00000004.evt
-rw-r--r-- 1 db2inst1 db2iadm1 1950082 2014-06-26 13:28 00000005.evt
-rw-r--r-- 1 db2inst1 db2iadm1 2069150 2015-02-19 13:24 00000006.evt
-rw-r--r-- 1 db2inst1 db2iadm1 203704 2015-04-14 16:30 00000007.evt
-rw-r--r-- 1 db2inst1 db2iadm1 131061876 2015-04-14 16:30 00000008.evt
-rw-r--r-- 1 db2inst1 db2iadm1 873559 2015-04-20 15:29 00000009.evt
-rw-r--r-- 1 db2inst1 db2iadm1 129650884 2015-04-20 15:29 00000010.evt
-rw-r--r-- 1 db2inst1 db2iadm1 371426 2015-07-07 15:10 00000011.evt
-rw-r--r-- 1 db2inst1 db2iadm1 154020299 2015-07-07 15:10 00000012.evt
-rw-r--r-- 1 db2inst1 db2iadm1 385652 2015-09-01 18:03 00000013.evt
-rw-r--r-- 1 db2inst1 db2iadm1 150405814 2015-09-01 18:03 00000014.evt
-rw-r--r-- 1 db2inst1 db2iadm1 2011825 2017-03-01 08:11 00000015.evt
-rw-r--r-- 1 db2inst1 db2iadm1 129911624 2017-03-01 08:11 00000016.evt
-rw-r--r-- 1 db2inst1 db2iadm1 1969859 2018-06-27 15:00 00000017.evt
-rw-r--r-- 1 db2inst1 db2iadm1 2083040 2019-07-04 09:04 00000018.evt
-rw-r--r-- 1 db2inst1 db2iadm1 765463 2019-09-16 16:54 00000019.evt
-rw-r----- 1 db2inst1 db2iadm1 43 2019-07-04 09:04 db2event.ctl
Is it ok to delete this .evt files (or move them to some other disk)? What happens if I delete them?

Yes you can erase these .evt files, but the consequence is that you (or any DBA) will not then be able to investigate those deadlock / timeout events (unless they are reproducible).
You can also move them to another location for later inspection via the relevant tooling, this is possibly the safest option for a production system.
It's likely that these files are not the main user of the space in that file system, so be sure to eliminate (or control) the main space consumers first.
Perhaps you should consider investigating and resolving the events that are leading to the deadlocks/timeouts?
The relevant event-monitor that creates these files can also be disabled, and the size and number of the files can be controlled via configuration. Refer to the Db2 Knowledge centre for details of this configuration activity.

Yes, it is safe to delete older event files. Since you don't seem to be using this event monitor anyway, you might as well disable it:
set event monitor DB2DETAILDEADLOCK state 0
The deadlock event monitor is deprecated since Db2 9.7, so you probably should consider dropping it altogether and creating a new event monitor for locks, which collects more useful information.

Related

Force rotate a certain log file without using logrotate

I am trying to force rotate a specific log, e.g., /mroot/etc/mlog/sktrace.log.
For example, currently here are all the logs related to sktrace:
<machine_name>% ll /mroot/etc/mlog/sktrace*
-rw-r--r-- 2 root wheel 13276789 Oct 16 13:00 /mroot/etc/mlog/sktrace.log
-rw-r--r-- 1 root wheel 3063670 Oct 13 10:42 /mroot/etc/mlog/sktrace.log.0000000001
-rw-r--r-- 1 root wheel 44072508 Oct 14 10:42 /mroot/etc/mlog/sktrace.log.0000000002
-rw-r--r-- 1 root wheel 96622284 Oct 15 10:42 /mroot/etc/mlog/sktrace.log.0000000003
-rw-r--r-- 1 root wheel 104858396 Oct 16 08:54 /mroot/etc/mlog/sktrace.log.0000000004
-rw-r--r-- 1 root wheel 10466192 Oct 16 10:42 /mroot/etc/mlog/sktrace.log.0000000005
-rw-r--r-- 2 root wheel 13276789 Oct 16 13:00 /mroot/etc/mlog/sktrace.log.0000000006
By “force rotate”, I mean to copy the content in the current /mroot/etc/mlog/sktrace.log to /mroot/etc/mlog/sktrace.log.0000000007, and then truncate /mroot/etc/mlog/sktrace.log to 0-byte.
The decent way is probably via logrotate. But it is not available on the system I am using:
<machine_name>% which logrotate
logrotate: Command not found.
<machine_name>% ll /usr/sbin/logrotate
ls: /usr/sbin/logrotate: No such file or directory
What's the best alternative in bash, please?

Reset/Remove .bash file versions

New to this and I believe I made duplicates or versions of the .bash_profile. I'd like to know how to make one the priority or delete those that are not active. I think its interfering with my SQL communication.
-rw------- 1 noahjones staff 2342 Sep 3 18:33 .bash_history
-rw-r--r-- 1 noahjones staff 157 Sep 3 18:31 .bash_profile
-rw------- 1 noahjones staff 201 Sep 3 18:29 .bash_profile.save
-rw-r--r-- 1 noahjones staff 74 Sep 3 16:33 .bash_profile_
drwx------ 48 noahjones staff 1536 Sep 3 18:34 .bash_sessions
-rw-r--r-- 1 noahjones staff 118 Sep 3 15:38 .bashrc
drwxr-xr-x 3 noahjones staff 96 Sep 3 16:01 .bundle
drwxr-xr-x 4 noahjones staff 128 Sep 3 15:40 .gem
-rw-r--r-- 1 noahjones staff 74 Sep 3 18:33 _bash.profile
Only the .bashrc and /.bash_profile are relevant. The file .bash_history is created automatically to store the history of your commands; the .bash_profile.save, .bash_profile_ and _bash.profile must be your backup files -- they are virtually ignored. The .bundle and .gem are not related to bash.
You probably have .bashrc and/or .bash_profile misconfigured. The difference between .bash_profile and .bashrc is that the former is only executed once, when you log in, while the latter is run every time you open a new /bin/bash shell. Depending on what you need to do with SQL you may want to delete one or the other.

metabase as service with oracle database

I tried Install Metabase as servicetutorial for Metabase Setup on CENTOS. Though i want to run metabase with oracle.
[bkmetabase#BK01 MetaBase]$ pwd
/home/bkmetabase/MetaBase
[bkmetabase#BK01 MetaBase]$ ll
total 119488
-rw-rw-r-- 1 bkmetabase bkmetabase 3975 Jun 6 07:52 logger_metabase.log
-rw-rw-r-- 1 bkmetabase bkmetabase 7503872 Jun 6 07:52 metabase.db.mv.db
-rw-rw-r-- 1 bkmetabase bkmetabase 187 May 27 12:12 metabase.db.trace.db
-rw-rw-r-- 1 bkmetabase bkmetabase 114839203 May 20 13:10 metabase.jar
drwxrwxr-x 2 bkmetabase bkmetabase 4096 May 27 12:05 plugins
[bkmetabase#BK01 MetaBase]$ cd plugins/
[bkmetabase#BK01 MetaBase]$ ll
total 3320
-rw-rw-r-- 1 bkmetabase bkmetabase 3397734 May 5 17:13 ojdbc7.jar
Currently to run as process i am running like below
~/jdk1.8.0_171/bin/java -jar metabase.jar &> logger_metabase.log &
How can we run it as background service with oracle as database?

hive script file not found exception

I am running below command file is in my local directory but I am getting below error while running the file.
[hdfs#ip-xxx-xxx-xx-xx scripts]$ ls -lrt
total 28
-rwxrwxrwx. 1 root root 17 Apr 1 15:53 hive.hive
-rwxrwxrwx 1 hdfs hadoop 88 May 7 11:53 shell_fun
-rwxrwxrwx 1 hdfs hadoop 262 May 7 12:23 first_hive
-rwxrwxrwx 1 root root 88 May 7 16:59 311_cust_shell
-rwxrwxrwx 1 root root 822 May 8 20:29 script_1
-rw-r--r-- 1 hdfs hadoop 31 May 8 20:30 script_1.log
**-rwxrwxrwx 1 hdfs hdfs 64 May 8 22:07 **hql2.sql***
[hdfs#ip-xxx-xxx-xx-xx scripts]$ hive -f hql2.sql
WARNING: Use "yarn jar" to launch YARN applications.
Logging initialized using configuration in file:/etc/hive/2.3.4.0-3485/0/hive-log4j.properties Could not open input file for reading.
(File file:/home/ec2-user/scripts/hive/scripts/hql2.sql does not exist)
[hdfs#ip-xxx-xxx-xx-xx scripts]$

Protect .git file with git-bash

I'm trying to turn a django site into a static site using https://github.com/mgrp/django-distill . I am outputting the static files into
/e/ENVS/STATIC/static1
on my win10 local system. As I make changes I want to overwrite all the non hidden files including the .git directory, the commit and push the changes to my github repo for deployment. Unfortunately the distill project overwrites the entire directory , deleting the .git/ files. I've tried to protect the git files with
$ chmod -R 707 .git/
using git-bash, but the output looks like:
drwxr-xr-x 1 me 197121 0 Oct 21 14:35 ./
drwxr-xr-x 1 me 197121 0 Oct 20 17:11 ../
drwxr-xr-x 1 me 197121 0 Oct 21 14:35 .git/
drwxr-xr-x 1 me 197121 0 Oct 21 14:36 .idea/
-rw-r--r-- 1 me 197121 9963 Oct 21 15:02 agreement.html
-rw-r--r-- 1 me 197121 17 Oct 21 15:02 contact.html
-rw-r--r-- 1 me 197121 14027 Oct 21 15:02 documents.html
-rw-r--r-- 1 me 197121 17048 Oct 21 15:02 form.html
-rw-r--r-- 1 me 197121 11060 Oct 21 15:02 index.html
-rw-r--r-- 1 me 197121 4921 Oct 21 15:02 slideshow.html
drwxr-xr-x 1 me 197121 0 Oct 21 15:02 static/
How do I turn on and off write permissions for the .git/ directory?
You can move the .git/ folder out of the way elsewhere.
Whenever you need to work on that repo, set the environment variables:
GIT_DIR=/path/to/saved/.git
GIT_WORK_TREE=/where/your/.git/was
And you will benefit from working Git commands when typing git status, even if your deployment process overrides everything.

Resources