CentOS7安装Oracle12c

准备

  • 安装好CentOS7
  • 下载好linuxx64_12201_database.zip(Oracle12c安装文件)

安装步骤

  1. 更新yum
[root@centos7 ~]# yum update -y
  1. 添加操作系统核心参数
  • 添加修改Shell限制
vi /etc/security/limits.conf

添加如下参数:

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
  • 添加Linux内核参数
vi /etc/sysctl.conf

添加如下参数:

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
  • 检查参数是否生效
[root@centos7 ~]# sysctl -p
[root@centos7 ~]# sysctl -a
  1. 创建相关用户和用户组
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -u 54322 -g oinstall -G asmdba,asmadmin grid

设置oracle和grid用户密码:

[root@centos7 ~]# passwd oracle
[root@centos7 ~]# passwd grid
  1. (关键步骤)更新CentOS7依赖包
[root@centos7 ~]# yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 \
glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 \
libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 \
libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

如果CentOS7没有安装X Window,还要安装一X Window的相关软件:

[root@centos7 ~]# yum groupinstall -y "X Window System"
[root@centos7 ~]# yum install cjkuni-uming-fonts
  1. 通过oracle用户上传linuxx64_12201_database.zip文件

  2. 在使用oracle用户进行安装

  • 登录oracle用户
ssh -X oracle@192.168.1.100

这样就可以将服务器端的界面输出到客户端。

  • 启动oracle 12c安装界面
[oracle@centos7 ~]$ unzip linuxx64_12201_database.zip
[oracle@centos7 ~]$ cd database
[oracle@centos7 database]$ ./runInstaller
  1. Oracle12c软件安装过程

去掉接收安全更新

选择仅安装数据库软件

选择单实例数据库安装

选择企业版7.5G真大

注意一下这两个目录

# /home/oracle/:是oracle用户的home目录
# 所以Oracle基目录默认是操作系统用户的home目录下面的app/oracle
# /home/oracle/app/oracle/product/12.2.0/dbhome_1
# 这里意味着其他oracle数据库软件目录都放在Oracle基目录的product目录下面,这里可以看出我安装的oracle软件版本为12.2.0

oralce安装目录清单

# /home/oracle/app/oraInventory: 与Oracle基目录并列在同一个app父目录下面

继续保持默认

检查OS是否符合安装Oracle最低安装条件,这个步骤很重要

点击进入Oracle的安装进度界面

**Note:**值得注意的是最后需要root用户执行2次脚本。

root脚本位置

[root@centos7 ~]# /home/oracle/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /home/oracle/app/oraInventory to oinstall.
The execution of the script is complete.
# 把/home/oracle/app/oraInventory目录的读写权限给oinstall用户组
[root@centos7 ~]# /home/oracle/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/app/oracle/product/12.1.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: <PRESS ENTER>
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
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.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /home/oracle/app/oracle/product/12.2.0/dbhome_1/install/root_localhost.localdomain_2017-05-22_14-31-35-542560085.log
Finished installing Oracle Trace File Analyzer (TFA)
# 告诉你一些oracle的基本安装信息,最后问你是否安装TFA,我选择了yes,等一段时间就可以了

执行完成点击确定,就安装完成了 到这里就安装完成了Oracle数据库软件。

8.配置oracle环境变量

[oracle@centos7 ~]$ vi /home/oracle/.bash_profile
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/home/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID # 注意这里到oracle sid
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

使配置生效:

[oracle@centos7 ~]$ . .bash_profile

9.dbca创建数据库

dbca创建数据库

高级配置

一般用途或事务处理

注意这里的SID和PDB名称

勾选OMF

快速恢复区大小,暂时使用最小要求的8190MB **NOTE:**一定要启用归档,归档很重要的。

监听程序名称

保持默认

记住字符集

![去掉EM配置(http://upload-images.jianshu.io/upload_images/650171-aaec1b727514dc36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

简单配置口令

准备创建数据库

需要重新设置快速恢复区大小

重新设置快速恢复区大小为10713MB

准备创建

创建中

![这样就建库完成了(http://upload-images.jianshu.io/upload_images/650171-e2ee72a531107e7b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) **Note:**这里建议还是去口令管理,修改一下SYS和SYSTEM帐户。

10.检查创建是否成功

[oracle@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon May 22 16:34:08 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


???:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

两个小问题

中文乱码解决——配置NLS_LANG环境变量

这里出现乱码了。

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

SQL> quit
# 添加环境便利NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
[oracle@oracle ~]$ vi .bash_profile
NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"; export NLS_LANG
[oracle@oracle ~]$ . .bash_profile

再次sqlplus登录就没有乱码了。

sqlplus上下键乱码问题——安装rlwrap包

https://github.com/hanslub42/rlwrap 到这里下载源代码进行安装,因为yum没有rlwrap,下载后上传到root的home目录,进行源码安装。

[root@oracle ~]# tar xvf rlwrap-0.43.tar.gz
[root@oracle ~]# cd rlwrap-0.43/
...
checking for readline in -lreadline... no
configure: error:
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
this program!

这里表示rlwrap需要readline依赖。

[root@oracle rlwrap-0.43]# yum install readline-static.x86_64

继续编译安装rlwrap:

make
make check
make install

安装rlwrap成功后,配置环境变量:

[root@oracle ~]# vi .bash_profile
alias rlsqlplus='rlwrap sqlplus'
alias rlrman='rlwrap rman'
[oracle@oracle ~]$ source .bash_profile

再次使用rlsqlplus登录oralce,就可以正常调用上下键了,不会出现乱码了:

[oracle@oracle ~]$ rlsqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on 星期一 5月 22 17:15:44 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


连接到:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

SQL> quit
从 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 断开

参考:
Linux下SQLPlus中文乱码处理
rlwrap for Command Line History and Editing in SQL*Plus and RMAN on Linux
oracle单实例12.2.0.1安装
Oracle Database 12c Installation on CentOS 7

转载于:https://my.oschina.net/fxtxz2/blog/1858959

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值