本篇文章给大家带来了centos7下无图形界面安装 oracle11g的操作知识,希望对大家有帮助。
一、系统准备物理内存不小于1g: 查看方式:# grep memtotal /proc/meminfo
可用硬盘不小于8g: 查看方式:# df
swap分区空间不小于2g: 查看方式:# grep swaptotal /proc/meminfo
关闭防火墙# systemctl status firewalld.service #查看firewalld防火墙状态# systemctl stop firewalld.service #关闭firewalld防火墙# systemctl disable firewalld.service #禁止开机使用firewalld防火墙
修改centos系统标识 (由于oracle默认不支持centos)
修改文件:/etc/redhat-release
将文件内容替换为:redhat-7
修改内核参数
修改文件:/etc/sysctl.conf
添加以下内容:fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmmni = 4096kernel.sem = 250 32000 100 128kernel.shmall = 2097152kernel.shmmax = 2147483648net.ipv4.ip_local_port_range = 9000 65500net.ipv4.icmp_echo_ignore_broadcasts = 1net.ipv4.conf.all.rp_filter = 1net.core.rmem_default = 262144net.core.rmem_max= 4194304net.core.wmem_default= 262144net.core.wmem_max= 1048576
修改完后,启用新的配置:
# sysctl -p
安装必须的软件包# 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 net-tools
创建用户以及组# 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的信息
创建安装目录# mkdir -p /opt/oracle #创建oracle主目录# mkdir -p /opt/inventory #创建oralce配置目录# mkdir -p /opt/src #创建oracle压缩包解压目录# chown -r oracle:oinstall /opt/oracle #修改目录权限# chown -r oracle:oinstall /opt/inventory # chown -r oracle:oinstall /opt/src# ll /opt #查看目录权限
修改oracle用户的安全性能设置
修改文件: /etc/security/limits.conf
在文件最后一行前,追加以下内容#@student - maxlogins 4oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536# end of file
修改用户环境变量
修改文件: /home/oracle/.bashrc
追加以下内容export pathexport oracle_base=/opt/oracleexport oracle_home=$oracle_base/product/11.2.0/db_1export oracle_sid=orclexport oracle_unqname=orclexport path=$oracle_home/bin:/usr/sbin:$pathexport ld_library_path=$oracle_home/lib:/lib:/usr/libexport lang=cexport nls_lang=american_america.al32utf8
修改完后立即启用:
# source /home/oracle/.bashrc
解压缩zip包到/opt/src# unzip linux.x64_11gr2_database_1of2.zip -d /opt/src/# unzip linux.x64_11gr2_database_2of2.zip -d /opt/src/# chown -r oracle:oinstall /opt/src/# ll /opt/src/
关闭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
二、安装oracle进入oracle用户
# su oracle
安装oracle主程序
编辑数据库安装文件/opt/src/database/response/db_install.rsporacle.install.option=install_db_swonly # 安装类型oracle_hostname=oracle.server # 主机名称unix_group_name=oinstall # 安装组inventory_location=/opt/inventory # inventory目录selected_languages=en,zh_cn # 选择语言oracle_home=/opt/oracle/product/11.2.0/db_1 # oracle_homeoracle_base=/opt/oracle # oracle_baseoracle.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 # globaldbnameoracle.install.db.config.starterdb.sid=orcl # sidoracle.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
$ /opt/src/database/runinstaller -silent -responsefile /opt/src/database/response/db_install.rsp -ignoreprereq
此时需要慢慢等待······
当出现以下画面时,请照做
要执行配置脚本,请执行以下操作:
1.打开一个终端窗口
2.以root身份登陆
3.运行脚本
/opt/inventory/orainstroot.sh
/opt/oracle/product/11.2.0/db_1/root.sh
4.返回此窗口并按enter键继续
三、配置oracle监听程序编辑监听配置文件/opt/src/database/response/netca.rsp
修改以下参数
install_type=custom # 安装的类型listener_number=1 # 监听器数量listener_names={listener} # 监听器的名称列表listener_protocols={tcp;1521} # 监听器使用的通讯协议列表listener_start=listener # 监听器启动的名称
执行命令:
$ /opt/oracle/product/11.2.0/db_1/bin/netca /silent /responsefile /opt/src/database/response/netca.rsp
查看监听程序是否运行
$ netstat -tnulp | grep 1521
关于监听的开机和关闭
开启监听:/opt/oracle/product/11.2.0/db_1/bin/lsnrctl start关闭监听:/opt/oracle/product/11.2.0/db_1/bin/lsnrctl stop
四、添加数据库实例编辑数据库实例文件/opt/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= oracledbsnmppassword= oracledatafiledestination =/opt/oracle/oradata // 数据文件存放目录recoveryareadestination=/opt/oracle/flash_recovery_area // 恢复数据存放目录characterset =al32utf8 // 字符集nationalcharacterset= al16utf16 // 字符集totalmemory =1638 // 1638mb,物理内存2g*80%。
执行命令:
$ /opt/oracle/product/11.2.0/db_1/bin/dbca -silent -responsefile /opt/src/database/response/dbca.rsp
查看实例是否运行
$ ps -ef | grep ora_ | grep -v grep
修改启动和关闭实例的程序
修改文件: /opt/oracle/product/11.2.0/db_1/bin/dbstart
/opt/oracle/product/11.2.0/db_1/bin/dbshut
将oracle_home_listner=$1修改为oracle_home_listner=/opt/oracle/product/11.2.0/db_1
修改文件:/etc/oratab
将orcl:/opt/oracle/product/11.2.0:n修改为orcl:/opt/oracle/product/11.2.0:y
启动或者关闭实例
启动实例:/opt/oracle/product/11.2.0/db_1/bin/dbstart关闭实例:/opt/oracle/product/11.2.0/db_1/bin/dbshut
五、开机启动oracleroot用户模式下:
# chmod +x /etc/rc.d/rc.local修改文件 /etc/rc.d/rc.local在文件最后追加以下内容:su oracle -lc /opt/oracle/product/11.2.0/db_1/bin/lsnrctl startsu oracle -lc /opt/oracle/product/11.2.0/db_1/bin/dbstart
六、测试先登录下数据库
# su - oracle$ sqlplus / as sysdbasql> select * from v$version;banner--------------------------------------------------------------------------------oracle database 11g enterprise edition release 11.2.0.1.0 - 64bit productionpl/sql release 11.2.0.1.0 - productioncore 11.2.0.1.0 productiontns for linux: version 11.2.0.1.0 - productionnlsrtl version 11.2.0.1.0 - production
成功查出版本,安装完毕
推荐教程:《oracle教程》
以上就是十分钟学会centos7下无图形界面安装 oracle11g的详细内容。