1、首先要检查服务器环境是否符合安装需求:

grep MemTotal /proc/meminfo

grep SwapTotal /proc/meminfo

df -h /tmp

df -h /dev/shm

free -g

uname -m


Swap空间要求:Between 1 GB and 2 GB: 1.5 times the size of the RAM ;Between 2 GB and 16 GB: Equal to the size of the RAM ;More than 16 GB: 16 GB。

Note: If you enable HugePages for your Linux servers,

then you should deduct the memory allocated to

HugePages from the available RAM before calculating

swap space.


/tmp空间要求大于1G。


2、安装依赖的包:

yum install -y bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make smartmontools sysstat




3、创建用户组和用户并配置环境变量:

groupadd oinstall

groupadd dba

groupadd asmdba

groupadd backupdba

groupadd dgdba

groupadd kmdba

groupadd racdba

groupadd oper


useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper -m oracle



[root@FreeLab ~]# su - oracle

[oracle@FreeLab ~~]$ vi .bash_profile

# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi


# User specific environment and startup programs


PATH=$PATH:$HOME/.local/bin:$HOME/bin


export PATH


export ORACLE_BASE=/orcldb/oracle

export ORACLE_HOME=/orcldb/oracle/product/19.3.0

export PATH=$PATH:$ORACLE_HOME/bin:/usr/local/bin

export ORACLE_HOSTNAME=sqlauditdb

export ORACLE_SID=sqlaudit

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/network/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib



[root@host-173-16-87-178 ~]#



4、添加主机和IP映射:

[root@FreeLab ~]# cat /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

FreeLab 192.168.17.135


5、配置系统内核参数:

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 1200000000

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576


添加到/etc/sysctl.conf中,然后执行sysctl -p生效


6、修改用户限制文件:

vim /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240


修改/etc/pam.d/login文件,添加: 


session required /lib64/security/pam_limits.so

session required pam_limits.so


7、创建安装目录:

mkdir -p /u01/app/oraInventory

mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1

chown -R oracle: /u01/app/oraInventory

chown -R oracle: /u01/app/oracle

su - oracle

mkdir ora_pack

unzip 安装包.zip -d ora_pack

解压一定要解压到ORACLE_HOME下,否则汇报以上错误。


unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME


会把包解压展开在指定目录:

[root@FreeLab ora_pack]# ls

addnode crs dbjava dmu hs jdbc md olap ords plsql rdbms runInstaller sqlj ucp

apex css dbs drdaas install jdk mgw OPatch oss precomp relnotes schagent.conf sqlpatch usm

assistants ctx deinstall dv instantclient jlib network opmn oui QOpatch root.sh sdk sqlplus utl

bin cv demo env.ora inventory ldap nls oracore owm R root.sh.old slax srvm wwg

clone data diagnostics has javavm lib odbc ord perl racg root.sh.old.1 sqldeveloper suptools xdk

[root@FreeLab ora_pack]# pwd

/tmp/ora_pack





8、关闭SELINUX和防火墙:

[root@FreeLab ~]# cat /etc/selinux/config ---设置SELINUX为disabled


# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=disabled

... ...




systemctl status firewalld.service

systemctl stop firewalld.service

systemctl status firewalld.service

systemctl disable firewalld.service


[root@FreeLab ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor>

Active: active (running) since Sun 2020-09-27 05:24:18 PDT; 52min ago

Docs: man:firewalld(1)

Main PID: 943 (firewalld)

Tasks: 2 (limit: 4853)

Memory: 17.6M

CGroup: /system.slice/firewalld.service

└─943 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork>


Sep 27 05:24:15 FreeLab systemd[1]: Starting firewalld - dynamic firewall dae>

Sep 27 05:24:18 FreeLab systemd[1]: Started firewalld - dynamic firewall daem>

Sep 27 05:24:18 FreeLab firewalld[943]: WARNING: AllowZoneDrifting is enabled>


[root@FreeLab ~]# systemctl stop firewalld.service

[root@FreeLab ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor>

Active: inactive (dead) since Sun 2020-09-27 06:16:54 PDT; 3s ago

Docs: man:firewalld(1)

Process: 943 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS>

Main PID: 943 (code=exited, status=0/SUCCESS)


Sep 27 05:24:15 FreeLab systemd[1]: Starting firewalld - dynamic firewall dae>

Sep 27 05:24:18 FreeLab systemd[1]: Started firewalld - dynamic firewall daem>

Sep 27 05:24:18 FreeLab firewalld[943]: WARNING: AllowZoneDrifting is enabled>

Sep 27 06:16:53 FreeLab systemd[1]: Stopping firewalld - dynamic firewall dae>

Sep 27 06:16:54 FreeLab systemd[1]: Stopped firewalld - dynamic firewall daem>


[root@FreeLab ~]# systemctl disabled firewalld

Unknown operation disabled.

[root@FreeLab ~]# systemctl disable firewalld

Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.


9、修改用户环境变量:

su - oracle

vi .bash_profile


export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/19.3.0

export PATH=$PATH:$ORACLE_HOME/bin:/usr/local/bin

export ORACLE_HOSTNAME=FreeLab

export ORACLE_SID=musicdb

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/network/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib




10、文件赋权:

用root 执行:chmod 755 /bin/systemctl


否则安装过程中会报如下错误:

INFO: [Mar 7, 2020 11:41:04 AM] ERROR: [Result.addErrorDescription:771] PRVG-2043 : Command "/bin/systemctl get-default" failed on node "zbglxtdb" and produced th

e following output:

sh: /bin/systemctl: Permission denied



7、配置响应文件:

进入到安装包所在的路径:


cd /tmp/ora_pack/install/response

[oracle@FreeLab response]$ ls

db_install.rsp

[oracle@FreeLab response]$ cp db_install.rsp db_install.rsp.bak



在文件后面追加内容:

oracle.install.option=INSTALL_DB_SWONLY

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

ORACLE_HOME=/u01/app/oracle/product/19.3.0

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.OSDBA_GROUP=dba

oracle.install.db.OSOPER_GROUP=oper

oracle.install.db.OSBACKUPDBA_GROUP=backupdba

oracle.install.db.OSDGDBA_GROUP=dgdba

oracle.install.db.OSKMDBA_GROUP=kmdba

oracle.install.db.OSRACDBA_GROUP=racdba

oracle.install.db.rootconfig.executeRootScript=false



8、开始静默安装:

[oracle@FreeLab 19.3.0]$ ./runInstaller -silent -responseFile /u01/app/oracle/product/19.3.0/install/response/db_install.rsp

Launching Oracle Database Setup Wizard...


[WARNING] [INS-32047] The location (/u01/app/oraInventory) specified for the central inventory is not empty.

ACTION: It is recommended to provide an empty location for the inventory.

[WARNING] [INS-13014] Target environment does not meet some optional requirements.

CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2020-09-27_08-02-44AM.log

ACTION: Identify the list of failed prerequisite checks from the log: installActions2020-09-27_08-02-44AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.

The response file for this session can be found at:

/u01/app/oracle/product/19.3.0/install/response/db_2020-09-27_08-02-44AM.rsp


You can find the log of this install session at:

/tmp/InstallActions2020-09-27_08-02-44AM/installActions2020-09-27_08-02-44AM.log








As a root user, execute the following script(s):

1. /u01/app/oraInventory/orainstRoot.sh

2. /u01/app/oracle/product/19.3.0/root.sh


Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:

[FreeLab]

Execute /u01/app/oracle/product/19.3.0/root.sh on the following nodes:

[FreeLab]



Successfully Setup Software with warning(s).

Moved the install session logs to:

/u01/app/oraInventory/logs/InstallActions2020-09-27_08-02-44AM



按照要求用root用户执行两个脚本:

[root@FreeLab /]# /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.


Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete.

[root@FreeLab /]# /u01/app/oracle/product/19.3.0/root.sh

Check /u01/app/oracle/product/19.3.0/install/root_FreeLab_2020-09-27_08-08-24-542778136.log for the output of root script

[root@FreeLab /]# cat /u01/app/oracle/product/19.3.0/install/root_FreeLab_2020-09-27_08-08-24-542778136.log

Performing root user operation.


The following environment variables are set as:

ORACLE_OWNER= oracle

ORACLE_HOME= /u01/app/oracle/product/19.3.0

Copying dbhome to /usr/local/bin ...

Copying oraenv to /usr/local/bin ...

Copying coraenv to /usr/local/bin ...



Creating /etc/oratab file...

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.

Oracle Trace File Analyzer (TFA) is available at : /u01/app/oracle/product/19.3.0/bin/tfactl



静默配置监听:

使用默认模板即可:

[oracle@FreeLab ~]$ netca -silent -responsefile /u01/app/oracle/product/19.3.0/assistants/netca/netca.rsp


Parsing command line arguments:

Parameter "silent" = true

Parameter "responsefile" = /u01/app/oracle/product/19.3.0/assistants/netca/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.



Oracle Net Listener Startup:

Running Listener Control:

/u01/app/oracle/product/19.3.0/bin/lsnrctl start LISTENER

Listener Control complete.

Listener started successfully.

Listener configuration complete.

Oracle Net Services configuration successful. The exit code is 0




查看监听是否已经正常启动:

[oracle@FreeLab ~]$ lsnrctl status


LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 27-SEP-2020 08:16:32


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=FreeLab)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Start Date 27-SEP-2020 08:15:31

Uptime 0 days 0 hr. 1 min. 6 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/19.3.0/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/FreeLab/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=FreeLab.localdomain)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

The listener supports no services

The command completed successfully




静默创建数据库:

[oracle@FreeLab ~]$ cd /u01/app/oracle/product/19.3.0/assistants/dbca/

cp dbca.rsp dbca.rsp.bak


将以下内容追加到dbca.rsp中:

gdbName=musicdb

sid=musicdb

databaseConfigType=SI

templateName=General_Purpose.dbc

sysPassword=“jackson”

systemPassword=“jackson”

emConfiguration=DBEXPRESS

dbsnmpPassword=“password”

datafileDestination=/u01/app/oracle/oradata

characterSet=AL32UTF8

totalMemory=2048



开始创建:

[oracle@FreeLab dbca]$ dbca -silent -createDatabase -responseFile /u01/app/oracle/product/19.3.0/assistants/dbca/dbca.rsp

[WARNING] [DBT-11207] Specified SGA size is greater than the shmmax on the system. The database creation might fail with "ORA-27125 - Unable to create shared memory segment error".

ACTION: Specify SGA size lesser than or equal to the shmmax on the system.

[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.

CAUSE:

a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].

b.The password entered is a keyword that Oracle does not recommend to be used as password

ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.

[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.

CAUSE:

a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].

b.The password entered is a keyword that Oracle does not recommend to be used as password

ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.

Prepare for db operation

10% complete

Copying database files

40% complete

Creating and starting Oracle instance

42% complete

46% complete

50% complete

54% complete

60% complete

Completing Database Creation

66% complete

70% complete

Executing Post Configuration Actions

100% complete

Database creation complete. For details check the logfiles at:

/u01/app/oracle/cfgtoollogs/dbca/musicdb.

Database Information:

Global Database Name:musicdb

System Identifier(SID):musicdb

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/musicdb/musicdb.log" for further details.







SGA相关的 [DBT-11207]报错可以忽略,很多场景会出现此报错,但是安装成功,出现此类报错后,可在安装完成后看一下是否可以正常连接数据库即可。最保险的方法就是设置的跟 shmmax相同。



验证安装是否成功:

[oracle@FreeLab dbca]$ sqlplus / as sysdba


SQL*Plus: Release 19.0.0.0.0 - Production on Sun Sep 27 08:36:04 2020

Version 19.3.0.0.0


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



Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> show parameter sga


NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

allow_group_access_to_sga boolean FALSE

lock_sga boolean FALSE

pre_page_sga boolean TRUE

sga_max_size big integer 1536M

sga_min_size big integer 0

sga_target big integer 1536M

unified_audit_sga_queue_size integer 1048576

SQL> show parameter name


NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

cdb_cluster_name string

cell_offloadgroup_name string

db_file_name_convert string

db_name string musicdb

db_unique_name string musicdb

global_names boolean FALSE

instance_name string musicdb

lock_name_space string

log_file_name_convert string

pdb_file_name_convert string

processor_group_name string


NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

service_names string musicdb

SQL> select open_mode from v$database;


OPEN_MODE

--------------------

READ WRITE



[oracle@FreeLab dbca]$ ps -ef|grep smon

oracle 63018 1 0 08:34 ? 00:00:00 ora_smon_musicdb

oracle 64383 53789 0 08:37 pts/0 00:00:00 grep --color=auto smon





PS:响应文件模板存放的位置:

软件/u01/app/oracle/product/19.3.0/install/response/db_install.rsp

监听/u01/app/oracle/product/19.3.0/assistants/netca/netca.rsp

建库/u01/app/oracle/product/19.3.0/assistants/dbca/dbca.rsp








01-05 05:55