Oracle

Install oracle 18C redhat centos vmware on laptop SQL DBA 10 steps

Advertisements

Being a database administrator you have asked to take support of other databases as well like Oracle, noSQL, Cloud PaaS and IaaS etc. In Indian service based company, we need attest more than one database knowledge and support experience to lead a database team as well.

I have been working in IT more than 12 years and had supported Oracle not in top level and it was older days and I thought of writing lot once, I have strong working experience, but I did not get much after that. I just started again quarantine time, let us install 18c and do some test ourselves.

 

Take a reference of old post: https://sqlserverblogforum.com/oracle/

From Oracle 18C onwards oracle made the pre-requesting are very easy, the mandatory one is we need to copy and unzip the database software in the oracle home $ORACLE_HOME.

How to Install Linux on VMware workstation

Install VMware work station

On the OS part — install OS later option– 40 GB disk size VM
–Store virtual machine in single file– Click customize HDD–edit the VM and mount the ISO
Power ON–Skip installation No –Choose custom layout
Create four mandatory file system for Linux oracle
(/ -10 GB, /boot – 500MB, /tmp – 5GB, swap -5 GB & /opt) – Desktop or server class, connect IP automatically etc.

Oracle_RH_mountPoint.
Oracle mount Point

Followings are the task we are going to perform:

  1. Install and build VMware workstation in your laptop
  2. Build new VM by installing CentOS or Linux
  3. Copy the DB software and install DB binaries
  4. Create a oracle database
  5. Create a listener
  6. Connect the database by putty and SQL developer
  7. Configure oracle enterprise manager OEM

Step 1

–Disable firewall and selinux

systemctl status firewalld
service firewalld stop
service firewalld start
systemctl disable firewalld
systemctl enable firewalld

vi /etc/selinux/config
SELINUX=disabled

Step 2
–create OS group and user

groupadd -g 1100 oinstall
groupadd -g 1131 dba
groupadd -g 1132 oper
useradd -u 1101 -g oinstall -G dba,oper oracle

passwd oracle

–create directories

mkdir -p /opt/app/oracle/product/18.4.0/dbhome_1
chown -R oracle:oinstall /opt
chmod -R 775 /opt
rm -rf /opt/app/oracle/product/18.4.0/
–change host name

vi /etc/hosts
vi /etc/hostname

192.168.110.132 muthu.localdomain muthu

restart the host

Step 3

We need to run the two RPM – oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm & oracle-database-xe-18c-1.0-1.x86_64.rpm, this will install all the pre-requesting RPMs, you can directly download from internet like what I did (OR) download in your local and transfer by WinSCP.

# curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
# curl -o oracle-database-xe-18c-1.0-1.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-xe-18c-1.0-1.x86_64.rpm
# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
# yum -y localinstall oracle-database-xe-18c-1.0-1.x86_64.rpm

yum -y install gcc-c++.x86_64 *

yum repolist
yum list

 

/*
–Install RPM by manual or using YUM, if needed (Not required)

— find the version of OS

cat /etc/redhat-release

— You can do the RPM install by yum or manually from iso/dvd or from internet by redhat
mount /dev/sr0 /mnt
cd /etc/yum.repos.d
–Create a file
vi CentOS7_7.repo


[InstallMedia]
name=CentOS 7.7
gpgcheck=0
baseurl=file:///mnt/
enabled=1

yum clean all
*/

Step 4

su – oracle

$ vi .bash_profile

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=muthu.localdomain; export ORACLE_HOSTNAME
ORACLE_BASE=/opt/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/18.4.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=testdb; export ORACLE_SID
ORACLE_UNQNAME=testdb; export ORACLE_UNQNAME
ORACLE_TERM=xterm; export ORACLE_TERM
BASE_PATH=/usr/sbin:$PATH; export BASE_PATH
PATH=$ORACLE_HOME/bin:$GRID_HOME/bin:$BASE_PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

Step 5
———–Configure VNC
rpm -qa | grep -i vnc

yum install tigervnc-server

vi /etc/sysconfig/vncservers

VNCSERVERS=”2:root” VNCSERVERARGS[2]=”-geometry 1280×1024 -nolisten tcp -localhost”
VNCSERVERS=”1:oracle” VNCSERVERARGS[1]=”-geometry 1280×1024″

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vi /etc/systemd/system/vncserver@:1.service

–Change the user name two places <USER>

firewall-cmd –permanent –zone=public –add-service vnc-server
firewall-cmd –reload

su – oracle
vncserver
exit

— To clear the unused entry of vnc
rm -rf /tmp/.X1-lock
rm -rf /tmp/.X11-unix/X2

systemctl daemon-reload
systemctl enable vncserver@:1.service
reboot
systemctl stop vncserver@:1.service
systemctl start vncserver@:1.service
systemctl status vncserver@:1.service

–Go to VNC GUI
IP:1
— now try from vnc client
192.168.110.132:1

–find os bit 32 or 64 bit
lscpu

Step 6

–The binaries must be unziped in oracle home from 18C onwards
copy the software to oracle home
echo $ORACLE_HOME
cd $ORACLE_HOME
unzip LINUX.X64_180000_db_home.zip
ls

go to ORACLE_HOME directory

cd $ORACLE_HOME
and run ./runInstaller

[oracle@localhost dbhome_1]$ ./runInstaller
./runInstaller: line 67: perl/bin/perl cannot execute binary file

software only install
run two scripts as root
/opt/app/oraInventory/orainstRoot.sh
/opt/app/oracle/product/18.4.0/dbhome_1/root.sh — enter and enter

Step 7

Run dbca to create database

$ dbca
Type password and SID
Next — next create pluggable if needed.

Step 8

Connect database

[oracle@muthu ~]$ sqlplus ‘/ as sysdba’

SQL*Plus: Release 18.0.0.0.0 – Production on Thu May 28 04:53:13 2020
Version 18.3.0.0.0

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

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 – Production
Version 18.3.0.0.0

SQL> select name from v$database;

NAME

TESTDB

SQL> select name, cdb, con_id from v$database;
SQL> select NAME, OPEN_MODE from v$pdbs;

Step 9

Configure listener and tnsname.ora

$ netca

lsnrctl status

change the hostname
$ hostname
vi $ORACLE_HOME/network/admin/listener.ora

vi $ORACLE_HOME/network/admin/tnsnames.ora

TESTDB=
(description=
(address_list=
(address = (protocol = TCP)(host = muthu.localdomain)(port = 1521))
)
(connect_data =
(service_name=testdb)
)
)

lsnrctl start

[oracle@muthu admin]$ lsnrctl start

LSNRCTL for Linux: Version 18.0.0.0.0 – Production on 28-MAY-2020 05:12:10

Copyright (c) 1991, 2018, Oracle. All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@muthu admin]$ lsnrctl status

LSNRCTL for Linux: Version 18.0.0.0.0 – Production on 28-MAY-2020 05:12:23

Copyright (c) 1991, 2018, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=muthu.localdomain)(PORT=1521)))
STATUS of the LISTENER

Alias LISTENER
Version TNSLSNR for Linux: Version 18.0.0.0.0 – Production
Start Date 28-MAY-2020 05:06:49
Uptime 0 days 0 hr. 5 min. 34 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/app/oracle/product/18.4.0/dbhome_1/network/admin/listener.ora
Listener Log File /opt/app/oracle/diag/tnslsnr/muthu/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=muthu.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@muthu admin]$ sqlplus ‘/ as sysdba’

SQL*Plus: Release 18.0.0.0.0 – Production on Thu May 28 05:13:05 2020
Version 18.3.0.0.0

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

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 1962931152 bytes
Fixed Size 8897488 bytes
Variable Size 1224736768 bytes
Database Buffers 721420288 bytes
Redo Buffers 7876608 bytes
Database mounted.
Database opened.
SQL>

Step 10

Enable oracle enterprise manager

select NAME, OPEN_MODE from v$pdbs;
alter session set container=PDB01;
SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);
SQL> exec DBMS_XDB_CONFIG.SETHTTPPORT(5510);

firewall-cmd –add-port=5500/tcp

Happy learning!

How to connect Oracle database in real time:

You will have a domain account and you need to sudo with oracle.

Example: Server name is SVR_ORA_DB01

  1. Connect by putty SVR_ORA_DB01 (Enter domain credential)
  2. Sudo su – oracle
  3. ps -ef|grep pmon
  4. sqlplus “/as sysdba”

You can find sid and DBname in cat /etc/oratab. You can change or switch to connect different databases by . oraenv

Ex: . oraenv (Type the Db name and enter)

I’m currently working as a SQL server DBA in one of the top MNC. I’m passionate about SQL Server And I’m specialized in Administration and Performance tuning. I’m an active member of SQL server Central and MSDN forum. I also write articles in SQL server Central. For more Click here

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 60 = 63