本文表述了Oracle 11g2在Oracle Linux 7上的安装及配置方法。

目录

  1. 步骤
    1. 安装前准备
    2. 开始安装
    3. 创建数据库
  2. 参考

步骤

安装前准备

通过安装 oracle-rdbms-server-11gR2-preinstall RPM 软件包简化Oracle Database 11g 安装:

1
yum install oracle-rdbms-server-11gR2-preinstall

安装依赖包:

1
yum install binutils compat-libstdc++  elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc glibc-common glibc-devel glibc-devel glibc-headers ksh libaio libaio libaio-devel libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC

开始安装

下载并解压文件:

1
2
3
4
mkdir /home/OraDB11g
cd /home/OraDB11g/
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

编辑db_install.rsp文件,以准备静默安装:

1
2
yum install nano
nano /home/OraDB11g/database/response/db_install.rsp

db_install.rsp参考配置

创建安装路径及执行用户:

1
2
3
mkdir /u01
chown oracle:oinstall /u01
passwd oracle

进行静默安装:

1
2
3
4
5
6
7
8
su oracle
/home/OraDB11g/database/runInstaller -silent -responseFile /home/OraDB11g/database/response/db_install.rsp -ignorePrereq
mkdir /u01/app/oracle/admin/control
mkdir /u01/app/oracle/admin/logs
mkdir /u01/app/oracle/admin/logs/orcl
exit
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.1/db_1/root.sh

配置环境路径:

1
2
3
4
5
6
7
8
echo "export ORACLE_HOME=/u01/app/oracle/product/11.2.0.1/db_1" >> ~/.bashrc
echo "export PATH=$ORACLE_HOME/bin:$PATH" >> ~/.bashrc
echo "export ORACLE_SID=ORCL" >> ~/.bashrc

su oracle
echo "export ORACLE_HOME=/u01/app/oracle/product/11.2.0.1/db_1" >> ~/.bashrc
echo "export PATH=$ORACLE_HOME/bin:$PATH" >> ~/.bashrc
echo "export ORACLE_SID=ORCL" >> ~/.bashrc

创建数据库

创建数据库存储路径:

1
2
mkdir /u01/app/oracle/oradata/
mkdir /u01/app/oracle/oradata/orcl/

编辑/u01/app/oracle/product/11.2.0.1/db_1/dbs/initorcl.ora文件:

1
2
3
4
5
6
7
db_name=orcl
memory_target=1G
CONTROL_FILES = (/u01/app/oracle/admin/control/control01.ctl,
/u01/app/oracle/admin/control/control02.ctl,
/u01/app/oracle/admin/control/control03.ctl)
db_unique_name=orcl
instance_name=orcl

使用sqlplus / as sysdba执行SQL语句:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
startup nomount
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/admin/logs/orcl/redo01b.log') SIZE 128M,
GROUP 2 ('/u01/app/oracle/admin/logs/orcl/redo02b.log') SIZE 128M,
GROUP 3 ('/u01/app/oracle/admin/logs/orcl/redo03b.log') SIZE 128M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 3
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf' SIZE 512M
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/orcl/system01.dbf' SIZE 512M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf' SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 32M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/app/oracle/oradata/orcl/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

参考

如何简化 Oracle Linux 上 Oracle Database 的安装

如何简化 Oracle Linux 6 上的 Oracle 数据库安装

Oracle 11g R2 64bit 安装(Oracle linux 7实践,帮助新手安装oracle) - 晓 - 博客频道 - CSDN.NET