CentOS7安装Oracle12c图文详解
海淀农民 2018-10-29 11:27:25 6462 收藏 9
环境:
CentOS7@VMware12,分配资源:CPU:2颗,内存:4GB,硬盘空间:30GB
Oracle 12C企业版64位
下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
过程纪要:
root身份安装依赖包:
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 libXp
建立用户和组:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
echo "123456" | passwd --stdin oracle #oracle用户的登录密码,后续登录要用,记着。创建安装目录:
mkdir -p /orcl/app/oracle/product/12.1.0/db_1
chown -R oracle:oinstall /orcl/app
chmod -R 775 /orcl/app修改内核参数vi /etc/sysctl.conf,添加:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1200000000
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 -p另外 上面的kernel.shmmax = 1200000000可能会有问题,后面咱们再说。
或者你直接现在就写成4098955264
改文件限制: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注意:修改此文件是即时生效的,但可能要重登录后再看
以及vi /etc/pam.d/login,添加:
session required pam_limits.so
修改ulimit:vi /etc/profile,添加:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536a
else
ulimit -u 16384 -n 65536
fi
fi修改环境变量。vi ~oracle/.bash_profile,添加:
ORACLE_BASE=/orcl/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
ORACLE_SID=orcl
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export PATH用yum remove *openjdk* 把系统自带的openjdk卸载,再安装sun jdk:rpm -ivh jdk-8u144-linux-x64.rpm。(下载地址)(openjdk环境安装oracle GUI会报class not found的错)。然后$>java -version检查一下安装是否成功。上述工作完成后,建议重启系统。
以上操作命令如下:
以oracle用户登录,开始安装:
su oracle
cd /orcl/app/oracle
unzip linuxx64\_12201\_database.zip
export LANG="en\_US"
cd /orcl/app/oracle/database
./runInstaller
注:下载好的Oracle要放到/orcl/app/oracle目录下,/orcl/app/oracle/下是2个目录:product和database。解压后的安装文件放在database下。然后就会出现安装界面,配置过程从略。需要注意的是字符集要选择unicode。如下
1. ![](https://www.linuxidc.com/upload/2017_08/170827091363902.png)
![](https://www.linuxidc.com/upload/2017_08/170827091363903.png)
![](https://www.linuxidc.com/upload/2017_08/170827091363904.png)
![](https://www.linuxidc.com/upload/2017_08/170827091363905.png)
![](https://www.linuxidc.com/upload/2017_08/170827091363906.png)
![](https://www.linuxidc.com/upload/2017_08/170827091363909.png)
![](https://www.linuxidc.com/upload/2017_08/1708270913639010.png)
![](https://www.linuxidc.com/upload/2017_08/1708270913639011.png)
- 安装中
![](https://www.linuxidc.com/upload/2017_08/1708270913639012.png)
- 安装完成
![](https://www.linuxidc.com/upload/2017_08/1708270913639013.png)
然后输入dbca启动数据图形化界面装数据库
选择配置:这里我们选择高级配置,简单的自测
![](https://www.linuxidc.com/upload/2017_08/1708270913639015.png)
- 根据自己需求配置:我选择定制的数据库(custom database)
![](https://www.linuxidc.com/upload/2017_08/1708270913639016.png)
- 配置数据库容器:
![](https://www.linuxidc.com/upload/2017_08/1708270913639017.png)
- 配置数据库存储方式:
![](https://www.linuxidc.com/upload/2017_08/1708270913639018.png)
- 选择快速恢复区域:
![](https://www.linuxidc.com/upload/2017_08/1708270913639019.png)
- 监听器配置:(创建数据库自动创建监听器,一定要是LISTENER默认的)
- 选择数据库组件:
![](https://www.linuxidc.com/upload/2017_08/1708270913639021.png)
- 数据库安全配置:
![](https://www.linuxidc.com/upload/2017_08/1708270913639022.png)
- 内存、块、连接数量、字符集、连接模式、添加实例:
![](https://www.linuxidc.com/upload/2017_08/1708270913639023.png)
![](https://www.linuxidc.com/upload/2017_08/1708270913639024.png)![](https://www.linuxidc.com/upload/2017_08/1708270913639031.png)
![](https://www.linuxidc.com/upload/2017_08/1708270913639025.png)
- 配置Orale EM 土豪可以去订购功能强大的EM:
![](https://www.linuxidc.com/upload/2017_08/1708270913639026.png)
- 口令配置:我是用的是统一口令
![](https://www.linuxidc.com/upload/2017_08/1708270913639027.png)
- 创建数据库配置:
![](https://www.linuxidc.com/upload/2017_08/1708270913639028.png)
- 总结界面:(如果没有任何错误就可以finish安装)
1. 请一定先执行/orcl/app/oracle/product/12.1.0/db\_1/root.sh
cd /orcl/app/oracle/product/12.1.0/db\_1
./root.sh
- 安装完成(一切顺利,未见报错)
![](https://www.linuxidc.com/upload/2017_08/1708270913639032.png)
### 启动
1.#su - oracle 切换到 oracle 用户且切换到它的环境
2.$lsnrctl status 查看监听及数据库状态
3.$lsnrctl start 启动监听
4.$sqlplus / as sysdba 以 DBA 身份进入 sqlplus
5.SQL>startup 启动 db
### 停止
1.#su - oracle 切换到 oracle 用户且切换到它的环境
2.$lsnrctl stop 停止监听
3.$sqlplus / as sysdba 以 DBA 身份进入 sqlplus
4.SQL>SHUTDOWN IMMEDIATE 关闭 db