Tuesday, October 4, 2022

Why and How to create a logrotate in Linux?

Why ?

In Linux one of the great feature that you can manage and organize any log file to be rotated on any criteria , for example if you have web service that will create a file.log and you want to have instead a daily file and nominated with that date , or/and have a specify size and/or number of files ..etc , you may use logrotate feature to achieve this.

How ?

Below are sample script to rotate a catalina.out file which is the main tomcat log file in daily bases and compress it and keep it for one year, the new file will be date only and orginal file will be kept same as it  ,:

1- may use man to check all features of logrotate:

man logrotate

2- create the configuration file under logrotate.d :

vi /etc/logrotate.d/tomcat

/<path_to_logs>/catalina.out

{

su user group

copytruncate

compress

daily

missingok

delaycompress

dateext

maxage 365

}

3- You may force the logrotate to run immediately instead of wait for next day.

logrotate –fv /etc/logrotate.d/tomcat

 

Monday, October 3, 2022

Why and How to add Oracle user to TFA access list?

 Why?

Trace File Analyzer (TFA) is a tools provided by Oracle as a part of diagnostic free tools , now a day it is part of Automatic Health Framework (AHF), in RAC environment grid user will be added by default however if you need to run this to collect any issue in DB home and you are installing this using different user (oracle for DB and grid for Grid ), then you have to add oracle user to the access of TFA or it will failed to run and show you a message about this , below in simple steps I am shown how to add this user .

How?

Below are steps to check and grant Oracle access to TFA:

1- Check the tfactl status using root or grid user, a waring for old TFA you may got if it is old, then upgrade is recommended:

tfactl status

WARNING - TFA Software is older than 180 days. Please consider upgrading TFA to the latest version.

 

.---------------------------------------------------------------------------------------------.

| Host   | Status of TFA | PID  | Port | Version    | Build ID             | Inventory Status |

+--------+---------------+------+------+------------+----------------------+------------------+

| <hostname> | RUNNING       | 5648 | 5000 | 18.1.2.0.0 | 18120020180510233906 | COMPLETE         |

| <hostname2> | RUNNING       | 6230 | 5000 | 18.1.2.0.0 | 18120020180510233906 | COMPLETE         |

'--------+---------------+------+------+------------+----------------------+------------------'

2- Check the path of this tfactl:

[root@<hosname> ~]# which tfactl

/u01/app/12.1.0/grid/bin/tfactl

3- Use help to see all commands for tfactl and check the add user command.

Usage : /u01/app/12.1.0/grid/bin/tfactl <command> [options]

    commands:diagcollect|collection|analyze|ips|run|start|stop|enable|disable|status|print|access|purge|directory|host|receiver|set|toolstatus|uninstall|diagnosetfa|syncnodes|setupmos|upload

For detailed help on each command use:

  /u01/app/12.1.0/grid/bin/tfactl <command> -help

access -help

 

Add or Remove or List TFA Users and Groups

 

Usage : /u01/app/12.1.0/grid/bin/tfactl access <command> [options]

    commands:lsusers|add|remove|block|unblock|enable|disable|reset|removeall

For detailed help on each command use:

  /u01/app/12.1.0/grid/bin/tfactl access <command> -help

 

 

4- List the current user:

                                                                                       tfactl> access lsusers

.---------------------------------.

|       TFA Users in <hosname1>   |

+-----------+-----------+---------+

| User Name | User Type | Status  |

+-----------+-----------+---------+

| grid      | USER      | Allowed |

'-----------+-----------+---------'

 

.---------------------------------.

|       TFA Users in <hostname2>  |

+-----------+-----------+---------+

| User Name | User Type | Status  |

+-----------+-----------+---------+

| grid      | USER      | Allowed |

'-----------+-----------+---------'

 

5- Add oracle user to the list:

 

tfactl> access add -user oracle

Successfully added 'oracle' to TFA Access list.

.---------------------------------.

|       TFA Users in <hostname1>  |

+-----------+-----------+---------+

| User Name | User Type | Status  |

+-----------+-----------+---------+

| grid      | USER      | Allowed |

| oracle    | USER      | Allowed |

'-----------+-----------+---------'

.---------------------------------.

|       TFA Users in <hostname2>  |

+-----------+-----------+---------+

| User Name | User Type | Status  |

+-----------+-----------+---------+

| grid      | USER      | Allowed |

| oracle    | USER      | Allowed |

'-----------+-----------+---------'

 

Why and How to install Grid 19c on RHEL 8?

  Why ? Simply we will be requested to install Oracle Grid RAC DB on Redhat RHEL 8, below is my note for this installation . How ? 1-  OS in...