暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片

Oracle19c单机安装(静默)

原创 逸晨 2023-06-28
893


操作系统centos7.9
内存10G
处理器4
硬盘100G
Oracle19c压缩包LINUX.X64_193000_db_home.zip
下载地址https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#db_ee

1、安装所需依赖

yum install -y unzip compat-libcap1 compat-libstdc++-33 gcc-c++ ksh libaio-devel libstdc++-devel elfutils-libelf-devel fontconfig-devel libXrender-devel rlwrap


2、创建用户和组

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


3、修改Linux相关内核参数

vi /etc/sysctl.conf


net.ipv4.conf.all.accept_redirects = 0

net.ipv4.conf.default.accept_redirects = 0

net.ipv4.conf.all.send_redirects = 0

net.ipv4.conf.all.secure_redirects = 0

net.ipv4.tcp_max_syn_backlog = 4096

net.ipv4.tcp_keepalive_time = 150

net.ipv4.tcp_keepalive_probes = 5

net.ipv4.tcp_keepalive_intvl = 6

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 16451328

kernel.shmmax = 33692319744

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


wq!    //保存

sysctl -p //生效


vi /etc/security/limits.conf


oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 32768

oracle soft memlock 262144000

oracle hard memlock 262144000

4、关闭防火墙和selinux

systemctl stop firewalld

systemctl disable firewalld

systemctl status firewalld



vi /etc/selinux/config


# 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

# SELINUXTYPE= can take one of three values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted


5、创建安装目录

mkdir -p /data/u01/app/oracle/product/19c/dbhome_1

mkdir -p /data/u01/app/oraInventory

chown -R oracle:oinstall /data/u01

6、解压

压缩包上传到/data目录下

[root@oracle19c ~]# cd /data/

[root@oracle19c data]# unzip LINUX.X64_193000_db_home.zip -d /data/u01/app/oracle/product/19c/dbhome_1/

[root@oracle19c data]# chown -R oracle:oinstall /data/u01/

7、设置环境变量

[root@oracle19c ~]# vi /home/oracle/.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_SID=orcl19c

export ORACLE_HOSTNAME=`hostname -s`

export ORACLE_BASE=/data/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1

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

#export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"export TMP=/tmp

export TMPDIR=$TMP

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$HOME/.local/bin:$HOME/bin:$PATH

export EDITOR=vi

export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin

export SQLPATH=$ORACLE_HOME/sqlplus/admin

#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" --AL32UTF8 SELECT userenv('LANGUAGE') db_NLS_LANG FROM DUAL;export NLS_LANG="AMERICAN_CHINA.ZHS16GBK"

#alias sqlplus='rlwrap sqlplus'

#alias rman='rlwrap rman'

#alias asmcmd='rlwrap asmcmd'


wq!    //保存

source /home/oracle/.bash_profile    //生效

8、安装oracle数据库

#切换到oracle用户下操作

[root@oracle19c ~]# su - oracle

Last login: Tue Jun 27 10:03:02 CST 2023 on pts/0

[oracle@oracle19c ~]$ /data/u01/app/oracle/product/19c/dbhome_1/runInstaller -silent -force -noconfig -ignorePrereq \

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 \

oracle.install.option=INSTALL_DB_SWONLY \

UNIX_GROUP_NAME=oinstall \

INVENTORY_LOCATION=/data/u01/app/oraInventory \

ORACLE_BASE=/data/u01/app/oracle \

ORACLE_HOME=/data/u01/app/oracle/product/19c/dbhome_1 \

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=true \

oracle.install.db.rootconfig.configMethod=ROOT     //以上为安装命令


Launching Oracle Database Setup Wizard...

 

 

 Enter password for 'root' user:      //输入root密码

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

   CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2023-06-20_02-49-51PM.log

   ACTION: Identify the list of failed prerequisite checks from the log: installActions2023-06-20_02-49-51PM.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:

 /data/u01/app/oracle/product/19c/dbhome_1/install/response/db_2023-06-20_02-49-51PM.rsp

 

You can find the log of this install session at:

 /tmp/InstallActions2023-06-20_02-49-51PM/installActions2023-06-20_02-49-51PM.log

Successfully Setup Software with warning(s).

Moved the install session logs to:

 /data/u01/app/oraInventory/logs/InstallActions2023-06-20_02-49-51PM

9、创建实例

创建实例时需要8G的空余内存

[oracle@oracle19c ~]$ free -g  

[oracle@oracle19c ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \

-gdbname orcl19c -sid orcl19c \

-createAsContainerDatabase TRUE \

-numberOfPDBs 1 \

-pdbName orclpdb2 \

-pdbAdminPassword oracle12334 \

-sysPassword oracle12334 -systemPassword oracle12334 \

-datafileDestination '/data/u01/app/oracle/oradata' \

-recoveryAreaDestination '/data/u01/app/oracle/flash_recovery_area' \

-redoLogFileSize 50 \

-storageType FS \

-characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \

-sampleSchema true \

-totalMemory 8192 \

-databaseType OLTP \

-emConfiguration NONE

10、配置监听

[oracle@oracle19c ~]$ vi /data/u01/app/oracle/product/19c/dbhome_1/network/admin/listener.ora


SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = orclpdb2)

      (SID_NAME = orcl19c)

    )

   (SID_DESC =

      (GLOBAL_DBNAME = gzpdb1)

      (SID_NAME = orcl19c)

   )

   (SID_DESC =

      (GLOBAL_DBNAME = ynpdb1)

      (SID_NAME = orcl19c)

 

   )

   (SID_DESC =

      (GLOBAL_DBNAME = tstpdb)

      (SID_NAME = orcl19c)

   )

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle19c )(PORT = 1521))

    )

  )   //HOST修改成自己的主机名或IP

ADR_BASE_LISTENER = /data1/u01/app/oracle

11、启动监听

[oracle@oracle19c ~]$ lsnrctl start


LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 27-JUN-2023 10:03:32

 

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

 

Starting /data/u01/app/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 19.0.0.0.0 - Production

System parameter file is /data/u01/app/oracle/product/19c/dbhome_1/network/admin/listener.ora

Log messages written to /data/u01/app/oracle/product/19c/dbhome_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle19c)(PORT=1521)))

 

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

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Start Date                27-JUN-2023 10:03:32

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /data/u01/app/oracle/product/19c/dbhome_1/network/admin/listener.ora

Listener Log File         /data/u01/app/oracle/product/19c/dbhome_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle19c)(PORT=1521)))

Services Summary...

Service "gzpdb1" has 1 instance(s).

  Instance "orcl19c", status UNKNOWN, has 1 handler(s) for this service...

Service "orclpdb2" has 1 instance(s).

  Instance "orcl19c", status UNKNOWN, has 1 handler(s) for this service...

Service "tstpdb" has 1 instance(s).

  Instance "orcl19c", status UNKNOWN, has 1 handler(s) for this service...

Service "ynpdb1" has 1 instance(s).

  Instance "orcl19c", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully


12、启动数据库

[oracle@oracle19c ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 27 10:03:39 2023

Version 19.3.0.0.0

 

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

 

Connected to an idle instance.

 

SQL> startup

ORACLE instance started.

 

Total System Global Area 6878654480 bytes

Fixed Size                  9150480 bytes

Variable Size            1191182336 bytes

Database Buffers         5670699008 bytes

Redo Buffers                7622656 bytes

Database mounted.

Database opened.

SQL> show pdbs;

 

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 ORCLPDB2                       MOUNTED

SQL> 

ps:提前配置好hosts的ip和name映射

[root@oracle19c ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 

192.168.32.129 oracle19c

安装完成

最后修改时间:2023-06-28 15:21:58
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论