Friday, August 3, 2018

How to Change MySQL Data Directory to a New Location in Linux 6

1. connect mysql database to identify data dir location

[root@oracle var]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.21 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@datadir;
+-----------------+
| @@datadir       |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
mysql> exit
Bye

2. Stop mysql database to change data dir location

[root@oracle var]# service mysqld stop
Stopping mysqld:                                           [  OK  ]

Run below command sync data to new location

[root@oracle var]# rsync -av /var/lib/mysql /u01/mysql_newlocation
sending incremental file list
mysql/
mysql/.bash_history -> /dev/null
mysql/.bashrc
mysql/.mysql_history
mysql/auto.cnf
mysql/ca-key.pem
mysql/ca.pem
mysql/client-cert.pem
mysql/client-key.pem
mysql/dead.letter
mysql/ib_buffer_pool
mysql/ib_logfile0
mysql/ib_logfile1
mysql/ibdata1
mysql/mysql-init
mysql/mysql-init1
mysql/ninfo
.
.

etc

sent 210708737 bytes  received 8791 bytes  84287011.20 bytes/sec
total size is 210649498  speedup is 1.00

Move /var/lib/mysql folder old

[root@oracle var]# mv /var/lib/mysql /var/lib/mysql.bak

3. Change datadir location in configuration file

vi /etc/my.cnf

[mysqld]


datadir=/u01/mysql_newlocation/mysql
socket=/u01/mysql_newlocation/mysql/mysql.sock

## New entry for client configuration 

[client]
port=3306
socket=/u01/mysql_newlocation/mysql/mysql.sock

4. Restart mysql

[root@oracle lib]# service mysqld start
Starting mysqld:                                           [  OK  ]

5. Verify new datadir 

[root@oracle mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.21 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@datadir;
+-------------------------------+
| @@datadir                     |
+-------------------------------+
| /u01/mysql_newlocation/mysql/ |
+-------------------------------+
1 row in set (0.00 sec)

mysql> exit
Bye

How to resolve grid(12.1.0) root.sh issue in Linux6

Issue:

[root@oracle grid]# ./root.sh
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/grid/product/12.1.0/grid/crs/install/crsconfig_params
PROTL-4: Failed to retrieve data from the local registry
2017/04/20 14:05:56 CLSRSC-169: Failed to create or upgrade OLR

Died at /u01/grid/product/12.1.0/grid/crs/install/crsutils.pm line 7672.
The command '/u01/grid/product/12.1.0/grid/perl/bin/perl -I/u01/grid/product/12.1.0/grid/perl/lib -I/u01/grid/product/12.1.0/grid/crs/install /u01/grid/product/12.1.0/grid/crs/install/roothas.pl ' execution failed 

Solution:

Need to deconfig grid before fresh installtion.


[root@oracle etc]# /u01/grid/product/12.1.0/grid/crs/install/roothas.pl -deconfig -force -verbose
Using configuration parameter file: /u01/grid/product/12.1.0/grid/crs/install/crsconfig_params
2017/04/20 14:54:18 CLSRSC-332: CRS resources for listeners are still configured
[root@oracle grid]# ./root.sh
PRCR-1065 : Failed to stop resource ora.ASMDB.lsnr
CRS-5013: Agent "ORAAGENT" failed to start process "/u01/db/oracle/product/12.1.0/dbhome_1/bin/lsnrctl" for action "clean": details at "(:CLSN00008:)" in "/u01/grid/diag/crs/oracle/crs/trace/ohasd_oraagent_grid.trc"
CRS-5013: Agent "ORAAGENT" failed to start process "/u01/db/oracle/product/12.1.0/dbhome_1/bin/lsnrctl" for action "check": details at "(:CLSN00008:)" in "/u01/grid/diag/crs/oracle/crs/trace/ohasd_oraagent_grid.trc"
CRS-2680: Clean of 'ora.ASMDB.lsnr' on 'oracle' failed

2017/04/20 14:54:19 CLSRSC-424: Failed to stop database listener, but continuing to deconfigure with force option

PRKO-2573 : ONS daemon is already stopped.
CRS-4133: Oracle High Availability Services has been stopped.
2017/04/20 14:54:37 CLSRSC-337: Successfully deconfigured Oracle Restart stack


[root@oracle grid]# ./root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/grid/product/12.1.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/grid/product/12.1.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'dba'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node oracle successfully pinned.
2017/04/20 14:57:05 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.conf'


oracle     2017/04/20 14:57:30     /u01/grid/product/12.1.0/grid/cdata/oracle/backup_20170420_145730.olr     0
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oracle'
CRS-2673: Attempting to stop 'ora.evmd' on 'oracle'
CRS-2677: Stop of 'ora.evmd' on 'oracle' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oracle' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.
2017/04/20 14:57:47 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

Thursday, August 2, 2018

Xclock "Warning: Missing charsets in String to FontSet conversion" in CentOS/Linux 6

Issue:

[root@oracle ~]# xclock
Warning: Missing charsets in String to FontSet conversion

Incorrect setting for locale environment variable LC_ALL.

Solution:

Set the LC_ALL=C variable using the below command

$ export LC_ALL=C
To make this change permanent for a particular user, add the required entries in the .bash_profile file.

$ vi /home/<username>/.bash_profile

LC_ALL=C
export LC_ALL

Run xclock it should work without any issues.

[root@oracle ~]# xclock
[root@oracle ~]#

How to Modifying Language and Time Zone Preferences in ERP R12

To change display and time zone preferences:


Incorrect time showing in Application.

       1. Sign in to the application.
       2. Click the Preferences option from the logged-in user name menu at the top of the dashboard.

      This displays the Preferences page.
      3. Select your preferred language from the Language list.


    4. Select the country and the related time zone from the Timezone list.

     5. Click Apply to save your changes.


How to check the lock status of any user account and change the Password policy in Linux


1. To check User lock status

[root@oracle ~]# chage -l mysql
Last password change                                    : Jul 26, 2018
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : -1
Maximum number of days between password change          : -1
Number of days of warning before password expires       : -1

Find more details by using below command

[root@oracle ~]# passwd --help
Usage: passwd [OPTION...] <accountName>
  -k, --keep-tokens       keep non-expired authentication tokens
  -d, --delete            delete the password for the named account (root only)
  -l, --lock              lock the password for the named account (root only)
  -u, --unlock            unlock the password for the named account (root only)
  -e, --expire            expire the password for the named account (root only)
  -f, --force             force operation
  -x, --maximum=DAYS      maximum password lifetime (root only)
  -n, --minimum=DAYS      minimum password lifetime (root only)
  -w, --warning=DAYS      number of days warning users receives before password expiration (root only)
  -i, --inactive=DAYS     number of days after password expiration when an account becomes disabled (root only)
  -S, --status            report password status on the named account (root only)
  --stdin                 read new tokens from stdin (root only)

Help options:
  -?, --help              Show this help message
  --usage                 Display brief usage message

2. Change Password Policy using below command.

[root@oracle ~]# passwd mysql --minimum=0 --maximum=99999 --warning=7
Adjusting aging data for user mysql.
passwd: Success

[root@oracle ~]# chage -l mysql
Last password change                                    : Jul 26, 2018
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999

Number of days of warning before password expires       : 7

RPM Install issue in CentOS/RHEL6

[root@oracle~]# yum install telnet
Loaded plugins: security
Setting up Install Process
No package telnet available.
Error: Nothing to do

[root@oracle yum.repos.d]# wget http://yum.oracle.com/public-yum-ol6.repo
--2018-02-08 06:56:28--  http://yum.oracle.com/public-yum-ol6.repo
Resolving yum.oracle.com... failed: Temporary failure in name resolution.
wget: unable to resolve host address “yum.oracle.com”

Ping  yum.oracle.com and add ip entry for yum.oracle.com in /etc/hosts file

[root@oracle yum.repos.d]# wget http://yum.oracle.com/public-yum-ol6.repo
--2018-02-08 06:57:48--  http://yum.oracle.com/public-yum-ol6.repo
Resolving yum.oracle.com... 23.205.118.252
Connecting to yum.oracle.com|23.205.118.252|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9547 (9.3K) [text/plain]
Saving to: “public-yum-ol6.repo.1”

100%[=========================================================================================>] 9,547       --.-K/s   in 0s

2018-02-08 06:57:49 (63.4 MB/s) - “public-yum-ol6.repo.1” saved [9547/9547]


[root@oracle yum.repos.d]# yum install telnet
Loaded plugins: security
Setting up Install Process
Repository 'public_ol6_UEK_latest': Error parsing config: Error parsing "enabled = '$uek'": invalid boolean value
Repository 'public_ol6_UEKR3_latest': Error parsing config: Error parsing "enabled = '$uekr3'": invalid boolean value
Repository 'public_ol6_UEKR4': Error parsing config: Error parsing "enabled = '$uekr4'": invalid boolean value
Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again

[root@oracle yum.repos.d]# uname -a
Linux dbfw08002793653d 4.1.12-103.9.4.el6uek.x86_64 #2 SMP Wed Nov 8 14:04:45 PST 2017 x86_64 x86_64 x86_64 GNU/Linux

Change enabled value in public-yum-ol6.repo file like below

[public_ol6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=$uek

[public_ol6_UEKR3_latest]
name=Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/UEKR3/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=$uekr3

[public_ol6_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=$uekr4

to

[public_ol6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[public_ol6_UEKR3_latest]
name=Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/UEKR3/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

[public_ol6_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0

Now install rpm using Yum it should run without any issues.

[root@oracle yum.repos.d]# yum install telnet
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-48.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package                            Arch                               Version                                      Repository                                     Size
==========================================================================================
Installing:
 telnet                             x86_64                             1:0.17-48.el6                                public_ol6_latest                              57 k

Transaction Summary
==========================================================================================
Install       1 Package(s)

Total download size: 57 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
telnet-0.17-48.el6.x86_64.rpm                                                                                                                    |  57 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 12 pre-existing rpmdb problem(s), 'yum check' output follows:
glib2-2.28.8-9.el6.x86_64 has missing requires of libfam.so.0()(64bit)
glib2-2.28.8-9.el6.x86_64 has missing requires of shared-mime-info
1:grub-0.97-99.0.1.el6.x86_64 has missing requires of system-logos
httpd-2.2.15-60.0.1.el6_9.6.x86_64 has missing requires of system-logos >= ('0', '7.92.1', '1')
initscripts-9.03.58-1.0.1.el6_9.2.x86_64 has missing requires of oracle-logos
less-436-13.el6.x86_64 has missing requires of groff
plymouth-0.8.3-29.0.1.el6.x86_64 has missing requires of system-logos
python-dmidecode-3.10.15-1.el6.x86_64 has missing requires of libxml2-python
python-dmidecode-3.10.15-1.el6.x86_64 has missing requires of libxml2mod.so()(64bit)
python-gudev-147.1-4.el6_0.1.x86_64 has missing requires of pygobject2
selinux-policy-3.7.19-307.0.1.el6_9.2.noarch has missing requires of m4
yum-utils-1.1.30-40.0.1.el6.noarch has missing requires of libxml2-python
  Installing : 1:telnet-0.17-48.el6.x86_64                                                                                                                          1/1
  Verifying  : 1:telnet-0.17-48.el6.x86_64                                                                                                                          1/1

Installed:
  telnet.x86_64 1:0.17-48.el6

Complete!


How to Install wget on RHEL 6

How to Install wget on RHEL 6

[root@rhel6 ~]# yum install wget -y
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.i686 0:1.12-1.4.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package          Arch             Version                   Repository                        Size
============================================================================================
Installing:
 wget             i686             1.12-1.4.el6              DVD-RHEL6-Repository             481 k

Transaction Summary
============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 481 k
Installed size: 1.8 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : wget-1.12-1.4.el6.i686                                                       1/1

Installed:
  wget.i686 0:1.12-1.4.el6

Complete!



[root@dbfw08002793653d yum.repos.d]# wget http://yum.oracle.com/public-yum-ol6.repo
--2018-02-08 06:57:48--  http://yum.oracle.com/public-yum-ol6.repo
Resolving yum.oracle.com... 23.205.118.252
Connecting to yum.oracle.com|23.205.118.252|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9547 (9.3K) [text/plain]
Saving to: “public-yum-ol6.repo.1”

100%[==========================================================================================>] 9,547       --.-K/s   in 0s

2018-02-08 06:57:49 (63.4 MB/s) - “public-yum-ol6.repo.1” saved [9547/9547]

How to clean YUM cache in CentOS / RHEL6

How to clean YUM cache in CentOS / RHEL

[root@oracle ]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        24G   20G  3.7G  84% /
tmpfs           7.8G  152K  7.8G   1% /dev/shm
/dev/sda1       190M  124M   52M  71% /boot
/dev/sda4       4.7G   31M  4.4G   1% /tmp
/dev/sda5       873G  711G  118G  86% /u01

[root@oracle]cd /var/cache

[root@oracle cache]# du -sh *
4.0K    abrt-di
16K     cups
1.4M    fontconfig
4.0K    foomatic
12K     gdm
1.3M    hald
4.0K    ipmimonitoringsdrcache
4.0K    ipmiseld
4.0K    krb5rcache
92K     ldconfig
8.0K    libvirt
3.6M    man
4.0K    mod_proxy
4.0K    mod_ssl
116K    PackageKit
4.0K    powertop
12K     rpcbind
12K     tomcat6
6.8G    yum


[root@oracle]# yum clean all
Loaded plugins: refresh-packagekit, security, ulninfo
Cleaning repos: epel mysql-connectors-community mysql-tools-community mysql57-community public_ol6_UEKR4 public_ol6_addons public_ol6_latest
Cleaning up Everything

[root@oracle yum]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        24G   13G   11G  55% /
tmpfs           7.8G  152K  7.8G   1% /dev/shm
/dev/sda1       190M  124M   52M  71% /boot
/dev/sda4       4.7G   31M  4.4G   1% /tmp
/dev/sda5       873G  711G  118G  86% /u01