Google it ....

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, May 22, 2020

Error in invoking target 'agent nmhs' of make file ins_emagent.mk while installing Oracle database software

Error in invoking target 'agent nmhs' of make file ins_emagent.mk while installing Oracle 11gr2 11.2.0.4.0 on Red Hat Enterprise Linux 7
Problem:

While installing Oracle database software 11.2.0.4.0 on Linux 7 we may encounter this error in between installation:

Error in invoking target 'agent nmhs' of make file 
/u0/app/oracle/product/11.2.0.4.0/sysman/lib/ins_emagent.mk

Cause:

Linking error due to "ins_emagent.mk"

Solution:

To fix edit the ins_emagent.mk file and change the following line in $ORACLE_HOME/sysman/lib/ins_emagent.mk


$(MK_EMAGENT_NMECTL)

to

$(MK_EMAGENT_NMECTL) -lnnz11

and press the retry button again.

Monday, January 29, 2018

How to delete old files in linux based system timestamp

In this blog post I'll show you how to delete old files based system timestamp, the system timestamp means when a file was created OR when it was last modified. for example if you want to find and delete files older than 30 days in your linux machine you need next commands :
to find list of files which are older than specified days for example 30
find /directory/path/ -type f -mtime +30 -print
to delete files older than specified days for example 30
find /directory/path/ -type f -mtime +30 -exec rm -f {} \; -exec printf "." \;

Let's create small demo and delete some files from some directory which are older than 3 days :
cd /u01/app/oracle/diag/rdbms/testdb/testdb/alert/

[oracle@testdb alert]$ ls -lrt
total 1531540
-rw-r----- 1 oracle asmadmin 10485828 Oct 25  2016 log_115.xml
-rw-r----- 1 oracle asmadmin 10485847 Oct 26  2016 log_116.xml
-rw-r----- 1 oracle asmadmin 10485837 Oct 26  2016 log_117.xml
-rw-r----- 1 oracle asmadmin 10485885 Jun  6  2017 log_118.xml
-rw-r----- 1 oracle asmadmin 10485826 Jun  6  2017 log_119.xml
-rw-r----- 1 oracle asmadmin 10485965 Jun  7  2017 log_120.xml
-rw-r----- 1 oracle asmadmin 10485877 Jun  7  2017 log_121.xml
-rw-r----- 1 oracle asmadmin 10485788 Jun  8  2017 log_122.xml
-rw-r----- 1 oracle asmadmin 10485821 Jun  8  2017 log_123.xml
-rw-r----- 1 oracle asmadmin 10485835 Jun  8  2017 log_124.xml
-rw-r----- 1 oracle asmadmin 10485975 Jun  9  2017 log_125.xml
-rw-r----- 1 oracle asmadmin 10485870 Jun  9  2017 log_126.xml
-rw-r----- 1 oracle asmadmin 10486074 Jun 10  2017 log_127.xml
-rw-r----- 1 oracle asmadmin 10485926 Jun 10  2017 log_128.xml
-rw-r----- 1 oracle asmadmin 10485938 Jun 10  2017 log_129.xml
-rw-r----- 1 oracle asmadmin 10486197 Jun 11  2017 log_130.xml
-rw-r----- 1 oracle asmadmin 10485909 Jun 11  2017 log_131.xml
-rw-r----- 1 oracle asmadmin 10486043 Jun 12  2017 log_132.xml
-rw-r----- 1 oracle asmadmin 10485964 Jun 12  2017 log_133.xml
-rw-r----- 1 oracle asmadmin 10485806 Jun 12  2017 log_134.xml
-rw-r----- 1 oracle asmadmin 10485807 Jun 13  2017 log_135.xml
-rw-r----- 1 oracle asmadmin 10485863 Jun 13  2017 log_136.xml
-rw-r----- 1 oracle asmadmin 10485801 Jun 14  2017 log_137.xml
-rw-r----- 1 oracle asmadmin 10486012 Jun 14  2017 log_138.xml
-rw-r----- 1 oracle asmadmin 10485960 Jun 14  2017 log_139.xml
-rw-r----- 1 oracle asmadmin 10485860 Jun 15  2017 log_140.xml
-rw-r----- 1 oracle asmadmin 10485939 Jun 15  2017 log_141.xml
-rw-r----- 1 oracle asmadmin 10485939 Jun 16  2017 log_142.xml
-rw-r----- 1 oracle asmadmin 10485780 Jun 16  2017 log_143.xml
-rw-r----- 1 oracle asmadmin 10485805 Jun 16  2017 log_144.xml
-rw-r----- 1 oracle asmadmin 10485949 Jun 17  2017 log_145.xml
-rw-r----- 1 oracle asmadmin 10485930 Jun 17  2017 log_146.xml
-rw-r----- 1 oracle asmadmin 10485872 Jun 17  2017 log_147.xml
-rw-r----- 1 oracle asmadmin 10485873 Jun 18  2017 log_148.xml
-rw-r----- 1 oracle asmadmin 10485949 Jun 18  2017 log_149.xml
-rw-r----- 1 oracle asmadmin 10485881 Jun 19  2017 log_150.xml
-rw-r----- 1 oracle asmadmin 10485836 Jun 19  2017 log_151.xml
-rw-r----- 1 oracle asmadmin 10485853 Jun 19  2017 log_152.xml
-rw-r----- 1 oracle asmadmin 10485936 Jun 20  2017 log_153.xml
-rw-r----- 1 oracle asmadmin 10485991 Jun 20  2017 log_154.xml
-rw-r----- 1 oracle asmadmin 10485812 Jun 21  2017 log_155.xml
-rw-r----- 1 oracle asmadmin 10485861 Jun 21  2017 log_156.xml
-rw-r----- 1 oracle asmadmin 10486012 Jun 21  2017 log_157.xml
-rw-r----- 1 oracle asmadmin     3048 Jun 21  2017 log_158.xml
-rw-r----- 1 oracle asmadmin 10486092 Jun 22  2017 log_159.xml
-rw-r----- 1 oracle asmadmin 10485946 Jun 22  2017 log_160.xml
-rw-r----- 1 oracle asmadmin 10485863 Jun 23  2017 log_161.xml
-rw-r----- 1 oracle asmadmin 10485854 Jun 23  2017 log_162.xml
-rw-r----- 1 oracle asmadmin 10485936 Jun 23  2017 log_163.xml
-rw-r----- 1 oracle asmadmin 10485948 Jun 24  2017 log_164.xml
-rw-r----- 1 oracle asmadmin 10485882 Jun 24  2017 log_165.xml
-rw-r----- 1 oracle asmadmin 10485814 Jun 25  2017 log_166.xml
-rw-r----- 1 oracle asmadmin 10485879 Jun 25  2017 log_167.xml
-rw-r----- 1 oracle asmadmin 10485939 Jun 25  2017 log_168.xml
-rw-r----- 1 oracle asmadmin 10485821 Jun 26  2017 log_169.xml
-rw-r----- 1 oracle asmadmin 10485939 Jun 26  2017 log_170.xml
-rw-r----- 1 oracle asmadmin 10485936 Jun 27  2017 log_171.xml
-rw-r----- 1 oracle asmadmin 10485876 Jun 27  2017 log_172.xml
-rw-r----- 1 oracle asmadmin 10486169 Jun 27  2017 log_173.xml
-rw-r----- 1 oracle asmadmin 10485951 Jun 28  2017 log_174.xml
-rw-r----- 1 oracle asmadmin 10486182 Jun 28  2017 log_175.xml
-rw-r----- 1 oracle asmadmin 10486140 Jun 29  2017 log_176.xml
-rw-r----- 1 oracle asmadmin 10485821 Jun 29  2017 log_177.xml
-rw-r----- 1 oracle asmadmin 10486098 Jun 29  2017 log_178.xml
-rw-r----- 1 oracle asmadmin 10485856 Jun 30  2017 log_179.xml
-rw-r----- 1 oracle asmadmin 10485849 Jun 30  2017 log_180.xml
-rw-r----- 1 oracle asmadmin 10486028 Jun 30  2017 log_181.xml
-rw-r----- 1 oracle asmadmin 10485768 Jul  1  2017 log_182.xml
-rw-r----- 1 oracle asmadmin 10485880 Jul  1  2017 log_183.xml
-rw-r----- 1 oracle asmadmin 10485774 Jul  2  2017 log_184.xml
-rw-r----- 1 oracle asmadmin 10485947 Jul  2  2017 log_185.xml
-rw-r----- 1 oracle asmadmin 10485896 Jul  2  2017 log_186.xml
-rw-r----- 1 oracle asmadmin 10485964 Jul  3  2017 log_187.xml
-rw-r----- 1 oracle asmadmin 10485810 Jul  3  2017 log_188.xml
-rw-r----- 1 oracle asmadmin 10485920 Jul  4  2017 log_189.xml
-rw-r----- 1 oracle asmadmin 10485827 Jul  4  2017 log_190.xml
-rw-r----- 1 oracle asmadmin 10485771 Jul  4  2017 log_191.xml
-rw-r----- 1 oracle asmadmin 10486064 Jul  5  2017 log_192.xml
-rw-r----- 1 oracle asmadmin 10485802 Jul  5  2017 log_193.xml
-rw-r----- 1 oracle asmadmin 10485868 Jul  6  2017 log_194.xml
-rw-r----- 1 oracle asmadmin 10485879 Jul  6  2017 log_195.xml
-rw-r----- 1 oracle asmadmin 10485782 Jul  6  2017 log_196.xml
-rw-r----- 1 oracle asmadmin 10485860 Jul  7  2017 log_197.xml
-rw-r----- 1 oracle asmadmin 10485893 Jul  7  2017 log_198.xml
-rw-r----- 1 oracle asmadmin 10485981 Jul  8  2017 log_199.xml
-rw-r----- 1 oracle asmadmin 10485869 Jul  8  2017 log_200.xml
-rw-r----- 1 oracle asmadmin 10485920 Jul  8  2017 log_201.xml
-rw-r----- 1 oracle asmadmin 10485915 Jul  9  2017 log_202.xml
-rw-r----- 1 oracle asmadmin 10486110 Jul  9  2017 log_203.xml
-rw-r----- 1 oracle asmadmin 10486011 Jul 10  2017 log_204.xml
-rw-r----- 1 oracle asmadmin 10485770 Jul 10  2017 log_205.xml
-rw-r----- 1 oracle asmadmin 10485821 Jul 10  2017 log_206.xml
-rw-r----- 1 oracle asmadmin 10485869 Jul 11  2017 log_207.xml
-rw-r----- 1 oracle asmadmin 10485779 Jul 11  2017 log_208.xml
-rw-r----- 1 oracle asmadmin 10485845 Jul 12  2017 log_209.xml
-rw-r----- 1 oracle asmadmin 10485843 Jul 12  2017 log_210.xml
-rw-r----- 1 oracle asmadmin 10485779 Jul 12  2017 log_211.xml
-rw-r----- 1 oracle asmadmin 10485780 Jul 13  2017 log_212.xml
-rw-r----- 1 oracle asmadmin 10485889 Jul 13  2017 log_213.xml
-rw-r----- 1 oracle asmadmin 10485833 Jul 13  2017 log_214.xml
-rw-r----- 1 oracle asmadmin 10485968 Jul 14  2017 log_215.xml
-rw-r----- 1 oracle asmadmin 10485797 Jul 14  2017 log_216.xml
-rw-r----- 1 oracle asmadmin 10485875 Jul 15  2017 log_217.xml
-rw-r----- 1 oracle asmadmin 10485790 Jul 15  2017 log_218.xml
-rw-r----- 1 oracle asmadmin 10485869 Jul 15  2017 log_219.xml
-rw-r----- 1 oracle asmadmin 10485923 Jul 16  2017 log_220.xml
-rw-r----- 1 oracle asmadmin 10485963 Jul 16  2017 log_221.xml
-rw-r----- 1 oracle asmadmin 10485852 Jul 17  2017 log_222.xml
-rw-r----- 1 oracle asmadmin 10485846 Jul 17  2017 log_223.xml
-rw-r----- 1 oracle asmadmin 10485941 Jul 17  2017 log_224.xml
-rw-r----- 1 oracle asmadmin 10485942 Jul 18  2017 log_225.xml
-rw-r----- 1 oracle asmadmin 10485878 Jul 18  2017 log_226.xml
-rw-r----- 1 oracle asmadmin 10485851 Jul 19  2017 log_227.xml
-rw-r----- 1 oracle asmadmin 10486089 Jul 19  2017 log_228.xml
-rw-r----- 1 oracle asmadmin 10485952 Sep 14 18:43 log_229.xml
-rw-r----- 1 oracle asmadmin 10485981 Sep 15 04:01 log_230.xml
-rw-r----- 1 oracle asmadmin 10486100 Sep 15 13:21 log_231.xml
-rw-r----- 1 oracle asmadmin 10485764 Oct 13 00:29 log_232.xml
-rw-r----- 1 oracle asmadmin 10486093 Oct 13 09:48 log_233.xml
-rw-r----- 1 oracle asmadmin 10485787 Oct 13 19:10 log_234.xml
-rw-r----- 1 oracle asmadmin 10486118 Oct 14 04:38 log_235.xml
-rw-r----- 1 oracle asmadmin 10486024 Oct 14 14:05 log_236.xml
-rw-r----- 1 oracle asmadmin 10485823 Oct 14 23:34 log_237.xml
-rw-r----- 1 oracle asmadmin 10485821 Oct 15 09:01 log_238.xml
-rw-r----- 1 oracle asmadmin 10485866 Oct 15 18:28 log_239.xml
-rw-r----- 1 oracle asmadmin 10485821 Oct 16 03:55 log_240.xml
-rw-r----- 1 oracle asmadmin 10485868 Oct 16 13:21 log_241.xml
-rw-r----- 1 oracle asmadmin 10485789 Oct 16 22:50 log_242.xml
-rw-r----- 1 oracle asmadmin 10485813 Oct 17 08:15 log_243.xml
-rw-r----- 1 oracle asmadmin 10485841 Oct 17 17:41 log_244.xml
-rw-r----- 1 oracle asmadmin 10485800 Oct 18 03:07 log_245.xml
-rw-r----- 1 oracle asmadmin 10485883 Oct 18 12:35 log_246.xml
-rw-r----- 1 oracle asmadmin 10485793 Oct 18 22:00 log_247.xml
-rw-r----- 1 oracle asmadmin 10485964 Oct 19 07:28 log_248.xml
-rw-r----- 1 oracle asmadmin 10486018 Oct 19 16:56 log_249.xml
-rw-r----- 1 oracle asmadmin 10485935 Oct 20 02:22 log_250.xml
-rw-r----- 1 oracle asmadmin 10486117 Oct 20 11:47 log_251.xml
-rw-r----- 1 oracle asmadmin 10485802 Oct 20 21:15 log_252.xml
-rw-r----- 1 oracle asmadmin 10485801 Oct 21 06:44 log_253.xml
-rw-r----- 1 oracle asmadmin 10486078 Oct 21 16:11 log_254.xml
-rw-r----- 1 oracle asmadmin 10485771 Oct 22 01:39 log_255.xml
-rw-r----- 1 oracle asmadmin 10485850 Oct 22 11:08 log_256.xml
-rw-r----- 1 oracle asmadmin 10486064 Oct 22 20:35 log_257.xml
-rw-r----- 1 oracle asmadmin 10486135 Oct 23 06:01 log_258.xml
-rw-r----- 1 oracle asmadmin 10485845 Oct 23 15:27 log_259.xml
-rw-r----- 1 oracle asmadmin 10485768 Oct 24 00:56 log_260.xml
-rw-r----- 1 oracle asmadmin 10485821 Oct 24 10:23 log_261.xml
-rw-r----- 1 oracle asmadmin 10486102 Oct 24 19:49 log_262.xml
-rw-r----- 1 oracle asmadmin 10486166 Oct 25 05:18 log_263.xml
-rw-r----- 1 oracle asmadmin 10485830 Dec 22 13:50 log_264.xml
-rw-r----- 1 oracle asmadmin  4378328 Jan 29 14:04 log.xml

find /u01/app/oracle/diag/rdbms/testdb/testdb/alert -type f -mtime +3 -exec rm -f {} \; -exec printf "." \;
......................................................................................................................................................[oracle@testdb alert]$
[oracle@testdb alert]$ ls -lrt
total 4300
-rw-r----- 1 oracle asmadmin 4398534 Jan 29 14:05 log.xml

Thursday, September 14, 2017

How to use vi editor in SQL PLUS

Here I'll show you how to use vi editor in SQL PLUS, It is very easy and comfortable when working with SQLPLUS and writing scripts.
vi is a screen-oriented text editor originally created for the Unix operating system.

Tempororay define editor in session level

SQL> define_editor=vi
SQL> select * from duall;
select * from duall
              *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> ed
Wrote file afiedt.buf

  1* select * from dual
SQL> /

D
-
X

SQL>

To make permanent above settings for SQLPLUS utility you need to define it in $ORACLE_HOME/sqlplus/admin/glogin.sql and it will be effective for all session with sqlplus.

vi $ORACLE_HOME/sqlplus/admin/glogin.sql
define _editor='vi'

Thursday, July 27, 2017

Textual description of firstImageUrl

Create RPM packages local repository for Oracle Enterprise Linux 7.0 on Virtual Machine

In this blog post I''ll show you how to create local RPM packages repository for Oracle Enterprise Linux 7.0. Let's start.
First of all we need connected Linux 7.0 ISO, go to the machine setting and check connected checkbox, under ISO image file choose Linux 7.0 installation file as shown below



















with root user
mkdir -p /mnt/cdrom
mount -t iso9660 -o ro /dev/sr0 /mnt/cdrom

mkdir -p /repo
cd /mnt/cdrom/Packages
cp * /repo/

cd /repo
rpm -Uvh deltarpm-3.6-3.el7.x86_64.rpm
rpm -Uvh python-deltarpm-3.6-3.el7.x86_64.rpm
rpm -Uvh createrepo-0.9.9-23.el7.noarch.rpm

createrepo .
Spawning worker 0 with 4292 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

mv /etc/yum.repos.d/public-yum-ol7.repo /etc/yum.repos.d/public-yum-ol7.repo.bkp
create rhel_repo.repo file under /etc/yum.repos.d/ and write next parameters
vi /etc/yum.repos.d/rhel_repo.repo

[rhel_repo]
name=repo
baseurl="file:///repo/"
gpgcheck=0
enabled=1
now you can check local repository
yum repolist
Loaded plugins: langpacks
rhel_repo                                                                                                                                                                     | 2.9 kB  00:00:00
rhel_repo/primary_db                                                                                                                                                          | 3.8 MB  00:00:00
repo id                                                                                           repo name                                                                                    status
rhel_repo                                                                                         repo                                                                                         4,292
repolist: 4,292

that's all now you have local RPM packages repository for Oracle Enterprise Linux 7.0

Monday, May 15, 2017

CRS-4124: Oracle High Availability Services startup failed - ohasd failed to start: Inappropriate ioctl for device on Linux 6

During Automatic storage Management (ASM) installation occurred error
CRS-4124: Oracle High Availability Services startup failed 
ohasd failed to start: Inappropriate ioctl for device
Environment : 
OS : CentOS release 6.7
Grid : Oracle Grid Infrastructure 11g Release 2 (11.2.0.1.0) for Linux x86
This happened because in Linux 6 is not supported Oracle 11g Release 2 (11.2.0.1.0) 
Solution :  Here I''ll show you how to solve this problem.
1) open $GRID_HOME/crs/install/s_crsconfig_lib.pm file
2)Add the following lines before the # Start OHASD
my $UPSTART_OHASD_SERVICE = "oracle-ohasd";
my $INITCTL = "/sbin/initctl";

($status, @output) = system_cmd_capture ("$INITCTL start $UPSTART_OHASD_SERVICE");
if (0 != $status)
{
error ("Failed to start $UPSTART_OHASD_SERVICE, error: $!");
return $FAILED;
}
# Start OHASD
vi s_crsconfig_lib.pm
/Start OHASD  --- for search string in vi
3) create file with /etc/init/oracle-ohasd.conf file with below entries
# Oracle OHASD start
start on runlevel [35]
stop on runlevel [!35]
respawn
exec /etc/init.d/init.ohasd run >/dev/null 2>&1
4) De configuration of Oracle Restart stack with root user : 
[root@testdb install]# cd $GRID_HOME/crs/install/
[root@testdb install]# ./roothas.pl -deconfig -force -verbose
Checking for super user privileges
User has super user privileges
Parsing the host name
Using configuration parameter file: ./crsconfig_params
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4000: Command Delete failed, or completed with errors.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed 
resources on 'testdb'
CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'testdb'
CRS-2673: Attempting to stop 'ora.evmd' on 'testdb'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'testdb'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'testdb'
CRS-2677: Stop of 'ora.cssdmonitor' on 'testdb' succeeded
CRS-2677: Stop of 'ora.evmd' on 'testdb' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'testdb' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'testdb'
CRS-2677: Stop of 'ora.mdnsd' on 'testdb' succeeded
CRS-2677: Stop of 'ora.gipcd' on 'testdb' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources 
on 'testdb' has completed
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle Restart stack
5) run again root.sh script with root user and make overwrite "Y"

[root@testdb ~]# cd $GRID_HOME/
[root@testdb 11.2.0]# ./root.sh
................
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
...............

That's all OHASD service started and working.

Thursday, April 2, 2015

ASM is not working after change hostname

On my test environment I changed hostname of Linux machine and after restart ASM did not start.
environment:
OS : Oracle Linux 6.5
DB : Oracle database 11g(11.2.0.3)

so let's simulate changing hostname and see results:
[root@oel6 ~]# hostname
oel6
[root@oel6 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=testdb
[root@oel6 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.220.128 testdb

[root@oel6 ~]# reboot

our hostname changed after restart we can check it and try to start ASM instance.
old hostname --- oel6 new hostname --- testdb
[root@testdb ~]# hostname
testdb
su - grid
-bash-4.1$ srvctl start asm
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd

sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 2 14:05:38 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup;
ORA-01078: failure in processing system parameters
ORA-29701: unable to connect to Cluster Synchronization Service

Solution:
ok, ASM will not start because we need to reconfigure HAS(High Availability Service).
with root user go to $GRID_HOME/crs/install and run roothas.pl script for deconfiguration.
cd /u01/app/grid/product/11.2.0/grid/crs/install/
./roothas.pl -deconfig -force

Using configuration parameter file: ./crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
Successfully deconfigured Oracle Restart stack

with root user go to $GRID_HOME/crs/install directory and run the roothas.pl script for reconfiguration
./roothas.pl

Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node testdb successfully pinned.
Adding Clusterware entries to upstart

testdb     2015/04/02 14:29:27     
/u01/app/grid/product/11.2.0/grid/cdata/testdb/backup_20150402_142927.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

with grid user Register and start the resources
crsctl start resource ora.cssd
CRS-2672: Attempting to start 'ora.cssd' on 'testdb'
CRS-2672: Attempting to start 'ora.diskmon' on 'testdb'
CRS-2676: Start of 'ora.diskmon' on 'testdb' succeeded
CRS-2676: Start of 'ora.cssd' on 'testdb' succeeded

now we can add the listener as a resource and after that we can start it
srvctl add listener -l LISTENER
srvctl start listener
srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): testdb

now we can add the asm we do not need to create spfile for asm. we can use the one before.
if you haven't spfile you can simple create pfile and then create spfile from this pfile for example create pfile - init+ASM.ora in $GRID_HOME/dbs with parameters:
instance_type=ASM
asm_diskstring='/dev/oracleasm/disks/DATA01'
asm_diskgroups='DG01'

sqlplus / as sysasm
SQL> startup pfile=init+ASM.ora;
SQL> create spfile='+DG01' from pfile='init+ASM.ora';
SQL> shutdown immediate;

with grid user
srvctl add asm -l LISTENER -p "/u01/app/grid/product/11.2.0/grid/dbs/init+ASM.ora"
srvctl start asm
srvctl status asm
ASM is running on testdb

at last we can add database
srvctl add database -d testdb -o /u01/app/oracle/product/11.2.0/dbhome_1 -p 
+DG01/spfiletestdb.ora -r PRIMARY -s open -t immediate -a "DG01"
srvctl start database -d testdb
srvctl status database -d testdb
Database is running.

that's all, now we have new hostname and asm is up and running.
srvctl status asm
ASM is running on testdb

Monday, March 2, 2015

Enterprise Manager - perl: warning: Setting locale failed, LC_ALL =(unset)

Today we faced warnings when starting agent of enterprise manager grid control.
emctl start agent

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = "en_GB:en",
 LC_ALL = (unset),
 LANG = "en_GB"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").


check your locale settings by type locale
solution is very simple in the .bash_profile add LC_ALL="en_GB.utf8" :
locale
.........
.........
vi .bash_profile
export LC_ALL="en_GB.utf8"

Thursday, September 25, 2014

ORA-21561: OID generation failed

when creating database with dbca, shown error : ORA-21561: OID generation failed.

SOLUTION:

problem is most likely machine hosts file. check if there is written host ip and hostname, if this is missing then write it.

with root user:
# vi /etc/hosts

machine_ip      hostname


re-run dbca and you will see that above error is disappeared.
that's all.

Wednesday, July 30, 2014

Terminal too wide in Unix (solaris)

When you are working in an UNIX shell using Putty or other tool, you may get this error.
crontab -e
Terminal too wide

Enter the below command in the shell and try to open crontab again.
stty columns 120

I hope it will help you.

Thursday, July 17, 2014

Configure FTP server on Linux and create user to access only his home directory

Now i'll show you how to configure ftp server on oracle linux 5.5 and create user, which can access only his home directory for using ftp, let start.
first we need to install rpm package which is on linux disc. you can mount disk and install package
vsftpd-2.0.5-16.el5_4.1 with command:
rpm -Uvh vsftpd-2.0.5-16.el5_4.1.rpm

after that we need to start ftp server with command:
service vsftpd start

now our ftp server is running.
let's create user ftpdump which can access only his home directory for file transfer.
mkdir -p /ftp
groupadd ftpdump
useradd –s /bin/bash –d /ftp –g ftpdump ftpdump
passwd ftpdump
chown -R ftpdump:ftpdump /ftp
chmod -R 777 /ftp 

for limit user ftpdump to access only his home directory open vsftpd.conf and add next parameters:
vi /etc/vsftpd/vsftpd.conf

chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot.list

Then add each user you want to lock to their home directory to the chroot.
I want that ftpdump user access only his home dir, hence i added it in chroot.list
vi /etc/vsftpd/chroot.list

ftpdump


now we can make test, connect ftp with user ftpdump and try to change directory.
C:\Users\user>ftp #.#.#.#
Connected to #.#.#.#.
220 (vsFTPd 2.0.5)
User (#.#.#.#:(none)): ftpdump
331 Please specify the password.
Password:
230 Login successful.
ftp> pwd
257 "/"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
test.t
226 Directory send OK.
ftp: 111 bytes received in 0.00Seconds 111000.00Kbytes/sec.
ftp> pwd
257 "/"
ftp> cd /u01
550 Failed to change directory.
ftp>

that's all, good luck.

Tuesday, March 11, 2014

Duplicate database from ASM to non ASM Database using RMAN

Operating system --- Oracle Linux 6
Database --- 11G R2
Today i show you how to duplicate database which is in ASM to non ASM on different host.
Target --- database with ASM which is used to create another database on another host.
Destination --- database which located on file system will be created from target.

For duplication there is two method: from backup and from active database, here is described active database duplication.

On destination already installed Oracle Software.
1) transfer password file from target to destination.
2) on destination register listener with static registration.
3) on Target, create pfile, transfer it to destination host and modify next parameters:
*.audit_file_dest =/u01/app/oracle/testdup/adump
*.db_name ="testdup"
*.instance_name =testdup
*.control_files =/u01/app/oracle/testdup/control01.ctl
*.db_file_name_convert =("+DATA","/u01/app/oracle/testdup")
*.log_file_name_convert =("+DATA","/u01/app/oracle/testdup")
*.undo_management =AUTO
*.undo_tablespace='UNDOTBS1'
*.db_block_size=8192

4) on destination, create corresponding directories with oracle O/S user.
5) export new sid and start instance;
export ORACLE_SID=testdup
sqlplus / as sysdba
startup nomount pfile=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/inittestdup.ora;

6) on destination:
rman target sys/password@orcl auxiliary sys/password@testdup
duplicate database to testdup from active database;


Possible Errors:
You can get some errors , cann't restore datafile & onlineredo log files, in this case you need to create directory ,It should be indicate.
testdup/datafile
testdup/onlinelog


That's all, good luck.

Tuesday, February 4, 2014

Automatically start oracle database on linux after server reboot

Here I'll show you how to configure system for automatically start oracle database after server reboot.
oracle database 11g --- Oracle Linux 6.3
First of all, you need to make sure that any database instances you want to auto start are set to "Y" in the /etc/oratab file
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u0/app/oracle/product/11.2.0/dbhome_1:Y

Oracle 11g includes 2 scripts which can be used to start or shut down Oracle databases on Linux. Both scripts are in $ORACLE_HOME/bin and called dbstart and dbshut. We can add some more actions for example start enterprise manager if we create our scripts. Let's make two scripts db_start.sh and db_stop.sh
vi /u0/app/oracle/db_start.sh
# script to start the Oracle database, listener and dbconsole
. ~/.bash_profile
# start the listener and the database
$ORACLE_HOME/bin/dbstart $ORACLE_HOME
# start the Enterprise Manager db console
$ORACLE_HOME/bin/emctl start dbconsole
exit 0

vi /u0/app/oracle/db_stop.sh
# script to stop the Oracle database, listener and dbconsole
. ~/.bash_profile
# stop the Enterprise Manager db console
$ORACLE_HOME/bin/emctl stop dbconsole
# stop the listener and the database
$ORACLE_HOME/bin/dbshut $ORACLE_HOME
exit 0

inside script we are calling the .bash_profile file of the user "oracle" for export environment variables, we need it for $ORACLE_HOME.
give execute right:
chmod u+x db_start.sh db_stop.sh
With user root, create a file called "oracle" under /etc/init.d
vi /etc/init.d/oracle
ORA_OWNER=oracle
RETVAL=0
 
case "$1" in
    'start')
        # Start the Oracle databases:
        su - $ORA_OWNER -c "/u0/app/oracle/db_start.sh"
        touch /var/lock/subsys/oracle
        ;;
    'stop')
        # Stop the Oracle databases:
        su - $ORA_OWNER -c "/u0/app/oracle/db_stop.sh"
        rm -f /var/lock/subsys/oracle
        ;;
    *)
        echo $"Usage: $0 {start|stop}"
        RETVAL=1
esac
exit $RETVAL

change permission for /etc/init.d/oracle file:
chmod 750 /etc/init.d/oracle
to create service of this script:
chkconfig --add oracle

and now we can start and stop database with:
service oracle stop
service oracle start

Now it's time to test our automatically startup procedure, for this reboot your server and check if your database starts automatically after reboot.

Wednesday, November 13, 2013

Xlib: No protocol specified

It can be frustrating when you try to start xwindow application using Xming XServer on Windows XP/7/Vista but encountering connection refused error. Here is an example of the error:
[oracle@oel5 /]$ dbca
Xlib: connection to "192.168.0.100:0.0" refused by server
Xlib: No protocol specified

Here is a quick tip to fix this issue:
In Windows, look for the shortcut to start Xming. Right click your mouse to go to properties.
add -ac to your XMing shortcut:
"C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow -ac

The -ac parameter allows everyone to connect.
restart Xming and try again.

Wednesday, March 20, 2013

Change network device name from eth1 back to eth0 in RHEL6

The interface name of a network device increases if the mac address of the physical or virtual network card changes. A common case is if you made a clone of a virtual machine for example via VMware or replaced a physical network card in a non virtualized server.

If it’s a RHEL 6 machine you need to change 2 files to rename the interface for example from eth1 back to eth0.

One file is the udev rule for network devices which is located here:
/etc/udev/rules.d/70-persistent-net.rules

Copy the new mac address to the line of your eth0 rule and delete the new rule for eth1.
# PCI device 0x15ad:0x07b0 (vmxnet3)
    SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:b2:23:e0″, 
    ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

Modify the network configuration located under:
/etc/sysconfig/network-scripts/ifcfg-eth0

and replace the old ip with the new one and the old mac address with the new mac address, after that restart network service.
# service network restart


To be sure everything works fine reboot your machine.

Monday, March 18, 2013

How to Change the Hostname of a Linux System

Normally we will set the hostname of a system during the installation process. but if we need to change hostname what can we do?

On any Linux system you can change its hostname with the command
hostname new_name.
[oracle@oel6 ~]$ hostname
oel6
[oracle@oel6 ~]$ hostname aaa
hostname: you must be root to change the host name
[oracle@oel6 ~]$ su - 
Password: 
[root@oel6 ~]# hostname aaa
[root@oel6 ~]# hostname
aaa

This new name will be until the system rebooted. To permanent change in Red Hat base systems we need to change hostname in /etc/sysconfig/network file.
[root@oel6 ~]# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=oel6


and change hostname in file.

that's all.

Wednesday, March 13, 2013

Bug: /dev/shm does not use /etc/fstab attributes after reboot in RHEL 6

There is a bug in Red Hat Linux 6 and Oracle Enterprise Linux 6 (UEK and RHEL-kernel).
When you need more memory for SGA/PGA when using MEMORY_MAX_TARGET, you need to resize /dev/shm. By default this is 50% of total memory and Oracle tells you to add the following to /etc/fstab:
tmpfs    /dev/shm     tmpfs   defaults,size=3G  0 0

This works after a remount:
mount -o remount /dev/shm

but it doesn’t work after a reboot.
Fix:
add
mount -o remount /dev/shm

in /etc/rc.d/rc.sysinit file at the end and /dev/shm will have attributes from /etc/fstab after reboot.

Tuesday, January 29, 2013

ORA-00845: MEMORY_TARGET not supported on this system

SQL> startup nomount;
ORA-00845: MEMORY_TARGET not supported on this system

This error comes up because we tried to use the Automatic Memory Management (AMM) feature of Oracle 11g R2. But it seems that your shared memory filesystem (shmfs) is not big enough.
[oracle@oel6 ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_oel6-lv_root
                       43G   15G   26G  37% /
tmpfs                1001M  212M  789M  22% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
.host:/               245G  126G  119G  52% /mnt/hgfs

We can change the size of that filesystem by issuing the following command:
mount -t tmpfs shmfs -o size=2g /dev/shm

The shared memory file system should be big enough to accommodate the MEMORY_TARGET and MEMORY_MAX_TARGET values, or Oracle will throw the ORA-00845 error. Note that when changing something with the mount command, the changes are not permanent.
To make the change persistent, edit your /etc/fstab file
tmpfs                   /dev/shm                tmpfs   defaults,size=2G         0 0

Now go and enjoy your automatically managed memory configuration!

Friday, January 25, 2013

Textual description of firstImageUrl

Increase disk size in Oracle Linux on VMware

In this post I'll show you how to extend disk size in oracle linux on vmware.

First of all our vmware guest operating system must be in shutdown mode.
we need to add hard disk to our box.
go to settings--->





click add, then choose hard disk.
check option use an existing virtual disk




































then choose file which will expand.



































add a new hard disk, go to settings and choose our disk, click utilities--expand and write new size.



































power on virtual machine.

our guest system doesn't see a new size



































but fdisk shows  the new size


































solution :
create new partition on /dev/sda
































then,
[root@oel6 ~]# pvcreate /dev/sda3
  Writing physical volume data to disk "/dev/sda3"
  Physical volume "/dev/sda3" successfully created
[root@oel6 ~]# vgextend vg_oel6 /dev/sda3
  Volume group "vg_oel6" successfully extended
[root@oel6 ~]# lvextend -L +18G /dev/vg_oel6/lv_root /dev/sda3  
  Extending logical volume lv_root to 43.60 GiB
  Logical volume lv_root successfully resized
[root@oel6 ~]# resize2fs /dev/mapper/vg_oel6-lv_root 43G
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_oel6-lv_root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/mapper/vg_oel6-lv_root to 11272192 (4k) blocks.
The filesystem on /dev/mapper/vg_oel6-lv_root is now 11272192 blocks long.

check size :



































it's all, enjoy with new size :)

Friday, January 18, 2013

How To Resize /dev/shm Filesystem In Linux?

1) Open /etc/fstab with vi or any text editor of your choice
2) Locate the line of /dev/shm and use the tmpfs size option to specify your expected size

e.g.
tmpfs /dev/shm tmpfs defaults,size=1500m 0 0

or

e.g

tmpfs /dev/shm tmpfs defaults,size=2g 0 0

3) To make change effective immediately, run this mount command to remount the /dev/shm filesystem:

mount -o remount /dev/shm

that's all.
thank.

Friday, July 20, 2012

Textual description of firstImageUrl

Instead bash-3.2$ hostname, username in linux console for oracle user















if oracle user home is /u0/app/oracle then:

cd /u0/app/oracle
gedit .bashrc
and insert: PS1="[\\u@\\h:\\w] $ "; export PS1;

logout
login

















that's all, I hope it will be helpful for you.