update
This commit is contained in:
parent
a62118e514
commit
b13dd08f6c
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: "CentOS7.4 静默安装 Oracle11g"
|
||||
date: 2019-10-30T11:54:49+08:00
|
||||
lastmod: 2019-10-30T11:54:49+08:00
|
||||
lastmod: 2022-04-19T12:00:00+08:00
|
||||
tags: ["oracle"]
|
||||
categories: ["database"]
|
||||
---
|
||||
@ -17,11 +17,27 @@ categories: ["database"]
|
||||
```bash
|
||||
sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
|
||||
```
|
||||
|
||||
- 关闭防火墙,或者放行 tcp 1521 端口
|
||||
```bash
|
||||
systemctl disable firewalld
|
||||
systemctl stop firewalld
|
||||
```
|
||||
|
||||
- 检查交换内存(swap)大小,建议内存一半以上,如果没有设置虚拟内存,可参考如下操作
|
||||
```bash
|
||||
dd if=/dev/zero bs=1024 count=1048576 of=/SWAP # 1GB
|
||||
chmod 0600 /SWAP
|
||||
echo '/SWAP swap swap defaults 0 0' >> /etc/fstab
|
||||
swapon /SWAP
|
||||
```
|
||||
|
||||
- 调整 /etc/fstab,调整共享内存分区的大小
|
||||
```
|
||||
tmpfs /dev/shm tmpfs defaults,size=5120M 0 0
|
||||
# 这里的 5120M 是要调整的共享内存分区的大小,建议大小为内存一半以上
|
||||
```
|
||||
|
||||
- 重启操作系统
|
||||
```bash
|
||||
reboot
|
||||
@ -35,6 +51,7 @@ categories: ["database"]
|
||||
yum makecache fast
|
||||
yum install vim unzip rlwrap
|
||||
```
|
||||
|
||||
- 安装 oracle 需要的包
|
||||
```bash
|
||||
yum install binutils compat-libcap1 compat-libstdc++-33 \
|
||||
@ -52,6 +69,7 @@ categories: ["database"]
|
||||
groupadd dba
|
||||
useradd -g oinstall -G dba oracle
|
||||
```
|
||||
|
||||
- 创建 oracle 安装目录
|
||||
```bash
|
||||
mkdir -p /opt/oracle/app/product/11.2.0
|
||||
@ -61,6 +79,7 @@ categories: ["database"]
|
||||
chown -R oracle:oinstall /opt/oracle
|
||||
chmod -R 775 /opt/oracle
|
||||
```
|
||||
|
||||
- 修改 sysctl.conf
|
||||
```bash
|
||||
cat << EOF >> /etc/sysctl.conf
|
||||
@ -80,6 +99,7 @@ categories: ["database"]
|
||||
EOF
|
||||
sysctl -p
|
||||
```
|
||||
|
||||
- 修改 limits.conf
|
||||
```bash
|
||||
cat << EOF >> /etc/security/limits.conf
|
||||
@ -89,6 +109,7 @@ categories: ["database"]
|
||||
oracle hard nofile 65536
|
||||
EOF
|
||||
```
|
||||
|
||||
- 修改 login
|
||||
```bash
|
||||
cat << EOF >> /etc/pam.d/login
|
||||
@ -96,6 +117,7 @@ categories: ["database"]
|
||||
session required pam_limits.so
|
||||
EOF
|
||||
```
|
||||
|
||||
- 修改 profile
|
||||
```bash
|
||||
cat << EOF >> /etc/profile
|
||||
@ -110,6 +132,7 @@ categories: ["database"]
|
||||
fi
|
||||
EOF
|
||||
```
|
||||
|
||||
- 修改 oracle 用户的 .bash_profile
|
||||
```bash
|
||||
cat << EOF >> /home/oracle/.bash_profile
|
||||
@ -129,15 +152,18 @@ categories: ["database"]
|
||||
unzip linux.x64_11gR2_database_2of2.zip -d /home/oracle/
|
||||
chown -R oracle.oinstall /home/oracle/database
|
||||
```
|
||||
|
||||
- 切换到 oracle 用户,后续操作都在该 oracle 用户下执行
|
||||
```bash
|
||||
su - oracle
|
||||
```
|
||||
|
||||
- 创建 response 文件
|
||||
```bash
|
||||
cd /home/oracle
|
||||
cp database/response/*.rsp ./
|
||||
```
|
||||
|
||||
- 修改 db_install.rsp
|
||||
```bash
|
||||
sed -i \
|
||||
@ -154,6 +180,7 @@ categories: ["database"]
|
||||
-e '/^DECLINE_SECURITY_UPDATES=/s#=.*$#=true#' \
|
||||
/home/oracle/db_install.rsp
|
||||
```
|
||||
|
||||
- 无需修改 netca.rsp
|
||||
- 修改 dbca.rsp
|
||||
```bash
|
||||
@ -165,6 +192,7 @@ categories: ["database"]
|
||||
-e '/^CHARACTERSET=/s#=.*$#=ZHS16GBK#' \
|
||||
/home/oracle/dbca.rsp
|
||||
```
|
||||
|
||||
- 安装 oracle 软件
|
||||
```bash
|
||||
cd /home/oracle/database
|
||||
@ -173,20 +201,22 @@ categories: ["database"]
|
||||
/opt/oracle/invertory/orainstRoot.sh
|
||||
/opt/oracle/app/product/11.2.0/root.sh
|
||||
```
|
||||
|
||||
- 配置监听
|
||||
```bash
|
||||
netca /silent /responseFile /home/oracle/netca.rsp
|
||||
#配置成功后,监听启动,查看监听状态
|
||||
lsnrctl status
|
||||
```
|
||||
|
||||
- 创建数据库
|
||||
```bash
|
||||
dbca -silent -responseFile /home/oracle/dbca.rsp
|
||||
#查看屏幕输出的创建进度
|
||||
```
|
||||
|
||||
## 简单使用
|
||||
- 登陆数据库
|
||||
## 启动数据库
|
||||
- 登陆 sysdba,启动数据库
|
||||
```
|
||||
[oracle@localhost ~]$ rlwrap sqlplus / as sysdba
|
||||
SQL*Plus: Release 11.2.0.1.0 Production on 星期一 6月 25 14:46:58 2018
|
||||
@ -194,6 +224,33 @@ categories: ["database"]
|
||||
连接到:
|
||||
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
|
||||
With the Partitioning, OLAP, Data Mining and Real Application Testing options
|
||||
SQL>
|
||||
SQL> startup
|
||||
```
|
||||
|
||||
### 启动报错 LRM-00109
|
||||
- 详细报错信息如下:
|
||||
```
|
||||
ORA-01078: failure in processing system parameters
|
||||
LRM-00109: could not open parameter file 'cd /opt/oracle/app/product/11.2.0/dbs/initorcl.ora'
|
||||
```
|
||||
|
||||
- 创建 initorcl.ora 文件
|
||||
```bash
|
||||
cd /opt/oracle/app
|
||||
cp admin/orcl11g/pfile/init.ora.* product/11.2.0/dbs/initorcl.ora
|
||||
```
|
||||
|
||||
### 启动报错 ORA-00845
|
||||
- 详细报错信息如下:
|
||||
```
|
||||
ORA-00845: MEMORY_TARGET not supported on this system
|
||||
```
|
||||
|
||||
- 调整 /etc/fstab,增加如下配置
|
||||
```
|
||||
tmpfs /dev/shm tmpfs defaults,size=5120M 0 0
|
||||
# 这里的 5120M 是要调整的共享内存分区的大小
|
||||
```
|
||||
|
||||
- 重启服务器
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user