CREATE TABLESPACE ds_tablespace DATAFILE '/data/oracle/oradata/ds/ds_tablespace.dbf' SIZE 200M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
配置好网络IP为192.168.162.155
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
百度云:
链接:http://pan.baidu.com/s/1gf1oJJH 密码:1ivl
-rw-r--r--. 1 root root 1239269270 Sep 23 19:25 linux.x64_11gR2_database_1of2.zip
-rw-r--r--. 1 root root 1111416131 Sep 23 19:25 linux.x64_11gR2_database_2of2.zip
[root@localhost ~]#yum install unzip –y
[root@localhost ~]# cd /home
[root@localhost home]# unzip linux.x64_11gR2_database_1of2.zip
[root@localhost home]# unzip linux.x64_11gR2_database_2of2.zip
解压完成后,机会在/home目录下生成一个database文件夹,里面就是oracle安装文件
[root@localhost ~]#yum install vim -y
a. 查看主机名
[root@localhost ~]#hostname
localhost.localdomain
b. 添加到hosts文件中
[root@localhost ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.162.155 loaclhost.localdomain
[root@localhost ~]# vim /etc/selinux/config
设置 ELINUX=disabled
使配置文件生效
[root@localhost ~]# setenforce 0
[root@localhost ~]# service iptables stop
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# yum install gcc make binutils gcc-c++ compat-libstdc++-33elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-develnumactl-devel sysstat unixODBC unixODBC-devel pcre-devel –y
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle
[root@localhost ~]# passwd oracle
[root@localhost ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) 组=1001(oinstall),1002(dba)
[root@localhost ~]# vim /etc/sysctl.conf
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
其中kernel.shmmax = 536870912为本机物理内存(1G)的一半,单位为byte
查看配置是否生效
[root@loaclhost ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
[root@localhost ~]# vim /etc/security/limits.conf
添加如下内容
#@student - maxlogins 4
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
[root@localhost ~]# vim /etc/pam.d/login
添加如下内容:
session required /lib64/security/pam_limits.so
session required pam_limits.so
[root@localhost ~]# mkdir -p /data/oracle/product/11.2.0
[root@localhost ~]# mkdir /data/oracle/oradata
[root@localhost ~]# mkdir /data/oracle/inventory
[root@localhost ~]# mkdir /data/oracle/fast_recovery_area
[root@localhost ~]# chown -R oracle:oinstall /data/oracle
[root@localhost ~]# chmod -R 777 /data/oracle
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ vim .bash_profile
添加如下内容:
ORACLE_BASE=/data/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOME
NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK; export NLS_LANG
ORACLE_SID=ds; export ORACLE_SID
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/jdk/bin:/sbin;
export PATH
BIN=$ORACLE_HOME/bin; export BIN
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
export LANG=en_US.UTF-8
注意,ORACLE_SID=ds与创建的数据库实例名称一致,否则数据库启动后无法访问。
配置完后使用命令使配置生效
[oracle@localhost ~]$ source .bash_profile
#使用echo $ORACLE_BASE或者echo $ORACLE_HOME#查看配置的信息是否生效,如果正确的话是和你的配置是一致的
退出在登录,使得环境变量的配置生效
exit
su - oracle
env | grep ORA
[oracle@loaclhost ~]$ env |grep ORA
ORACLE_SID=ds
ORACLE_BASE=/data/oracle
ORACLE_HOME=/data/oracle/product/11.2.0
a. 将响应文件复制到oracle用户家目录 即/home/oracle
[oracle@localhost ~]$ cp -R /home/database/response/ .
[oracle@localhost ~]$ ll
总用量 0 drwxr-xr-x.2 oracle oinstall 58 5月 12 20:15 response
b. 编辑相应文件
[oracle@localhost ~]$ cd response/
[oracle@localhost response]$ vim db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=localhost
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/oracle/product/11.2.0
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
[oracle@localhost database]$ cd /home/database/
[oracle@localhost database]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
#开始Oracle在后台静默安装。安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在后台进行,如果出现[FATAL],则安装程序已经停止了
可以切换终端执行 tail -f /data/oracle/inventory/logs/installActions2015-06-08_04-00-25PM.log 命令查看后台安装程序日志
当出现以successfully Setup Software提示时,代表安装成功
2.安装成功后,按照要求执行脚本
[root@localhost ~]# sh /data/oracle/inventory/db_1/orainstRoot.sh
[root@localhost ~]# sh /data/oracle/product/11.2.0/root.sh
重新使用oracle用户登录,命令安装
[oracle@localhost ~]$ netca /silent /responseFile /home/oracle/response/netca.rsp
成功运行后,在/data/oracle/product/11.2.0/db_1/network/admin/中生成listener.ora和sqlnet.ora
==修改listener.ora文件==
# listener.ora Network Configuration File: /data/oracle/product/11.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.162.155)(PORT = 1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
#BEQUEATH CONFIG
(GLOBAL_DBNAME=ds)
(SID_NAME=ds)
(ORACLE_HOME=/data/oracle/product/11.2.0)
#PRESPAWN CONFIG
(PRESPAWN_MAX=20)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
)
)
)
ADR_BASE_LISTENER = /data/oracle
通过netstat命令可以查看1521端口正在监听。
Yum安装netstat软件,软件包是在net-tools中。
[root@localhost ~]# yum install net-tools
[root@localhost ~]# netstat -tnulp | grep 1521
tcp 0 0 192.168.162.155:1521 0.0.0.0:* LISTEN 2083/tnslsnr
以oracle用户登录,再次进去响应文件夹
[oracle@localhost ~]$ vim /home/oracle/response/dbca.rsp
设置以下参数:
GDBNAME= “ds”
SID =” ds”
SYSPASSWORD= “ system@2017”
SYSTEMPASSWORD= “system@2017”
SYSMANPASSWORD= “ system@2017”
DBSNMPPASSWORD= “ system@2017”
DATAFILEDESTINATION=/data/oracle/oradata
RECOVERYAREADESTINATION=/data/oracle/fast_recovery_area
CHARACTERSET= “ZHS16GBK”
TOTALMEMORY= “819”
进行静默配置:
[oracle@localhost ~]$ dbca -silent -responseFile /home/oracle/response/dbca.rsp
停止监听
lsnrctl stop
启动监听
lsnrctl start
查看监听状态
lsnrctl states
登录查看实例状态:
[oracle@localhost ~]$ sqlplus / as sysdba
[oracle@loaclhost response]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Sep 24 17:00:29 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
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> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@loaclhost response]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Sep 24 17:10:07 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
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>
1.创建表空间
2.创建用户名和密码
CREATE USER inspur IDENTIFIED BY inspur DEFAULT TABLESPACE ds_tablespace;
3.用户授权
SQL> grant connect,resource to inspur;
SQL>grant unlimited tablespace to inspur;
SQL>grant create database link to inspur;
SQL>grant select any sequence,create materialized view to inspur;
SQL>grant unlimited tablespace to inpsur;
SQL>grant select any table to inspur;
SQL>grant create table to inspur;
SQL>grant create view to inspur;
- 修改/data/oracle/product/11.2.0/bin/dbstart
[oracle@localhost ~]$ vim /data/oracle/product/11.2.0/bin/dbstart
#将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME(大约在12%行左右)
- 修改/data/oracle/product/11.2.0/bin/dbshut
[oracle@localhost ~]$ vim /data/oracle/product/11.2.0/bin/dbshut
#将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME(大约12%左右)
- 修改/etc/oratab文件
oracle@localhost ~]$ vim /etc/oratab
#将ds:/data/oracle/product/11.2.0:N中最后的N改为Y,成为ds:/data/oracle/product/11.2.0:Y
- 输入命令dbshut和dbstart测试
4.1 测试dbshut,监听停止
4.2测试dbstart:监听启动
- 配置rc.local (root用户执行)
su -
vi /etc/rc.d/rc.local
su - oracle -lc "/data/oracle/product/11.2.0/bin/dbstart $ORACLE_HOME"
最后根据提示需要运行 chmod+x /etc/rc.d/rc.local
[root@localhost ~]#chmod 777 /etc/rc.d/rc.local
这里要注意的是dbstart一定要写全路径,否则有可能无法正确调用。
参考文章:
Oracle 11g 基于CentOS7静默安装教程(无图形界面,远程安装)
ORACLE监听器 The listener supports no services 问题解决方法