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

Centos7.9 静默安装 Oracle19C 单实例

原创 vic 2024-01-12
553

一 、 Oracle19c 软件下载

(一) 配置yum源(可连接互联网环境)

#互联网访问环境配置YUM源 ##bash源 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum clean all && yum makecache yum install wget net-tools* lrzsz* vim zip unzip -y ##epel源 wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo yum clean all && yum makecache

点击进入下载界面

image.png

(二) 上传安装文件

#创建目录 mkdir /data && cd /data #上传文件 rz -y [root@localhost data]# ls LINUX.X64_193000_db_home.zip

二 、 基础环境配置

#1、swap内存配置(为内存的2倍) [root@localhost data]# free -m total used free shared buff/cache available Mem: 3789 266 119 8 3403 3255 Swap: 3967 0 3967 ##配置虚拟内存 ###禁用交换空间: 在进行扩容之前,建议先禁用交换空间,如果是在扩容的前提下 sudo swapoff /swapfile ###更改交换文件大小: #### 使用dd命令更改交换文件的大小。假设您要将交换空间扩展到8G sudo dd if=/dev/zero of=/swapfile bs=1G count=8 ####设置交换文件格式: sudo mkswap /swapfile ####启用交换空间 sudo swapon /swapfile #### 更新fatab文件 echo "/swapfile none swap sw 0 0" >>/etc/fstab mount -a #################################################################### [root@localhost data]# mkswap /swapfile Setting up swapspace version 1, size = 8388604 KiB no label, UUID=fd2e9826-0914-434a-967f-a79809185701 [root@localhost data]# swapon /swapfile swapon: /swapfile: insecure permissions 0644, 0600 suggested. [root@localhost data]# echo "/swapfile none swap sw 0 0" >>/etc/fstab [root@localhost data]# mount -a [root@localhost data]# free -m total used free shared buff/cache available Mem: 3789 263 1177 8 2348 3268 Swap: 12159 0 12159 #################################################################### 2、更改主机名以及添加hosts(db1/110) ###设置主机名 hostnamectl set-hostname db1 echo "db1" >/etc/hostname ###添加hosts echo "10.0.2.15 db1">>/etc/hosts 3、设置用户打开文件句柄(DB1和DB2都执行): ###编辑 /etc/security/limits.conf 文件 cat >> /etc/security/limits.conf << "EOF" oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 EOF #################################################################### cat >> /etc/profile << "EOF" if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi EOF 4、修改内核参数 cat >> /etc/sysctl.conf << "EOF" fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 EOF 5、创建用户和组 groupadd -g 5001 dba groupadd -g 5002 asmdba groupadd -g 5003 backupdba groupadd -g 5004 dgdba groupadd -g 5005 kmdba groupadd -g 5006 racdba groupadd -g 5007 oper groupadd -g 5008 oinstall /usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle 6、创建ORACLE工作目录 mkdir -p /u01/app/oracle/{oraInventory,product/19.3.0/db} chown -R oracle:oinstall /u01/ chmod -R 775 /u01 7、配置ORACLE环境变量 #####DB1-MASTER vi /home/oracle/.bash_profile ###添加下面内容 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db export ORACLE_SID=db1 export ORA_INVENTORY=/u01/app/oraInventory export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin source /home/oracle/.bash_profile

三 、 安装

(一) 安装依赖包

yum install -y oracle-database-preinstall-19c binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libnsl libnsl.i686 libnsl.x86_64 libnsl2 libnsl2.i686 libnsl2.x86_64 libstdc++ libstdc++-devel libXi libXtst make sysstat java-1.8.0-openjdk* yum update kmod-libs kmod -y

(二) 包解压

cd /u01/app/oracle/product/19.3.0/db mv /data/LINUX.X64_193000_db_home.zip ./ unzip LINUX.X64_193000_db_home.zip chown -R oracle:oinstall ../db/ chmod -R +x ../db/

(三) 静默安装

[root@localhost db]# su - oracle Last login: Fri Jan 12 01:08:00 EST 2024 on pts/0 [oracle@db1 ~]$ cd $ORACLE_HOME [oracle@db1 db]$ [oracle@db1 db]$ ./runInstaller -ignorePrereq -waitforcompletion -silent -responseFile ${ORACLE_HOME}/install/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=${ORACLE_HOSTNAME} UNIX_GROUP_NAME=oinstall IN VENTORY_LOCATION=${ORA_INVENTORY} SELECTED_LANGUAGES=en,en_GB ORACLE_HOME=${ORACLE_HOME} ORACLE_BASE=${ORACLE_BASE} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.OSRACDBA_GROUP=dba SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true ###以下为安装过程 Launching Oracle Database Setup Wizard... [WARNING] [INS-13014] Target environment does not meet some optional requirements. CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2024-01-12_01-15-25AM.log ACTION: Identify the list of failed prerequisite checks from the log: installActions2024-01-12_01-15-25AM.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/db/install/response/db_2024-01-12_01-15-25AM.rsp You can find the log of this install session at: /tmp/InstallActions2024-01-12_01-15-25AM/installActions2024-01-12_01-15-25AM.log As a root user, execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/19.3.0/db/root.sh Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes: [db1] Execute /u01/app/oracle/product/19.3.0/db/root.sh on the following nodes: [db1] Successfully Setup Software with warning(s). Moved the install session logs to: /u01/app/oraInventory/logs/InstallActions2024-01-12_01-15-25AM ##执行脚本,脚本为oraInventory 以及安装 Oracle 数据库软件权限 [oracle@db1 db]$ exit logout [root@localhost db]# /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@localhost db]# /u01/app/oracle/product/19.3.0/db/root.sh Check /u01/app/oracle/product/19.3.0/db/install/root_db1_2024-01-12_01-22-22-066352301.log for the output of root script

(四) 配置监听

##配置 Oracle Net Services,包括监听器(listener)的配置。 [oracle@db1 db]$ netca -silent -responseFile $ORACLE_HOME/assistants/netca/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /u01/app/oracle/product/19.3.0/db/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/db/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 ###查看网络状态 [oracle@db1 db]$ lsnrctl status LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 12-JAN-2024 01:40:34 Copyright (c) 1991, 2019, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 12-JAN-2024 01:38:05 Uptime 0 days 0 hr. 2 min. 29 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19.3.0/db/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/db1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully

image.png

四、 创建库实例

#添加环境变量 ##数据目录 export ORADATADIR=/data ##归档日志路径 export ARCHIVEDIR=/data/archivelog ## 数据库字符集 export CHARACTERSET=AL32UTF8 ## 国家字符集 export NCHARACTERSET=AL16UTF16 ## 数据库内存这里取物理内存的 50% export memTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') export totalMemory=$((memTotal / 2048)) ## 是否为 CDB 模式,TRUE 或者 FALSE export ISCDB=TRUE [oracle@db1 db]$ source /home/oracle/.bash_profile #数据目录授权 chown -R oracle:oinstall /data/db1 chmod -R 775 /data #静默创建数据库 [oracle@db1 db]$ dbca -silent -createDatabase -ignorePrereqFailure -templateName General_Purpose.dbc -responseFile NO_VALUE -gdbName ${ORACLE_SID} -sid ${ORACLE_SID} -sysPassword oracle@2024 -systemPassword oracle@2024 -redoLogFileSize 1024 -storageType FS -databaseConfigType SINGLE -datafileDestination ${ORADATADIR} -enableArchive true -archiveLogDest ${ARCHIVEDIR} -characterset ${CHARACTERSET} -nationalCharacterSet ${NCHARACTERSET} -emConfiguration NONE -automaticMemoryManagement false -totalMemory ${totalMemory} -databaseType OLTP -createAsContainerDatabase ${ISCDB} ##以下是安装过程 [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 69% complete 70% complete Executing Post Configuration Actions 100% complete Database creation complete. For details check the logfiles at: /u01/app/oracle/cfgtoollogs/dbca/db1. Database Information: Global Database Name:db1 System Identifier(SID):db1 Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/db1/db10.log" for further details.
  • 查看
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cdb_cluster_name string cell_offloadgroup_name string db_file_name_convert string db_name string db1 db_unique_name string db1 global_names boolean FALSE instance_name string db1 lock_name_space string log_file_name_convert string pdb_file_name_convert string processor_group_name string NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ service_names string db1 SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO
最后修改时间:2024-01-26 09:52:29
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论