赞
踩
环境:centos7 3.10.0-1062.el7.x86_64
软件包地址(永久有效):
链接:https://pan.baidu.com/s/1TrlnUZlD4-ByMdkQlTqg1w
提取码:aec5
安装前准备工作,虚拟机内存建议2GB以上,磁盘空间目录大于20G,我在这里是添加了一块80G的硬盘,挂载到/oradate作为安装目录(友情提示:我是完全安装使用以后写的文档)
[root@localhost ~]# df -h |grep oradate
/dev/sdb1 74G 11G 60G 16% /oradate
机器基础信息关闭,selinux,防火墙,不必要服务
[root@localhost ~]# setenforce 0
[root@localhost ~]# sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/sysconfig/selinux
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
修改用户的限制文件
[root@localhost ~]# vim /etc/security/limits.conf
# 在文件后增加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
修改内核参数
[root@localhost ~]# vim /etc/sysctl.conf # 添加一下内容 net.ipv4.ip_local_port_range = 32768 60999 fs.file-max = 185933 kernel.shmall = 4294967296 kernel.shmmax = 68719476736 kernel.shmmni = 4096 kernel.sem = 250 32000 32 128 net.core.rmem_max = 124928 net.core.rmem_default = 124928 net.core.wmem_max = 124928 net.core.wmem_default = 124928 fs.aio-max-nr = 1048576 # sysctl -p是配置生效 [root@localhost ~]# sysctl -p net.ipv4.ip_local_port_range = 32768 60999 fs.file-max = 6815744 kernel.shmall = 4294967296 kernel.shmmax = 68719476736 kernel.shmmni = 4096 kernel.sem = 250 32000 32 128 net.core.rmem_max = 124928 net.core.rmem_default = 124928 net.core.wmem_max = 124928 net.core.wmem_default = 124928 fs.aio-max-nr = 1048576
提前安装相关依赖包
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
建立用户、组、设置密码,创建相关目录 。
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# groupadd oper
[root@localhost ~]# useradd -g oinstall -G dba,oper oracle
[root@localhost ~]# echo "oracle" | passwd --stdin oracle
# 安装目录
[root@localhost ~]# mkdir -p /vardate/app/oracle/product/11.2.0/dbhome_1
# 数据备份目录
[root@localhost ~]# mkdir -p /vardate/oracle/backup
# 清单目录,数据库创建及使用过程中的日志目录
[root@localhost ~]# mkdir -p /vardate/oracle/oraInventory
# 修改权限
[root@localhost ~]# chown -R oracle:oinstall /oradate
[root@localhost ~]# chmod -R 775 /oradate
暂时给oracle root用户权限,防止安装过程总有些命令不能用,企业环境只赋予用到的权限即可,我这里是为了方便,这是不安全的。
[root@localhost ~]# visudo
# 添加以下一行记录
oracle ALL=(ALL) ALL
设置环境变量su - oracle 切换到oracle目录,切换之后的操作在oracle用户操作,
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ cd
[oracle@localhost ~]$ vim .bash_profile
# 文件添加以下内容
export ORACLE_BASE=/oradate/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ora11g
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
[oracle@localhost ~]$ source /home/oracle/.bash_profile
上传oracle 11g安装包到/oradate目录下后按顺序解压,先1后2
[oracle@localhost oradate]$ cd /oradate/
[oracle@localhost oradate]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@localhost oradate]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。三个文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答
[oracle@localhost oracle]$ cd response/
[oracle@localhost response]$ ls
dbca.rsp db_install.rsp netca.rsp
复制一份模板,添加备份。
[oracle@localhost oradate]$ cp -R /oradate/app/oracle/database/response /oradate/oracle
修改配置文件,安装oracle软件 。
# 按照以下配置,具体参数含义可自行百度,如果安装了图形化界面工具也可以使用图形化界面安装,具体自行百度 [oracle@localhost response]$ grep -Ev "^#|^$" /oradate/app/oracle/database/response/db_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=bigdata06 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/oradate/app/oracle/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/oradate/app/oracle/product/11.2.0/dbhome_1 ORACLE_BASE=/oradate/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.EEOptionsSelection=false oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0 oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oinstall oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall=false oracle.install.db.racOneServiceName= oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=ora11g oracle.install.db.config.starterdb.SID=ora11g oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=1500 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true oracle.install.db.config.starterdb.password.ALL=oracle oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.SYSMAN= oracle.install.db.config.starterdb.password.DBSNMP= oracle.install.db.config.starterdb.control=DB_CONTROL oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= oracle.install.db.config.starterdb.automatedBackup.enable=false oracle.install.db.config.starterdb.automatedBackup.osuid= oracle.install.db.config.starterdb.automatedBackup.ospwd= oracle.install.db.config.starterdb.storageType= oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= SECURITY_UPDATES_VIA_MYORACLESUPPORT= DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD= PROXY_REALM= COLLECTOR_SUPPORTHUB_URL= oracle.installer.autoupdates.option= oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD= [oracle@localhost response]$
开始静默安装
[oracle@localhost response]$ cd /oradate/app/oracle/database
[oracle@localhost response]$ ./runInstaller -silent -responseFile /oradate/app/oracle/database/response/db_install.rsp
当安装界面出现如下信息的时候,先不要动:
The installation of Oracle Database 11g was successful.
.....................
....................
As a root user, execute the following script(s):
\1. /var/app/oracle/oraInventory/orainstRoot.sh
\2. /var/app/oracle/product/11.2.0/dbhome_1/root.sh
Successfully Setup Software.
另外打开一个shell窗口:
[oracle@localhost response]$ /oradate/app/oracle/oraInventory/orainstRoot.sh
[oracle@localhost response]$ /oradate/app/oracle/product/11.2.0/dbhome_1/root.sh
执行完上面的脚本后回到安装界面按下Enter键以继续
配置oracle监听
[oracle@localhost response]$ cd /oradate/app/oracle/database/response
[oracle@localhost response]$ netca /silent /responsefile /oradate/app/oracle/database/response/netca.rsp
成功运行后,在/oradate/app/oracle/product/11.2.0/dbhome_1/network/admin目录下
生成sqlnet.ora和listener.ora两个文件。
看到监听器已经在1521端口
[oracle@localhost response]$ netstat -tlnp | grep 1521
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::1521 :::* LISTEN 46843/tnslsnr
配置oracle数据库,修改建库配置文件
[oracle@localhost response]$ vim /oradate/app/oracle/database/response/dbca.rsp
GDBNAME = "ora11g.dg01" //78行 全局数据库的名字=SID+主机域名
SID="ora11g" //149行 对应的实例名字(环境变量export ORACLE_SID=ora11g配置相同,否则出现错误)
SYSPASSWORD = "oracle" //190行
SYSTEMPASSWORD = "oracle" //200行
CHARACTERSET="AL32UTF8" //415行 编码,字符集,重要!!! 建库后一般不能更改,所以建库前要确定清楚
NATIONALCHARACTERSET="UTF8" //425行 编码
创建dbca数据库
[oracle@localhost response]$ dbca -silent -responseFile \
/oradate/app/oracle/database/response/dbca.rsp
启动数据库
进入oracle SQL命令行
[oracle@localhost response]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 8 23:59:11 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
数据库监听和数据库启动停止
# 数据库启动
SQL> startup
# 数据库停止
SQL> shutdown immediate
# 监听启动/停止/状态
[oracle@localhost response]$ lsnrctl start
[oracle@localhost response]$ lsnrctl stop
[oracle@localhost response]$ lsnrctl status
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。