安装要求(本人的配置):CentOS7虚拟机,内存至少1G,磁盘大小40G往上(最低要求),不然后面空间不足你肯定装不上,吃了大亏!!!后来本人扩展到60G。
以下为步骤,为确保可用,建议安装时命令手动键入:
首先root身份进入系统:
- vi /etc/hosts
Add:
127.0.0.1 localhost.localdomain localhost
202.197.33.72 leilab leilab
- vi /etc/sysctl.conf
Add:
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmni = 4096
# semaphores:semmsl,semmns,semopm,semmni
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 = 1048586
运行命令: /sbin/sysctl -p 使之生效。
- vi /etc/security/limits.conf
Add:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
- vi /etc/pam.d/login
Add:
session required pam_limits.so
- vi /etc/profile
Add:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
6.Install packages
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel
你会发现pdksh没有安装成功,可以通过wget命令直接下载pdksh的rpm包,下载到了/tmp/:
wget -O /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
进入/tmp/,
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
这时pdksh已经安装成功。
7.Create new groups and users
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
//设置密码
passwd oracle
8.Create directories
目录结构如图所示,使用mkdir命令
在这里要把文件夹的权限给oracle用户,不然后续切换到oracle用户时没法操作里面的文件:
chown -R oracle:oinstall /ifs/oracle
chmod -R 777 /ifs/oracle
切换到oracle用户
9. su - oracle
vi .bash_profile
Add:
ORACLE_BASE=/ifs/oracle/home
ORACLE_HOME=/ifs/oracle/home/oracle_11g
ORACLE_SID=ora11g
PATH=$PATH:$HOME/bin
PATH=$ORACLE_HOME/bin:$PATH
export PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
10.cd /fs/oracle/
下载Oracle安装包(使用中南大学校园网可直接用,否则可能不能直接用wget,但是使用迅雷可以下载下来,然后使用xftp工具上传到CentOS,这里推荐虚拟机下CentOS7开启SSH连接)
wget ftp://ftpsoft:ftpsoft@202.197.41.101:8292/soft/linux.x64_11gR2_database_1of2.zip
wget ftp://ftpsoft:ftpsoft@202.197.41.101:8292/soft/linux.x64_11gR2_database_2of2.zip
解压Oracle安装包
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
- vi /ifs/oracle/response/db_install_rsp
oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=leilab
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/ifs/oracle/home/oraInventory
ORACLE_HOME=/ifs/oracle/home/oracle_11g
ORACLE_BASE=/ifs/oracle/home
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.globalDBName=ora_11g
oracle.install.db.config.starterdb.SID=ora11g
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.password.ALL=Oracle11g
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/ifs/oracle/home/db_file
DECLINE_SECURITY_UPDATES=true
12.run install
./runInstaller -silent -ignorePrereq -responseFile /ifs/oracle/database/response/db_install.rsp //注意!!!这时,你当前所在目录应为database,但是一定!!!要使用这个/ifs/oracle/database/response/db_install.rsp绝对路径,心在滴血。。。。
这时候会报[warning],只要并不出现[Fatal]忽略即可,等待安装结束,提示Successfully Setup Software。
切换到root用户
13.Change the role to root
sh /ifs/oracle/home/oraInventory/orainstRoot.sh
sh /ifs/oracle/home/oracle_11g/root.sh
切换到oracle用户:
14.Start DataBase
lsnrctl start
sqlplus / as sysdba //以管理员身份进入数据库,SQL*Plus界面。
====================================================
参考资料:
[1]https://blog.youkuaiyun.com/Kenny1993/article/details/75038670
[2]中南大学软件学院大型数据库实验指导书
拓展延申:
SQL*Plus的基本操作:https://blog.youkuaiyun.com/qq_38736612/article/details/83626904