当前位置:网站首页>虚拟机CentOS7中无图形界面安装Oracle(保姆级安装)
虚拟机CentOS7中无图形界面安装Oracle(保姆级安装)
2022-06-24 19:24:00 【kjshuan】
目标 - 在虚拟机CentOS7中无图形界面安装Oracle11G R2版本
① 系统要求以及准备 之前准备好shell脚本 和oracle linux版本压缩包
1. 物理内存不小于1G: 查看方式:
# grep MemTotal /proc/meminfo
2. 可用硬盘不小于8G: 查看方式:
# df
3.Swap分区空间不小于2G: 查看方式:
# grep SwapTotal /proc/meminfo
4. 关闭firewalld防火墙
# systemctl status firewalld.service #查看firewalld防火墙状态 # systemctl stop firewalld.service #关闭firewalld防火墙 # systemctl disable firewalld.service #禁止开机使用firewalld防火墙
5. 修改CentOS系统标识 (由于Oracle默认不支持CentOS)
修改文件: /etc/redhat-release
将文件内容替换为:
redhat-7
6.修改内核参数
修改文件: /etc/sysctl.conf
添加以下内容:
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 kernel.shmall = 2097152 kernel.shmmax = 2147483648 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.conf.all.rp_filter = 1 net.core.rmem_default = 262144 net.core.rmem_max= 4194304 net.core.wmem_default= 262144 net.core.wmem_max= 1048576
修改完后,启用新的配置:
# sysctl -p
7. 安装必须的软件包
# yum -y install binutils* compat-libcap1* compat-libstdc++* gcc* gcc-c++* glibc* glibc-devel* ksh* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXi* libXtst* make* sysstat* elfutils* unixODBC* unzip lrzsz
8. 创建用户以及组
# groupadd oinstall #创建安装oracle程序用户组 # groupadd dba #创建DBA用户组 # useradd -g dba -m oracle #创建用户oracle 并加入到dba组 # usermod -a -G oinstall oracle #将用户oracle加入到oinstall组 # passwd oracle #修改用户oracle的密码
# id oracle #查看用户oracle的信息
9. 创建安装目录
# mkdir -p /data/oracle #创建oracle主目录 # mkdir -p /data/inventory #创建oralce配置目录 # mkdir -p /data/src #创建oracle压缩包解压目录 # chown -R oracle:oinstall /data/oracle #修改目录权限 # chown -R oracle:oinstall /data/inventory # chown -R oracle:oinstall /data/src # ll /data #查看目录权限
10. 修改oracle用户的安全性能设置
修改文件: /etc/security/limits.conf
在文件最后一行前,追加以下内容
#@student - maxlogins 4 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 # End of file
11. 修改用户环境变量
修改文件: /home/oracle/.bashrc
追加以下内容
export PATH export ORACLE_BASE=/data/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID=orcl export ORACLE_UNQNAME=orcl export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export LANG=C export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
修改完后立即启用:
# source /home/oracle/.bashrc
12. 解压缩zip包到/data/src
# unzip linux.x64_11gR2_database_1of2.zip -d /data/src/ # unzip linux.x64_11gR2_database_2of2.zip -d /data/src/ # chown -R oracle:oinstall /data/src/ # ll /data/src/
13. 关闭selinux
修改文件: /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 two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
# reboot
重新开一个窗口 设置用户名!!!!
[[email protected] ~]# cd "/root"
[[email protected] ~]# hostname
gyd
[[email protected] ~]# hostnamectl set-hostname oracle.server
[[email protected] ~]# vim /etc/hosts
[[email protected] ~]# hostname
oracle.server
[[email protected] ~]#
② 安装Oracle
进入Oracle用户
# su oracle
1.安装Oracle主程序
编辑数据库安装文件 /data/src/database/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY # 安装类型 ORACLE_HOSTNAME=oracle.server # 主机名称 UNIX_GROUP_NAME=oinstall # 安装组 INVENTORY_LOCATION=/data/inventory # INVENTORY目录 SELECTED_LANGUAGES=en,zh_CN # 选择语言 ORACLE_HOME=/data/oracle/product/11.2.0/db_1 # oracle_home ORACLE_BASE=/data/oracle # oracle_base oracle.install.db.InstallEdition=EE # oracle版本 oracle.install.db.DBA_GROUP=dba # dba用户组 oracle.install.db.OPER_GROUP=oinstall # oper用户组 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE # 数据库类型 oracle.install.db.config.starterdb.globalDBName=orcl # globalDBName oracle.install.db.config.starterdb.SID=orcl # SID oracle.install.db.config.starterdb.characterSet=AL32UTF8 # 默认数据库编码 oracle.install.db.config.starterdb.memoryLimit=800 # 自动管理内存的最小内存(M) oracle.install.db.config.starterdb.password.ALL=oracle # 设定所有数据库用户使用同一个密码 DECLINE_SECURITY_UPDATES=true # 设置安全更新
安装oracle
$ /data/src/database/runInstaller -silent -responseFile /data/src/database/response/db_install.rsp -ignorePrereq这2个是一句 需要一起cv
漫长的等待.............(时间的话看机器性能咯)
当出现如下画面时候,请照做
要执行配置脚本,请执行以下操作: 1.打开一个终端窗口(刚刚打开的一个) 2.以"root"身份登陆 3.运行脚本 /data/inventory/orainstRoot.sh /data/oracle/product/11.2.0/db_1/root.sh 4.返回此窗口并按"Enter"键继续
Oracle主程序就安装完啦.
2.配置Oracle监听程序
编辑监听配置文件 /data/src/database/response/netca.rsp
修改以下参数
INSTALL_TYPE=""custom"" # 安装的类型 LISTENER_NUMBER=1 # 监听器数量 LISTENER_NAMES={"LISTENER"} # 监听器的名称列表 LISTENER_PROTOCOLS={"TCP;1521"} # 监听器使用的通讯协议列表 LISTENER_START=""LISTENER"" # 监听器启动的名称
执行命令:
$ /data/oracle/product/11.2.0/db_1/bin/netca /silent /responseFile /data/src/database/response/netca.rsp
查看监听程序是否运行
$ netstat -tnulp | grep 1521
net如果报错在另一个输入窗口输入
# yum install -y net -tools
关于监听的开机和关闭
开启监听: /data/oracle/product/11.2.0/db_1/bin/lsnrctl start 关闭监听: /data/oracle/product/11.2.0/db_1/bin/lsnrctl stop
3.添加数据库实例
编辑数据库实例文件 /data/src/database/response/dbca.rsp
修改以下参数
RESPONSEFILE_VERSION ="11.2.0" // 不要变哦 OPERATION_TYPE ="createDatabase" // 操作为创建实例 GDBNAME ="orcl" // 数据库实例名 SID ="orcl" // 实例名字 TEMPLATENAME = "General_Purpose.dbc" // 建库用的模板文件 SYSPASSWORD = "oracle" // SYS管理员密码 SYSTEMPASSWORD = "oracle" // SYSTEM管理员密码 SYSMANPASSWORD= "oracle" DBSNMPPASSWORD= "oracle" DATAFILEDESTINATION =/data/oracle/oradata // 数据文件存放目录 RECOVERYAREADESTINATION=/data/oracle/flash_recovery_area // 恢复数据存放目录 CHARACTERSET ="AL32UTF8" // 字符集 NATIONALCHARACTERSET= "AL16UTF16" // 字符集 TOTALMEMORY ="6553" // 1638MB,物理内存2G*80%。
执行命令:
$ /data/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /data/src/database/response/dbca.rsp
查看实例是否运行
$ ps -ef | grep ora_ | grep -v grep
修改启动和关闭实例的程序
修改文件: /data/oracle/product/11.2.0/db_1/bin/dbstart
/data/oracle/product/11.2.0/db_1/bin/dbshut将 ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=/data/oracle/product/11.2.0/db_1
修改文件: /etc/oratab
将 orcl:/data/oracle/product/11.2.0:N 修改为 orcl:/data/oracle/product/11.2.0:Y
启动或者关闭实例
启动实例: /data/oracle/product/11.2.0/db_1/bin/dbstart 关闭实例: /data/oracle/product/11.2.0/db_1/bin/dbshut
换另一个窗口执行下面操作
③ 收尾工作
1.开机启动Oracle
Root用户模式下:
# chmod +x /etc/rc.d/rc.local 修改文件 /etc/rc.d/rc.local 在文件最后追加以下内容: su oracle -lc "/data/oracle/product/11.2.0/db_1/bin/lsnrctl start" su oracle -lc "/data/oracle/product/11.2.0/db_1/bin/dbstart"
边栏推荐
- CondaValueError: The target prefix is the base prefix. Aborting.
- Use of kubernetes storage volumes
- Poj1061 frog dating (extended Euclid)
- Wireshark packet capturing skills summarized by myself
- Simple analysis of WordPress architecture
- Golang daily question
- Remove the screen recording reminder (seven cattle cloud demo)
- Memcached full profiling – 1 Fundamentals of memcached
- Functional analysis of ebpf sockops
- 66 pitfalls in go programming language: pitfalls and common errors of golang developers
猜你喜欢
ping: www.baidu. Com: unknown name or service
Pytest testing framework
EditText 控制软键盘出现 搜索
使用 Go 编程语言 66 个陷阱:Golang 开发者的陷阱和常见错误指北
Static routing job supplement
Multi view function in blender
TDengine可通过数据同步工具 DataX读写
DHCP operation
Intelligent fish tank control system based on STM32 under Internet of things
About transform InverseTransformPoint, transform. InverseTransofrmDirection
随机推荐
Intelligent fish tank control system based on STM32 under Internet of things
Arkit与Character Creator动画曲线的对接
Auto. JS to realize automatic unlocking screen
memcached完全剖析–1. memcached的基础
Static routing job
自己总结的wireshark抓包技巧
Mysql优化查询速度
TCP_ Nodelay and TCP_ CORK
JMeter implementation specifies concurrent loop testing
Curl command
OSI notes sorting
Basic database syntax learning
Blender's simple skills - array, rotation, array and curve
how to install clustershell
regular expression
The virtual currency evaporated $2trillion in seven months, and the "musks" ended the dream of 150000 people becoming rich
188. 买卖股票的最佳时机 IV
XTransfer技术新人进阶秘诀:不可错过的宝藏Mentor
Slider controls the playback progress of animator animation
CondaValueError: The target prefix is the base prefix. Aborting.