CentOS 8.5 installing Oracle 19c

This article installs Oracle 19c for Centos8

1, Update yum source (under root user)

Before installing, it is recommended to update the yum source: yum update -y
Or dnf update

2, Installation related dependencies (under root user)

yum install -y binutils* compat-libstdc* elfutils-libelf* gcc* glibc* ksh* libaio* libgcc* libstdc* make* sysstat* libXp*  glibc-kernheaders ksh binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel

When the installation dependency reports an error, manually install the next one from the following website and re execute the above statement.
Compat libstdc + ± 33 download link

3, Install Oracle preparation environment (preinstall file) (under root user)

This step is used to install oracle's pre installed package on rhel8. You can automatically pre install various files and configure environment variables through yum, saving a lot of manual operations

Oracle database preinstall file download link

① Check whether there are oracle users. The normal return is shown in the figure below:

id oracle


② Installation file

① yum localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
 Errors are reported as follows:
#Last metadata expiration check: 0:50:00 ago on Sat 27 Nov 2021 02:01:00 AM EST.
#Error: 
# Problem: conflicting requests
#  - nothing provides compat-libcap1 needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
#(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate #packages)

② yum install  oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
#After the above statement is complete d, the installation is not successful. It can be verified by Oracle ID.

Use the following words:
③ sudo rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
#If the following error is prompted, execute the following ④ statement first, and then execute this statement again
#warning: oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID #ec551f03: NOKEY
#error: Failed dependencies:
#        compat-libcap1 is needed by oracle-database-preinstall-19c-1.0-1.el7.x86_64
④ curl -o http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm

The effect of successful installation needs to be verified by id oracle, as shown in the following figure:

4, Install Oracle database service (under root user)

Oracle download address

yum install oracle-database-ee-19c-1.0-1.x86_64.rpm

This step is not difficult, and the results are as follows:

Then verify whether the installation is really successful, as shown in the following figure:

Modify the oracle user password and use the following statement. The effect is as follows:

passwd oracle

5, Configuring environment variables for Oracle users

#Note: the environment variable of oracle user is configured, because all future operations are performed under oracle user, not root user
#So the following modification is oracle/.bash_profile
vim /home/oracle/.bash_profile

#Add the following:
export ORACLE_HOSTNAME=bogon      --- linux Server host name,Is your host name. You can use it hostname Command view
export ORACLE_UNQNAME=ORCLCDB      --- Set to database instance name (modified according to the established database)
export ORACLE_SID=ORCLCDB      --- Database instance name (this is recommended for modification according to the established database)
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export ORACLE_INVENTORY=$ORACLE_BASE/oraInventory
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8    --- sqlplus The code required for operation shall be consistent with the database code

So far, the database software has been installed. Yes, the software has been installed and the database has not been created.

6, Create database

There are generally two ways to install the database:
1. Graphical interface installation (using dbca)
2. Silent installation

Silent installation can be done through / opt/oracle/product/19c/dbhome_1/assistants/dbca/dbca.rsp can be configured and installed, or created with the default configuration provided by 19c. The following describes how to create with the default configuration:

#Run the following command under root: 
/etc/init.d/oracledb_ORCLCDB-19c configure 

The operation is shown in the figure below, and the error is reported. The solutions are shown below:

Above error reporting solution

#Use the following command to view the host name#Ensure that step 5 configures Oracle of environment variables for Oracle users_ The value of hostname is consistent with the value of the following command
hostname

#Use the following command to find the location of the listener.ora file
find / -name listener.ora

#Modify the HOST value in the listener.ora file to your HOST name, as follows
#LISTENER =
#  (ADDRESS_LIST=
#       (ADDRESS=(PROTOCOL=tcp)(HOST=bogon)(PORT=1521))
#       (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))

#Use the following command to increase the hostname mapping
vim /etc/hosts
#The added contents are as follows:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.3.170 bogon #I added this line, which is ipv4 address + space + hostname
#Then the installation can be successful again.

The installation is successful again, as follows:

Verify that the installation is successful, as shown in the following figure:
Under oracle user, execute lsnrctl stop
Then execute dbstart to start the database.

Log in to the database as a super administrator (sysdba) using the sqlplus command:

 sqlplus / as sysdba
 #Next, a line of SQL > will appear, and then press enter after entering the following command. If non error data appears, the database installation is successful.
 select username from dba_users;

7, Set startup to automatically start the database service

After oracle is installed, it does not start with startup by default. It needs to be set by itself. The following is the setting method:

1.Modify file: 
vim /etc/oratab
#Add ORCLCDB:/opt/oracle/product/19c/dbhome_1: N is changed to: ORCLCDB:/opt/oracle/product/19c/dbhome_1: Y

2.modify centos System startup script: 
vim /etc/rc.d/rc.local
 Add the following two lines at the end:
su oracle -lc "/opt/oracle/product/19c/dbhome_1/bin/lsnrctl start"  #lsnrctl start 
su oracle -lc /opt/oracle/product/19c/dbhome_1/bin/dbstart  #Start database

3.modify centos System startup script permissions: 
chmod +x /etc/rc.d/rc.local

4,Restart the server and verify whether it is successful. You can view it oracle Process by: 
ps -ef | grep ora_

8, CentOS 8 installation precautions

1. In the command window sqlplus, the input direction key and fallback key will become garbled, and rlwrap-0.43-5.el8.x86 needs to be installed_ 64.rpm

yum  install rlwrap-0.43-5.el8.x86_64.rpm

2. The data queried by sql is garbled in Chinese
In step 3 above, configure the NLS file_ Lang can be configured according to the database code by querying: select userenv('language ') from dual;

3. The validity period of database user password is 180 days by default. It is recommended to change it to indefinite
– query the validity period of database user password, and you can see that the default is 180 days

SELECT  * FROM dba_profiles s Where s.profile = 'DEFAULT' AND resource_name = 'PASSWORD_LIFE_TIME' ;

-- Change to never expire
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED ;

4. If CentOS 8 turns on the firewall, you also need to turn off the firewall or add a listening port. The added ports are as follows:

firewall-cmd --zone=public --permanent --add-port=1521/tcp
firewall-cmd --zone=public --permanent --add-port=5500/tcp

Reference link

Tags: Database Oracle server

Posted on Sun, 28 Nov 2021 04:23:15 -0500 by JParishy