前言
上一篇文章中使用图形化方式安装Oracle 21c,这一篇文章中使用静默方式安装Oracle 19c
官方文档
https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/index.html
主机规划
查看操作系统
[root@forest ~]# cat /etc/os-release NAME="Oracle Linux Server" VERSION="7.9" ID="ol" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="7.9" PRETTY_NAME="Oracle Linux Server 7.9" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:oracle:linux:7:9:server" HOME_URL="https://linux.oracle.com/" BUG_REPORT_URL="https://bugzilla.oracle.com/" ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7" ORACLE_BUGZILLA_PRODUCT_VERSION=7.9 ORACLE_SUPPORT_PRODUCT="Oracle Linux" ORACLE_SUPPORT_PRODUCT_VERSION=7.9
查看磁盘分区
[root@forest ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 4.5G 0 rom vda 251:0 0 500G 0 disk ├─vda2 251:2 0 499.8G 0 part │ ├─ol_forest-swap 252:1 0 16G 0 lvm [SWAP] │ ├─ol_forest-tmp 252:2 0 8G 0 lvm /tmp │ ├─ol_forest-root 252:0 0 100G 0 lvm / │ └─ol_forest-u01 252:3 0 375.8G 0 lvm /u01 └─vda1 251:1 0 200M 0 part /boot [root@forest ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 32G 0 32G 0% /dev tmpfs tmpfs 32G 41M 32G 1% /dev/shm tmpfs tmpfs 32G 8.7M 32G 1% /run tmpfs tmpfs 32G 0 32G 0% /sys/fs/cgroup /dev/mapper/ol_forest-root xfs 100G 30G 70G 31% / /dev/mapper/ol_forest-u01 xfs 376G 44G 333G 12% /u01 /dev/mapper/ol_forest-tmp xfs 8.0G 1.1G 7.0G 13% /tmp /dev/vda1 xfs 197M 167M 31M 85% /boot tmpfs tmpfs 6.3G 0 6.3G 0% /run/user/0
关闭防火墙并禁止开机自启动
[root@forest ~]# systemctl stop firewalld [root@forest ~]# systemctl disable firewalld
禁用selinux
临时生效 [root@forest ~]# setenforce 0 修改配置文件重启后生效 [root@forest ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
修改hosts配置文件
[root@forest ~]# vim /etc/hosts 192.168.255.219 forest forest.oracle.com 测试 [root@forest ~]# ping forest -c 2 [root@forest ~]# ping forest.oracle.com -c 2
创建用户和组
1、创建组 [root@forest ~]# /usr/sbin/groupadd -g 54321 oinstall [root@forest ~]# /usr/sbin/groupadd -g 54322 dba [root@forest ~]# /usr/sbin/groupadd -g 54323 oper [root@forest ~]# /usr/sbin/groupadd -g 54324 backupdba [root@forest ~]# /usr/sbin/groupadd -g 54325 dgdba [root@forest ~]# /usr/sbin/groupadd -g 54326 kmdba [root@forest ~]# /usr/sbin/groupadd -g 54330 racdba 2、创建oracle用户,主组oinstall,附加组dba,oper,backupdba,dgdba,kmdba,racdba [root@forest ~]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle 3、设置oracle密码 [root@forest ~]# /usr/sbin/useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle [root@forest ~]# echo "oracle" | passwd --stdin oracle Changing password for user oracle. passwd: all authentication tokens updated successfully. [root@forest ~]# id oracle uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
安装yum依赖包
参考官方文档,安装yum依赖包 [root@forest ~]# yum install bc binutils compat-openssl10 elfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXi libXtst libgcc libnsl libstdc++ libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat
创建目录并修改权限
[root@forest ~]# mkdir -p /u01/app/oracle [root@forest ~]# mkdir -p /u01/app/oraInventory [root@forest ~]# chown -R oracle:oinstall /u01/app/oracle [root@forest ~]# chown -R oracle:oinstall /u01/app/oraInventory [root@forest ~]# chmod -R 775 /u01/app
调整系统内核参数
#kernel.shmmax 表示单个共享内存段的最大字节 #kernel.shmall 表示可以在系统范围内使用的共享内存总量(页为单位) #kernel.shmmni 用于设置系统范围内共享内存段的最大数量 #kernel.shmmax=kernel.shmall*kernel.shmmni #fs.aio-max-nr 表示同时可以拥有的异步IO请求数量 #fs.file-max 表示系统级别能够打开的文件句柄的数量 #net.ipv4.ip_local_port_range 表示端口范围 #net.core.rmem_default 表示接收套接字缓冲区大小默认值 #net.core.rmem_max 表示接收套接字缓冲区大小最大值 #net.core.wmem_default 表示发送套接字缓冲区大小默认值 # net.core.wmem_max 表示发送套接字缓冲区大小最大值 [root@forest ~]# vi /etc/sysctl.d/99-sysctl.conf 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 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 fs.aio-max-nr = 1048576 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 使参数生效 [root@forest ~]# sysctl -p
调整系统资源参数
[root@forest ~]# vim /etc/security/limits.conf oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 134217728 oracle soft memlock 134217728 oracle soft data unlimited oracle hard data unlimited
调整用户访问资源参数
[root@forest ~]# vim /etc/pam.d/login session required pam_limits.so
设置透明大页
官方文档建议关闭透明大页,将该参数的值设为never [root@forest ~]# sed -i 's/quiet/quiet transparent_hugepage=never/' /etc/default/grub 使参数生效 [root@forest ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... done
关闭numa
[root@forest ~]# sed -i 's/quiet/quiet transparent_hugepage=never numa=off/' /etc/default/grub 使参数生效 [root@forest ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... done
上传数据库软件并创建ORACLE_HOME目录
1、上传数据库软件 E:\BaiduNetdiskDownload>scp LINUX.X64_193000_db_home.zip root@192.168.255.219:~ [root@forest ~]# ll -h LINUX.X64_193000_db_home.zip -rw-r--r--. 1 root root 2.9G Oct 21 16:30 LINUX.X64_193000_db_home.zip 2、创建ORACLE_HOME目录 [root@forest ~]# mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1 3、需要解压到ORACLE_HOME目录执行runInstaller,否则会提示报错 [root@forest ~]# unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/dbhome_1 4、修改ORACLE_HOME目录的属组 [root@forest ~]# chown -R oracle:oinstall /u01/app/oracle [root@forest ~]# ll -hd /u01/app/oracle/product/19.3.0/dbhome_1/ drwxr-xr-x. 63 oracle oinstall 4.0K Oct 21 16:40 /u01/app/oracle/product/21.3.0/dbhome_1/
runInstaller静默安装数据库软件
1、查看runInstaller图形化安装生成的响应文件 [oracle@forest ~]$ egrep -v '^#|^$' runInstaller.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory 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 oracle.install.db.rootconfig.configMethod= oracle.install.db.rootconfig.sudoPath= oracle.install.db.rootconfig.sudoUserName= oracle.install.db.CLUSTER_NODES= oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName= oracle.install.db.config.starterdb.SID= oracle.install.db.ConfigureAsContainerDB=false oracle.install.db.config.PDBName= oracle.install.db.config.starterdb.characterSet= oracle.install.db.config.starterdb.memoryOption=false oracle.install.db.config.starterdb.memoryLimit= oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.password.ALL= oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.DBSNMP= oracle.install.db.config.starterdb.password.PDBADMIN= oracle.install.db.config.starterdb.managementOption=DEFAULT oracle.install.db.config.starterdb.omsHost= oracle.install.db.config.starterdb.omsPort=0 oracle.install.db.config.starterdb.emAdminUser= oracle.install.db.config.starterdb.emAdminPassword= oracle.install.db.config.starterdb.enableRecovery=false oracle.install.db.config.starterdb.storageType= oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= 2、查看runInstaller帮助命令 [oracle@forest ~]$ /u01/app/oracle/product/19.3.0/dbhome_1/runInstaller -help Usage: runInstaller [<flag>] [<option>] Following are the possible flags: -help - display help. -silent - run in silent mode. The inputs can be a response file or a list of command line variable value pairs. [-ignorePrereqFailure - ignore all prerequisite checks failures.] -responseFile - specify the complete path of the response file to use. -logLevel - enable the log of messages up to the priority level provided in this argument. Valid options are: severe, warning, info, config, fine, finer, finest. -executePrereqs | -executeConfigTools | -createGoldImage -executePrereqs - execute the prerequisite checks only. -executeConfigTools - execute the config tools for an installed home. -createGoldImage - create a gold image from the current Oracle home. -destinationLocation - specify the complete path to where the created gold image will be located. [-exclFiles - specify the complete paths to the files to be excluded from the new gold image.] -debug - run in debug mode. -printdiskusage - log the debug information for the disk usage. -printmemory - log the debug information for the memory usage. -printtime - log the debug information for the time usage. -waitForCompletion - wait for the completion of the installation, instead of spawning the installer and returning the console prompt. -noconfig - do not execute the config tools. -noconsole - suppress the display of messages in the console. The console is not allocated. -ignoreInternalDriverError - ignore any internal driver errors. -noCopy - perform the configuration without copying the software on to the remote nodes. -applyRU - apply release update to the Oracle home. -applyOneOffs - apply one-off patch to the Oracle home. Multiple one-off patches can be passed as a comma separated list of locations. 3、执行runInstaller [oracle@forest ~]$ /u01/app/oracle/product/19.3.0/dbhome_1/runInstaller -silent -responseFile /home/oracle/runInstaller.rsp Launching Oracle Database Setup Wizard... The response file for this session can be found at: /u01/app/oracle/product/19.3.0/dbhome_1/install/response/db_2024-10-21_04-43-52PM.rsp You can find the log of this install session at: /u01/app/oraInventory/logs/InstallActions2024-10-21_04-43-52PM/installActions2024-10-21_04-43-52PM.log As a root user, execute the following script(s): 1. /u01/app/oracle/product/19.3.0/dbhome_1/root.sh Execute /u01/app/oracle/product/19.3.0/dbhome_1/root.sh on the following nodes: [forest] Successfully Setup Software. 4、使用root用户执行两个脚本 [root@forest ~]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. [root@forest ~]# /u01/app/oracle/product/19.3.0/dbhome_1/root.sh Check /u01/app/oracle/product/19.3.0/dbhome_1/install/root_forest.oracle.com_2024-10-21_16-47-21-093565531.log for the output of root script [root@forest ~]# more /u01/app/oracle/product/19.3.0/dbhome_1/install/root_forest.oracle.com_2024-10-21_16-47-21-093565531.log Performing root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/19.3.0/dbhome_1 Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... 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/dbhome_1/bin/tfactl
dbca静默创建数据库
1、查看dbca图形化创建数据库生成的响应文件
[oracle@forest ~]$ more dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=forest.oracle.com
sid=FOREST
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=2
pdbName=FORESTPDB
useLocalUndoForPDBs=true
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/19.3.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword=
serviceUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=FALSE
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination=
storageType=FS
diskGroupName=
asmsnmpPassword=
[oracle@forest ~]$ more dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=forest.oracle.com
sid=FOREST
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=false
createServerPool=false
serverPoolName=
cardinality=
force=false
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=2
pdbName=FORESTPDB
useLocalUndoForPDBs=true
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/19.3.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword=
serviceUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=FALSE
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=false
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination=
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=
variablesFile=
variables=ORACLE_BASE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1,DB_UNIQUE_NAME=forest,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=forest.oracle.com,ORACL
E_HOME=/u01/app/oracle/product/19.3.0/dbhome_1,SID=FOREST
initParams=undo_tablespace=UNDOTBS1,sga_target=33239MB,db_block_size=8192BYTES,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=FORESTXDB),diagnostic_dest={ORAC
LE_BASE},control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control02.ctl"),remote_login_passwordfile=EXCLUSI
VE,audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,processes=1280,pga_aggregate_target=11413MB,nls_territory=AMERICA,local_listener=LISTENER_FOREST,open_curso
rs=300,compatible=19.0.0,db_name=forest,audit_trail=db
sampleSchema=false
memoryPercentage=40
databaseType=MULTIPURPOSE
automaticMemoryManagement=false
totalMemory=0
2、查看dbca帮助命令
[oracle@forest ~]$ dbca -help
Usage: dbca [<flag>] [<command> <option>]
Following are the possible flags:
-help
-contextId <RAC | SI>
-ignorePreReqs - Ignore prerequisite checks for current operation.
-ignorePrereqFailure - Ignore all prerequisites failures.
-silent - This flag allows you to carry on configuration in silent mode.
-<command>
Following are the possible commands:
-addInstance - Command to Add an instance to an admin managed cluster database.
-configureDatabase - Command to Configure a database.
-configurePluggableDatabase - Command to Configure a pluggable database.
-createCloneTemplate - Command to Create a clone template from an existing database.
-createDatabase - Command to Create a database.
-createDuplicateDB - Command to Duplicate a database.
-createPluggableDatabase - Command to Create a pluggable database.
-createTemplateFromDB - Command to Create a template from an existing database.
-createTemplateFromTemplate - Command to Create a template from an existing template.
-deleteDatabase - Command to Delete a database.
-deleteInstance - Command to Delete an instance from an admin managed cluster database.
-deletePluggableDatabase - Command to Delete a pluggable database.
-deleteTemplate - Command to delete a template.
-executePrereqs - Command to execute prerequisite checks.
-generateScripts - Command to Generate scripts which can be used to create database.
-relocatePDB - Command to Relocate a pluggable database.
-unplugDatabase - Command to Unplug a pluggable database.
3、执行dbca
[oracle@forest ~]$ dbca -silent -createDatabase -responseFile /home/oracle/dbca.rsp
Enter SYS user password:
Enter SYSTEM user password:
Enter PDBADMIN User Password:
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
53% complete
54% complete
Creating Pluggable Databases
58% complete
63% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/forest.
Database Information:
Global Database Name:forest.oracle.com
System Identifier(SID):FOREST
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/forest/forest.log" for further details.
登录数据库
[oracle@forest ~]$ . oraenv ORACLE_SID = [oracle] ? FOREST The Oracle base has been set to /u01/app/oracle [oracle@forest ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Mon Oct 21 17:34:24 2024 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 pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 FORESTPDB1 READ WRITE NO 4 FORESTPDB2 READ WRITE NO SQL> show parameter name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cdb_cluster_name string cell_offloadgroup_name string db_file_name_convert string db_name string forest db_unique_name string forest global_names boolean FALSE instance_name string FOREST lock_name_space string log_file_name_convert string pdb_file_name_convert string processor_group_name string NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ service_names string forest.oracle.com
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- shutdown abort关库,真的有可能起不来吗?
shutdown abort关库,真的有可能起不来吗?
26-03-03 - 又是windown服务器断电引起的ora-00333
又是windown服务器断电引起的ora-00333
26-03-03 - 同事不小心drop column了一个列,真的凉凉了吗?
同事不小心drop column了一个列,真的凉凉了吗?
26-03-03 - 数据库数据恢复—Oracle数据库数据恢复案例
数据库数据恢复—Oracle数据库数据恢复案例
26-03-03 - 企业数据管理是否“镜花水月”
企业数据管理是否“镜花水月”
26-03-03 - Oracle自动处理表空间不足脚本
Oracle自动处理表空间不足脚本
26-03-03 - 如何一键完成20个Oracle实例运维脚本部署
如何一键完成20个Oracle实例运维脚本部署
26-03-03 - 03 高效调优:Oracle内存体系的精细化管理实践
03 高效调优:Oracle内存体系的精细化管理实践
26-03-03 - 01 Oracle 数据库存储结构深度解析:从数据文件到性能优化的全链路探究
- 数据库管理-第256期 Oracle DB 23.6新特性一览(20241031)
