安装关键步骤:

[sonny@localhost ~]$ su root  #切换到root
Password:
[root@localhost sonny]# groupadd oinstall  #创建用户组oinstall
[root@localhost sonny]# groupadd dba  #创建用户组dba
[root@localhost sonny]# useradd -g oinstall -g dba -m oracle  #创建oracle用户,并加入到oinstall和dba用户组
[root@localhost sonny]# passwd oracle  #设置用户oracle的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆
Changing password for user oracle.
New password:   # 密码
BAD PASSWORD: The password is shorter than characters
Retype new password:   # 确认密码
passwd: all authentication tokens updated successfully.
[root@localhost sonny]# id oracle # 查看新建的oracle用户
uid=(oracle) gid=(dba) groups=(dba)
[root@localhost sonny]# [sonny@localhost ~]$ su root
Password:
[root@localhost sonny]# mkdir -p /data/oracle  #oracle数据库安装目录
[root@localhost sonny]# mkdir -p /data/oraInventory  #oracle数据库配置文件目录
[root@localhost sonny]# mkdir -p /data/database  #oracle数据库软件包解压目录
[root@localhost sonny]# cd /data
[root@localhost data]# ls  #创建完毕检查一下(强迫症)
database oracle oraInventory
[root@localhost data]# chown -R oracle:oinstall /data/oracle  #设置目录所有者为oinstall用户组的oracle用户
[root@localhost data]# chown -R oracle:oinstall /data/oraInventory
[root@localhost data]# chown -R oracle:oinstall /data/database
[root@localhost data]# [sonny@localhost data]$ su root
Password:
[root@localhost data]# cat /proc/version
Linux version 3.10.-.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8. (Red Hat 4.8.-) (GCC) ) # SMP Thu Nov :: UTC
[root@localhost data]# cat /etc/redhat-release  
CentOS Linux release 7.2. (Core)
[root@localhost data]# vi /etc/redhat-release
[root@localhost data]# cat /etc/redhat-release
redhat-
[root@localhost data]# yum install gcc gcc-c++ glibc glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel zlib-devel unzip compat-libcap1 compat-libstdc++- [root@localhost /]# vi /etc/selinux/config
[root@localhost /]# cat /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 #此处修改为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 [root@localhost /]#

终于在vmare的centos7下将oracle11g安装成功了,不容易,将结果记录如下

启动oracle监听及服务的步骤,使用oracle用户登录,执行以下命令

登录到CentOS,切换到oracle用户权限
# su – oracle
接着输入:
$ sqlplus "/as sysdba"
原本的画面会变为
SQL>
接着请输入
SQL> startup
就可以正常的启动数据库了。

检查Oracle DB监听器是否正常

回到终端机模式,输入:
SQL> exit
$ lsnrctl status
检查看看监听器是否有启动
如果没有启动,可以输入:
$ lsnrctl start
启动监听器

使用plsql查看服务器版本信息

CentOS设置Oracle开机自动启动

 在Windows下安装完成Oracle 11gR2后,默认就开机自启动Oracle相关服务,但Linux下安装完后每次都得手动启动和关闭数据库(dbstart | dbshut)、监听器(lsnrctl)、控制台(emtcl)。如何把Oracle添加到Linux系统服务里开机自启动呢?下面以CentOS .3为例详解,其他发行版一样通用!

 、Redhat init简介:
Linux启动时,会运行一个init程序,然后由init来启动后面的任务,包括多用户环境(inittab中设定)和网络等。运行级就是当前程序运行的功能级别,这个级别从1到6,具有不同的功能。这些级别在/etc/inittab(其他发行版这个文件位置不同)中指定,该文件就是init程序寻找的主要文件。最先运行的服务放在/etc/rc.d目录下。
文件以S开头,代表start(启动),后面的数字是启动顺序;文件以K开头,代表kill(结束),同样,后面的数字代表结束顺序。例如:/etc/rc3.d/S55sshd表示它与运行级别3有关,55就是它的启动顺序;/etc/rc3.d/K15nginx表示它与运行级别3有关,15就是它的关闭顺序。
init.d
这个目录中存放了一些服务启动脚本,系统安装时的多个rpm包,这些脚本在执行时可以用来启动,停止和重启这些服务。
rcx.d(x为0~)
这个目录是启动级别的执行程序链接目录,里面的文件都是指向init.d目录中文件的一些软连接。
、修改dbstart和dbshut启动关闭脚本,使其启动数据库的同时也自动启动监听器(即启动数据库时启动监听器,停止数据库时停止监听器):
# vim /u01/app/oracle/product/11.2./db_1/bin/dbstart
找到下面的代码,在实际脚本代码的前面 # First argument is used to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$
# 将此处的 ORACLE_HOME_LISTNER=$ 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
echo "Usage: $0 ORACLE_HOME"
else
LOG=$ORACLE_HOME_LISTNER/listener.log
同样也修改dbshut脚本:
# vim /u01/app/oracle/product/11.2./db_1/bin/dbshut # The this to bring down Oracle Net Listener
ORACLE_HOME_LISTNER=$
# 将此处的 ORACLE_HOME_LISTNER=$ 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener"
echo "Usage: $0 ORACLE_HOME"
else
LOG=$ORACLE_HOME_LISTNER/listener.log
、新建Oracle服务启动脚本:
# vim /etc/init.d/oracle
新建一个以oracle命名的文件(也可以命名为oracle11g等,自己喜欢啥名改啥名。),并将以下脚本代码复制到文件里(里面的oracle目录路径根据自己的实际安装路径修改): #!/bin/sh
# chkconfig:
# description: Oracle 11g R2 AutoRun Servimces
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2./db_1
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
reload|restart)
$ stop
$ start
;;
*)
echo $"Usage: `basename $0` {start|stop|reload|reload}"
exit
esac
exit 保存退出!
、赋予启动脚本执行权限并链接好:
# chmod /etc/init.d/oracle # ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle # ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle
、把oracle启动脚本添加到系统服务里并设置自启动:
# chkconfig --add oracle # chkconfig --level oracle on
reboot重启系统看看效果吧

Oracle自启动

export NLS_LANG="AMERICAN_AMERICA.UTF8"

参考:

http://www.linuxidc.com/Linux/2016-04/130559p2.htm#0-tsina-1-45959-397232819ff9a47a7b7e80a40613cfe1

http://www.jianshu.com/p/36a78274a00e

http://blog.sina.com.cn/s/blog_4af62a6501018xfj.html

centos7 下安装oracle 11g笔记的更多相关文章

  1. Centos7下安装ORACLE 11g,弹窗不显示

    Centos7下安装ORACLE 11gR2,弹窗不显示,安装界面显示为灰色. 解决方法:执行安装时带上一下参数 ./runInstaller -jreLoc /etc/alternatives/jr ...

  2. Windows10下安装Oracle 11g 64位的详细步骤

    直接附上我整理后的Word版<Windows10下安装Oracle 11g 64位的详细步骤>下载地址,提取码:9vak. 参考文献: 1.Win10 64位系统下安装Oracle11g详 ...

  3. CentOS 6.5下安装Oracle 11g(转)

    最近开始学习CentOS使用,做些记录. 参考文献:Cent OS 6_5(x86_64)下安装Oracle 11g 一.硬件要求 1.内存&swap Minimum:1 GB of RAM ...

  4. Redhat Linux 下安装Oracle 11g R2

    能够下载:http://download.csdn.net/detail/ykh554541184/8086647文档方便查阅 官方文档:http://docs.oracle.com/cd/E1188 ...

  5. 在Windows10系统下安装Oracle 11g数据库

    在Windows10系统下安装Oracle 11g数据库 https://blog.csdn.net/wei1992_6/article/details/60054727

  6. (静默安装)Cent OS 6_5(x86_64)下安装Oracle 11g

    Cent OS 6_5(x86_64)下安装Oracle 11g 1 硬件要求   1.1 内存 & swap 物理内存不少于1G 硬盘可以空间不少于5G swap分区空间不少于2G Mini ...

  7. Oracle Linux 6.3下安装Oracle 11g R2(11.2.0.3)

    本文主要描写叙述了在Oracle Linux 6.3下安装Oracle 11gR2(11.2.0.3).从Oracle 11g開始,Oracle官方站点不再提供其Patch的下载链接,须要使用Meat ...

  8. solaris下安装oracle 11g与11g rac

    1.To Find Swap, RAM, and OS Version 对于 Solaris 操作系统,查看 Swap, RAM, and OS Version 的方法: swap -l /usr/s ...

  9. 在windows系统下安装oracle 11g

     oracle 11g 安装在windows server 2012 系统下. 最近,需要配置数据库,要求在windows操作系统下,安装oracle 11g 数据库,因为以前没有安装过,所以成功后, ...

随机推荐

  1. shell脚本实例-菜单样例

    1.9.1 实例需求 用户在进行Linux系统管理的过程中,经常需要用到查看进程的信息.用户的信息等常用的功能.本例针对这一需求,使用shell编程实现基本的系统管理 功能.通过本程序,可以按照要求实 ...

  2. linux服务之crond

    use the following command add entries to crontab should take effect right away. right away(立即,立刻) #c ...

  3. PostgreSQL数据的导出导入

    PostgreSQL数据的导出导入 导出PostgreSQL数据库中的数据: $ pg_dump -U postgres  -f mydatabase.sql  mydatabase 导入数据时首先创 ...

  4. N天前涨停过的票

    zd(0,300,10)B2:=REF(C,1)*1.1-C;B3:BARSLAST(B2<0.01)=ZD01;{n天前涨停股票}

  5. intellij idea +maven4+springmvc4搭建

    0.淘宝mave培训PPT http://www.open-open.com/doc/view/4058453cde4b429c82ff2807d8aa81f0 1.intellij创建空的maven ...

  6. Android中Service的使用详解和注意点(LocalService)

    Android中Service的使用详解和注意点(LocalService) 原文地址 开始,先稍稍讲一点android中Service的概念和用途吧~ Service分为本地服务(LocalServ ...

  7. 程序员书单_HeadFirst系列

    Head First Jquery(中文版),完整扫描版 http://download.csdn.net/detail/shenzhq1980/9103615 Head First Python(完 ...

  8. sublime text 3 安装注释

    sublime text 3 1.安装Sublime Text 3  下载安装:http://www.sublimetext.com/3 Package Control安装:https://subli ...

  9. W81安装记录

    安装Windows 8.1之前先断网!!! 在x86的WinPE环境中安装Windows 8.1 x64的方法: 1.格式化硬盘的第一主分区C盘,将x64的ISO解压到其他分区里: 2.复制ISO解压 ...

  10. 【MySQL】技巧 之 count(*)、count(1)、count(col)

    只看结果的话,Select Count(*) 和 Select Count(1) 两着返回结果是一样的. 假如表沒有主键(Primary key), 那么count(1)比count(*)快,如果有主 ...