关于oracle12C R2第二版本的安装在CentOS7这个系统中会出现缺少依赖包的一些个问题;
由于DBCA finish经常会曝出一些个ORA–01034一类的问题,我选择了避免图形化安装Oracle数据库的命令静默安装方式来解决在CentOS7中所遇到的一系列安装问题;
操作系统版本:
[root@localhost ~]# uname -a
我的版本信息:
(版本不同系统本身的一些个Oracle依赖包缺少的文件不相同)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#
下面我所需要用到的一些个环境配置以及swap分区的配置。
关于swap分区这个如果你本身的虚拟内存空间设置的大于2个G的话可以不用考虑我的这一步。(我的小于等于2G时DBCA图形化安装会报错,所以我为了避免静默安装也同样报错就专门配置了3个G的空间给我的swap分区)
1.查看swap空间
可以使用free命令进行查看
free -m以MB显示
free -h以GB显示
(这里我就不提供之前的swap空间大小了,我这里是分配过后的空间大小为3G。)
[root@localhost ~]# free -m
total used free shared buff/cache available
Mem: 1823 641 115 548 1066 426
Swap: 3071 8 3063
[root@localhost ~]# free -h
total used free shared buff/cache available
Mem: 1.8G 642M 114M 548M 1.0G 426M
Swap: 3.0G 8.6M 3.0G
这里我新增swap空间的大小(注意不是给之前的空间大小附加,而是直接将之前的空间大小给替换成我新增的swapfile)。
首先我先看一下自己在哪个目录:
[root@localhost ~]# pwd
/root
在/usr目录下创建一个swap文件夹,用来将我们新建的swapfile保存至这个文件夹中:
[root@localhost ~]# mkdir -p /usr/swap
下面我们在这个swap文件夹中创建个swapfile文件:
if=input file,of=output file,bs=大小/字节(可以跟M可以跟G 也可以直接输入字节数量3145728),count=分配的数量。
[root@localhost ~]# dd if=/dev/zero of=/usr/swap/swapfile bs=1G count=3
此时使用[root@localhost ~]# ll
命令可以显示出我们所创建的文件的字节数:
[root@localhost ~]# ll --help
-h, --human-readable 与-l 一起,以易于阅读的格式输出文件大小
(例如 1K 234M 2G)
[root@localhost ~]# ll -h /usr/swap/swapfile
-rw-------. 1 root root 3.0G 2月 20 10:36 /usr/swap/swapfile
此时我们可以看到创建的文件大小是3个G。
在我们创建完分区后,需要格式化才能够正常使用此分区:
[root@localhost ~]# mkswap --help
用法
mkswap [选项] 设备 [大小]
选项:
-c, --check 创建交换区前检查坏块
-f, --force 允许交换区大于设备大小
-p, --pagesize SIZE 指定页大小为 SIZE 字节
-L, --label LABEL 指定标签为 LABEL
-v, --swapversion NUM 指定交换空间版本号为 NUM
-U, --uuid UUID 指定要使用的 UUID
-V, --version 输出版本信息并退出
-h, --help 显示此帮助并退出
[root@localhost ~]# mkswap /usr/swap/swapfile
此时其会提示一些和权限相关的信息
使用[root@localhost ~]# chmod
命令来增加我们对swapfile文件的权限控制。
[root@localhost ~]# chmod --help
用法:chmod [选项]... 模式[,模式]... 文件...
或:chmod [选项]... 八进制模式 文件...
或:chmod [选项]... --reference=参考文件 文件...
Change the mode of each FILE to MODE.
With --reference, change the mode of each FILE to that of RFILE.
-c, --changes like verbose but report only when a change is made
-f, --silent, --quiet suppress most error messages
-v, --verbose output a diagnostic for every file processed
--no-preserve-root do not treat '/' specially (the default)
--preserve-root fail to operate recursively on '/'
--reference=RFILE use RFILE's mode instead of MODE values
-R, --recursive change files and directories recursively
--help 显示此帮助信息并退出
--version 显示版本信息并退出
Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
请向<http://translationproject.org/team/zh_CN.html> 报告chmod 的翻译错误
要获取完整文档,请运行:info coreutils 'chmod invocation'
swapon激活我们新创建的swapfile文件:
如果用Tab键无法补全也没有关系,直接把全部地址手动输入上就可以。
[root@localhost ~]# swapon /usr/swap/swapfile
查看一下我们的swap空间情况:
[root@localhost ~]# swapon -s
文件名 类型 大小 已用 权限
/usr/swap/swapfile file 3145724 8728 -1
此时我们需要设置一下swap的fstab文件,让我们的系统重启时自动加载我们创建的swapfile文件:
在fstab文件内最后一行添加/usr/swap/swapfile swap swap defaults 0 0
并将上面的/dev/mapper/centos-swap swap
这一行前面添加#号给注释掉。(也可以把整个fstab文件cp复制个备份文件放到自己想要保存的路径下,然后vim进fstab内将这一行直接dd删除掉)
[root@localhost ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Dec 30 22:15:36 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=afb726cb-2ed0-45dc-bd02-ceea53b7d1c1 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
#/dev/mapper/centos-swap swap swap defaults 0 0
/usr/swap/swapfile swap swap defaults 0 0
写完wq!保存后shutdown -r 重启我们的操作系统后就可以查看我们目前的分区状态了:
[root@localhost ~]# free -h
total used free shared buff/cache available
Mem: 1.8G 634M 102M 548M 1.1G 433M
Swap: 3.0G 8.5M 3.0G
到此我们懂得swap分区就算是完成了,下面我们需要查看一下我们的磁盘空间和容量了。
因为我所需要安装的oracle数据库是在/dev/mapper/centos-root下,所以需要提前分配多一些空间给我们的centos-root 以避免报错提示存储空间不足。
我将自己/home上多余的10个G空间分配给我的root空间内。
具体命令与步骤:
1.查看磁盘空间:
[root@localhost ~]# df -h
2.查看逻辑卷组:
[root@localhost ~]# vgdisplay
3.查看逻辑卷:
这里我主要看/dev/centos/root的大小。
[root@localhost ~]# lvdisplay
4.将现有的/home备份或移动到/media下:
[root@localhost ~]# mv /home/* /media/
5.卸载现有的/home目录:
[root@localhost ~]# umount /home
6.再次使用[root@localhost ~]# df -h
命令查看磁盘内已经没有/home的目录了。
7.删除掉我们卸载的/home目录所引用的逻辑卷:
输入yes
[root@localhost ~]# lvremove /dev/centos/home
8.查看卷组空间:
[root@localhost ~]# vgdisplay
9.新建/dev/centos/home:
我给我的/home8个G大小以后再增加。
[root@localhost ~]# lvcreate -L 8G -n home centos
10.查看逻辑卷情况:
[root@localhost ~]# lvdisplay /dev/centos/home
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID 0ffL0k-Xgnc-pDua-Jxij-RhPd-bFxs-NKTwd2
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2020-02-20 08:48:33 +0800
LV Status available
# open 1
LV Size 8.00 GiB
Current LE 2048
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
11.在/dev/centos/home上建立xfs系统:
[root@localhost ~]# mkfs -t xfs /dev/centos/home
12.将新分配的home逻辑卷挂载到/home文件夹:
[root@localhost ~]# mount /dev/centos/home /home/
13.把我们第4步移动的文件重新移动到/home文件夹内:
[root@localhost ~]# mv /media/* /home/
14.将我所能够用的空间拿出10G来给我的/dev/centos/root
[root@localhost ~]# lvextend -L +10G /dev/centos/root
15.激活我们创建的centos卷组:
[root@localhost ~]# vgchange -ay centos
16.扩展/dev/centos/root:
[root@localhost ~]# xfs_growfs /dev/centos/root
17.查看空间大小:
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 49G 21G 28G 43% /
devtmpfs 897M 0 897M 0% /dev
tmpfs 912M 0 912M 0% /dev/shm
tmpfs 912M 9.0M 903M 1% /run
tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/mapper/centos-home 8.0G 6.9G 1.2G 86% /home
tmpfs 183M 12K 183M 1% /run/user/42
tmpfs 183M 0 183M 0% /run/user/0
tmpfs 183M 0 183M 0% /run/user/1001
下面我们需要到oracle官网上去下载我们所需要的oracle数据库ZIP压缩包了
找到oracle12C下载地址:
Oracle Database 12C Release 2 (12.2.0.1.0) for Linux x86-64
将数据库文件下载到linux中:
(可以下载到Windows再传到linux中)
因为我的linux可以直接连接外网,所以我直接wget下载到linux中。
[root@localhost ~]# wget https://www.oracle.com/database/technologies/oracle12c-linux-12201-downloads.html#license-lightbox
创建个专门放软件的文件夹然后将文件放入文件夹内:
[root@localhost ~]# mkdir /media/Application
[root@localhost ~]# mv linuxx64_12201_database.zip /media/Application/
创建用户组:
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# groupadd oracle
[root@localhost ~]# groupadd oper
创建oracle用户并指定oracle用户的主组和附加组:
[root@localhost ~]# useradd -g oinstall -G dba,oper,oracle oracle
为创建的用户设置密码:
[root@localhost ~]# passwd oracle
查看安装Oracle12C第二版的依赖包是否有安装:
binutils compat-libcap1 compat-libstdc+±33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc+±devel libXext libXtst libX11 libXau libxcb libXi make sysstat
[root@localhost ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat
没有安装的依赖包使用yum install安装:
[root@localhost ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat
这里因为我的Centos7是没有compat-libstdc+±33*这个文件的,所以我专门从网上找的compat-libstdc+±33这个文件。
[root@localhost ~]# ll /media/Application/
总用量 3719852
-rw-r--r--. 1 root root 200684 3月 14 2015 compat-libstdc++-33-3.2.3-72.el7.i686.rpm
-rw-r--r--. 1 root root 195388 3月 14 2015 compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
解决掉相关的依赖包后再次使用[root@localhost ~]# rpm
命令查看依赖包:
[root@localhost ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat smartmontools net-tools
binutils-2.25.1-31.base.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.x86_64
gcc-4.8.5-16.el7.x86_64
gcc-c++-4.8.5-16.el7.x86_64
glibc-2.17-196.el7.x86_64
glibc-devel-2.17-196.el7.x86_64
ksh-20120801-34.el7.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64
libgcc-4.8.5-16.el7.x86_64
libstdc++-4.8.5-16.el7.x86_64
libstdc++-devel-4.8.5-16.el7.x86_64
libXext-1.3.3-3.el7.x86_64
libXtst-1.2.3-1.el7.x86_64
libX11-1.6.5-1.el7.x86_64
libXau-1.0.8-2.1.el7.x86_64
libxcb-1.12-1.el7.x86_64
libXi-1.7.9-1.el7.x86_64
make-3.82-23.el7.x86_64
sysstat-10.1.5-12.el7.x86_64
编辑/etc/sysctl.conf内核文件:
增加内容:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
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
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
#oracle conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
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" 24L, 773C 24,1 全部
修改后执行:[root@localhost ~]# sysctl -p
修改/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 10240
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
#
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
# End of file
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
"/etc/security/limits.conf" 68L, 2567C 68,1 底端
在 /etc/pam.d/login 增加内容:
#oracle conf
session required /lib64/security/pam_limits.so
session required pam_limits.so
在/etc/profile内增加内容:
#oracle conf
if [ $USER = "oracle" ];then
if [ $SHELL = "/bin/ksh" ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@localhost ~]# source /etc/profile
创建相关目录:
[root@localhost ~]# mkdir -p /u01/app/
修改/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
#oracle conf
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 --字符集一般是16GBK的,自行修改。
这里我把下载的oracle包拷贝到oracle用户的属主目录下:
[oracle@localhost ~]$ cp /media/Application/linuxx64_12201_database.zip /home/oracle/
将oracle包权限赋予oracle用户使用:
[root@localhost ~]# chown -R oracle:oinstall /home/oracle/linuxx64_12201_database.zip
[root@localhost ~]# chmod -R 755 /home/oracle/linuxx64_12201_database.zip
查看oracle包所属用户:
[root@localhost ~]# ll /home/oracle/linuxx64_12201_database.zip
使用oracle用户登录linux创建/oradb文件夹并解压缩oracle包:
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ mkdir oradb
[oracle@localhost ~]$ unzip -d oradb/ linuxx64_12201_database.zip
此时我们会在oradb/database/response/下看到三个文件:
分别是:数据库安装配置、dbca实例配置、网络配置
[oracle@localhost ~]$ ll oradb/database/response/
总用量 60
-rwxrwxr-x. 1 oracle oinstall 25502 1月 5 2017 dbca.rsp
-rw-rw-r--. 1 oracle oinstall 22924 1月 26 2017 db_install.rsp
-rwxrwxr-x. 1 oracle oinstall 6209 6月 20 2016 netca.rsp
在配置安装之前我们先把之前的创建的/u01/app的这个目录所属用户组全部按照上面的权限属组分配给oracle和oinstall。
[oracle@localhost ~]$ ll /u01/
总用量 0
drwxrwxr-x. 5 oracle oinstall 60 2月 20 19:59 app
下面我们就开始配置db_install.rsp文件:(博主可能写的不全,具体每一行什么意思可以参考此链接
“db_install.rsp百度文库解析”)
21 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
30 oracle.install.option=INSTALL_DB_SWONLY
35 UNIX_GROUP_NAME=oinstall
42 INVENTORY_LOCATION=/u01/app/oralnventory
46 ORACLE_HOME=/u01/app/oracle/product/12/db_1
51 ORACLE_BASE=/u01/app/oracle
63 oracle.install.db.InstallEdition=EE
80 oracle.install.db.OSDBA_GROUP=dba
86 oracle.install.db.OSOPER_GROUP=oinstall
91 oracle.install.db.OSBACKUPDBA_GROUP=oinstall
96 oracle.install.db.OSDGDBA_GROUP=oinstall
101 oracle.install.db.OSKMDBA_GROUP=oinstall
106 oracle.install.db.OSRACDBA_GROUP=oinstall
180 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
185 oracle.install.db.config.starterdb.globalDBName=orcl
190 oracle.install.db.config.starterdb.SID=orcl
202 oracle.install.db.config.PDBName=oracle
232 oracle.install.db.config.starterdb.memoryLimit=1024 //这个内存是我自己分配设置的,可自行增加或减少。
259 oracle.install.db.config.starterdb.password.ALL= //这一行密码输入自己能记住的
386 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
398 DECLINE_SECURITY_UPDATES=true
到执行安装文件:
[oracle@localhost database]$ ./runInstaller -silent -responseFile /home/oracle/oradb/database/response/db_install.rsp
稍等一段时间让其执行安装
正在启动 Oracle Universal Installer...
检查临时空间: 必须大于 500 MB。 实际为 28139 MB 通过
检查交换空间: 必须大于 150 MB。 实际为 3062 MB 通过
准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2022-05-05_09-19-51PM. 请稍候...[oracle@localhost database]$ 可以在以下位置找到本次安装会话的日志:
/u01/app/oralnventory/logs/installActions2022-05-05_09-19-51PM.log
Oracle Database 12c 的 安装 已成功。
请查看 '/u01/app/oralnventory/logs/silentInstall2022-05-05_09-19-51PM.log' 以获取详细资料。
以 root 用户的身份执行以下脚本:
1. /u01/app/oralnventory/orainstRoot.sh
2. /u01/app/oracle/product/12/db_1/root.sh
Successfully Setup Software.
安装过程最后会提示我们运行两个文件:orainstRoot.sh、root.sh
orainstRoot.sh在/u01/app/oralnventory/下
root.sh在/u01/app/oracle/product/12/db_1/下
切换到root用户再执行这两个文件后oracle引导安装完成。
编辑~/.bash_profile:
开始编辑了相关的oracle配置,现在需要补充几条配置(并不是重复编辑是补充编辑)
# .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
#oracle conf
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export ORACLE_PID=oral12
export LANG="zh_CN.UTF-8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
[oracle@localhost ~]$ source ~/.bash_profile
配置监听文件:
具体可以参考"netca.rsp百度文库解析"
[oracle@localhost ~]$ vim /home/oracle/oradb/database/response/netca.rsp
######################################################################
## Copyright(c) 1998, 2016 Oracle Corporation. All rights reserved. ##
## ##
## Specify values for the variables listed below to customize your ##
## installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## identifies the variable type. ##
## ##
## Please specify the values in the following format: ##
## ##
## Type Example ##
## String "Sample Value" ##
## Boolean True or False ##
## Number 1000 ##
## StringList {"String value 1","String Value 2"} ##
## ##
######################################################################
## ##
## This sample response file causes the Oracle Net Configuration ##
## Assistant (NetCA) to complete an Oracle Net configuration during ##
## a custom install of the Oracle12c server which is similar to ##
## what would be created by the NetCA during typical Oracle12c ##
## install. It also documents all of the NetCA response file ##
## variables so you can create your own response file to configure ##
## Oracle Net during an install the way you wish. ##
## ##
######################################################################
[GENERAL]
RESPONSEFILE_VERSION="12.2"
CREATE_TYPE="CUSTOM"
#-------------------------------------------------------------------------------
# Name : SHOW_GUI
# Datatype : Boolean
# Description: This variable controls appearance/suppression of the NetCA GUI,
# Pre-req : N/A
# Default : TRUE
# Note:
# This must be set to false in order to run NetCA in silent mode.
# This is a substitute of "/silent" flag in the NetCA command line.
# The command line flag has precedence over the one in this response file.
# This feature is present since 10.1.0.3.
#-------------------------------------------------------------------------------
#SHOW_GUI=false
#-------------------------------------------------------------------------------
# Name : LOG_FILE
# Datatype : String
# Description: If present, NetCA will log output to this file in addition to the
# standard out.
# Pre-req : N/A
# Default : NONE
# Note:
# This is a substitute of "/log" in the NetCA command line.
# The command line argument has precedence over the one in this response file.
# This feature is present since 10.1.0.3.
#-------------------------------------------------------------------------------
#LOG_FILE=""/oracle12cHome/network/tools/log/netca.log""
[oracle.net.ca]
#INSTALLED_COMPONENTS;StringList;list of installed components
# The possible values for installed components are:
# "net8","server","client","aso", "cman", "javavm"
INSTALLED_COMPONENTS={"server","net8","javavm"}
#INSTALL_TYPE;String;type of install
# The possible values for install type are:
# "typical","minimal" or "custom"
INSTALL_TYPE=""typical""
#LISTENER_NUMBER;Number;Number of Listeners
# A typical install sets one listener
LISTENER_NUMBER=1
#LISTENER_NAMES;StringList;list of listener names
# The values for listener are:
# "LISTENER","LISTENER1","LISTENER2","LISTENER3", ...
# A typical install sets only "LISTENER"
LISTENER_NAMES={"LISTENER"}
#LISTENER_PROTOCOLS;StringList;list of listener addresses (protocols and parameters separated by semicolons)
# The possible values for listener protocols are:
# "TCP;1521","TCPS;2484","NMP;ORAPIPE","IPC;IPCKEY","VI;1521"
# For multiple listeners, separate them with commas ex "TCP;1521","TCPS;2484"
# For multiple protocols in single listener, separate them with "&" ex "TCP;1521&TCPS;2484"
# A typical install sets only "TCP;1521"
LISTENER_PROTOCOLS={"TCP;1521"}
#LISTENER_START;String;name of the listener to start, in double quotes
LISTENER_START=""LISTENER""
#NAMING_METHODS;StringList;list of naming methods
# The possible values for naming methods are:
# LDAP, TNSNAMES, ONAMES, HOSTNAME, NOVELL, NIS, DCE
# A typical install sets only: "TNSNAMES","ONAMES","HOSTNAMES"
# or "LDAP","TNSNAMES","ONAMES","HOSTNAMES" for LDAP
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
#NOVELL_NAMECONTEXT;String;Novell Directory Service name context, in double quotes
# A typical install does not use this variable.
#NOVELL_NAMECONTEXT = ""NAMCONTEXT""
#SUN_METAMAP;String; SUN meta map, in double quotes
# A typical install does not use this variable.
#SUN_METAMAP = ""MAP""
#DCE_CELLNAME;String;DCE cell name, in double quotes
# A typical install does not use this variable.
#DCE_CELLNAME = ""CELL""
#NSN_NUMBER;Number;Number of NetService Names
# A typical install sets one net service name
NSN_NUMBER=1
#NSN_NAMES;StringList;list of Net Service names
# A typical install sets net service name to "EXTPROC_CONNECTION_DATA"
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
#NSN_SERVICE;StringList;Oracle12c database's service name
# A typical install sets Oracle12c database's service name to "PLSExtProc"
NSN_SERVICE={"PLSExtProc"}
#NSN_PROTOCOLS;StringList;list of coma separated strings of Net Service Name protocol parameters
# The possible values for net service name protocol parameters are:
# "TCP;HOSTNAME;1521","TCPS;HOSTNAME;2484","NMP;COMPUTERNAME;ORAPIPE","VI;HOSTNAME;1521","IPC;IPCKEY"
# A typical install sets parameters to "IPC;EXTPROC"
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
#SERVICEUSERPASSWORD;String;Windows service user password
# If the oracle home is installed as secure user, supply the password
#SERVICEUSERPASSWORD=""svcpassword""
可以先将netca.rsp从database/response/默认目录下复制一份出来,将默认目录下的netca.rsp留作备份,然后执行复制出来的netca.rsp
[oracle@localhost ~]$ pwd
/home/oracle
[oracle@localhost ~]$ ll
总用量 3372760
-rwxr-xr-x. 1 oracle oinstall 3453696911 4月 26 11:02 linuxx64_12201_database.zip
-rwxr-xr-x. 1 oracle oinstall 6211 5月 5 22:43 netca.rsp
drwxr-xr-x. 3 oracle oinstall 22 4月 26 22:21 oradb
[oracle@localhost ~]$ netca --help #查看一下该命令的帮助
Usage: netca [-silent] {<command> <options>}
Perform network configuration by specifying the following arguments:
[-silent]
-responsefile <Response file name>]
[-local {Perform configuration on only local node}]
-instype <typical|custom>
[-listener <Listener name (only for custom install)>]
[-lisport <TCP/IP port number>]
[-lps <Starting TCP/IP port number (only for typical install)>]
[-lpe <Ending TCP/IP port number (only for typical install)>]
[-netnum <Network resource number (only for RAC)>]
[-nostartlsnr {Do not start listener}]
[-crsupgrade {Upgrade default listener from lower version database home to Grid Infrastructure home (only for RAC)}]
[-inscomp <Comma separated list of installed components>]
[-insprtcl <Comma separated list of installed protocols>]
[-orahome <Oracle home>]
[-orahnam <Oracle home name>]
[-log <Log file name>]
[-h|-help {Print usage}]
[-listenerparameters {Comma separated list of the form parameter=value to specify the desired parameters for the selected listener}]
[oracle@localhost ~]$ netca -silent -responsefile /home/oracle/netca.rsp
Thu May 05 23:08:10 CST 2022 Oracle Net Configuration Assistant
正在对命令行参数进行语法分析:
参数"silent" = true
参数"responsefile" = /home/oracle/netca.rsp
参数"log" = /u01/app/oracle/product/12/db_1/log/netca.log
完成对命令行参数进行语法分析。
Oracle Net Services 配置:
完成概要文件配置。
Oracle Net 监听程序启动:
正在运行监听程序控制:
/u01/app/oracle/product/12/db_1/bin/lsnrctl start LISTENER
监听程序控制完成。
监听程序已成功启动。
监听程序配置完成。
成功完成 Oracle Net Services 配置。退出代码是0
查看监听状态:
[oracle@localhost ~]$ lsnrctl start #启动数据库监听程序
[oracle@localhost ~]$ lsnrctl status #查看数据库监听状态
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 27-2月 -2020 23:40:36
Copyright (c) 1991, 2016, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for Linux: Version 12.2.0.1.0 - Production
启动日期 27-2月 -2020 14:14:51
正常运行时间 0 天 0 小时 0 分 49 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 /u01/app/oracle/product/12/db_1/network/admin/listener.ora
监听程序日志文件 /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
服务摘要..
服务 "9f029767e9868976e055000000000001" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orcl" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclpdb" 包含 1 个实例。
实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
配置DBCA实例文件:参考"dbca.rsp百度文库解析"
[oracle@localhost ~]$ vim /home/oracle/oradb/database/response/dbca.rsp
32 gdbName=orcl
42 sid=orcl
52 databaseConfigType=SI
63 RACOneNodeServiceName=racdg1
74 policyManaged=FALSE
88 createServerPool=FALSE
127 force=FALSE
162 createAsContainerDatabase=true
172 numberOfPDBs=2
182 pdbName=orclpdb
192 useLocalUndoForPDBs=TRUE
203 pdbAdminPassword=Passw0r_d
223 templateName=/u01/app/oracle/product/12/db_1/assistants/dbca/templates/General_Purpose.dbc //找到这个General_Purpose文件
233 sysPassword=Passw0r_d
243 systemPassword=Passw0r_d
273 emExpressPort=5500 //默认是5500
284 runCVUChecks=FALSE
313 omsPort=0
341 dvConfiguration=False
411 datafileDestination=/u01/app/oracle/oradata
421 recoveryAreaDestination=/u01/app/oracle/flash_recovery_area
431 storageType=FS
440 diskGroupName=DATA
458 recoveryGroupName=RECOVERY
468 characterSet=AL32UTF8
478 nationalCharacterSet=AL16UTF16
488 registerWithDirService=FALSE
526 listeners=LISTENER
565 sampleSchema=FALSE #创建示例数据库,我选择的否可以改为TRUE
574 memoryPercentage=40 #设置数据库占物理内存百分比
584 databaseType=MULTIPURPOSE
594 automaticMemoryManagement=FALSE #自动内存管理我给关闭的
604 totalMemory="2048" #根据oracle推荐的分配内存计算(最多划分出物理内存的80%给数据库,留20%给系统),我的80%大概是2200多 所以我划给数据库2048,具体请根据自己情况分配也可给0
建立数据库实例:
[oracle@localhost ~]$ dbca -silent -createDatabase -responseFile /home/oracle/oradb/database/response/dbca.rsp
adb/database/response/dbca.rsplent -createDatabase -responseFile /home/oracle/ora
复制数据库文件
1%已完成
13%已完成
25%已完成
正在创建并启动 Oracle 实例
...
进入数据库:
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on 星期四 2月 27 23:45:53 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
连接到:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>