系统centos7.4 mini
关闭selinux、firewalld
配置主机名:
hostnamectl set-hostname --static oracle
之前说oracle不认centos这里改成了redhat
[root@oracle ~]# cat /etc/redhat-release
redhat-7
安装包依赖:
yum -y install binutils* compat-libcap1* compat-libstdc++* gcc* gcc-c++* glibc* glibc-devel* ksh* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXi* libXtst* make* sysstat* elfutils* unixODBC*
创建oinstall和dba组
创建oinstall和dba组
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
创建oracle用户
/usr/sbin/useradd -g oinstall -G dba oracle
设置oracle用户密码
passwd oracle
验证创建是否正确
[root@oracle ~]# id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
配置内核参数:
[root@oracle ~]# egrep -v "^#|^$" /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648 #最低:536870912,最大值:比物理内存小1个字节的值,建议超过物理内存的一半
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
参数的值不能小于上面的配置,这是oracle官方建议的最小值,生产环境建议调整这些参数,以优化系统性能。修改后使之生效
[root@oracle ~]# /sbin/sysctl -p
修改用户限制
[root@oracle ~]# egrep -v "^#|^$" /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
增加oracle用户环境变量
[root@oracle ~]# vi /home/oracle/.bash_profile
export PATH
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG=C
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
创建目录结构:
mkdir -p /data/oracle
mkdir -p /data/oraInventory
mkdir -p /data/oracle/product/11.2.0/db_1
mkdir -p /data/oracle/backup
chown -R oracle:oinstall /data/oracle
chown -R oracle:oinstall /data/oraInventory
配置完毕后可以reboot
解压安装包:
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
把解压后的包放在了/home/oracle/目录下:
[root@oracle ~]# ls -ld /home/oracle/database/
drwxr-xr-x 8 oracle oinstall 128 Jul 3 14:04 /home/oracle/database/
切换用户
su - oracle
配置静默安装文件:
[oracle@oracle ~]$ ls database/response/
db_install.rsp dbca.rsp netca.rsp
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答
[oracle@oracle ~]$ less /home/oracle/database/response/db_install.rsp |grep -v "#"|grep -v "^$"
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 #默认即可
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oraInventory #oracle建议此目录不要存放在ORACLE_BASE下面
SELECTED_LANGUAGES=en,zh_CN #配置语言
ORACLE_HOME=/data/oracle/product/11.2.0/db_1 #安装目录
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE #oracle版本
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE #数据库类型
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500 #自动管理内存的内存(M)
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.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
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=FILE_SYSTEM_STORAGE #文件系统存储
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 #设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
开始安装
[oracle@oracle database]$ ./runInstaller -silent -force -ignorePrereq -responseFile /home/oracle/response/db_install.rsp
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
-----------------------------------------------------------------------------
su - root
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
配置监听程序
netca /silent /responsefile /home/oracle/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /home/oracle/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/data/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
查看监听服务:
[oracle@oracle ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-JUL-2018 15:34:33
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 03-JUL-2018 16:23:55
Uptime 0 days 23 hr. 10 min. 39 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.49.252.27)(PORT=1521)))
The listener supports no services
The command completed successfully
创建数据库
[oracle@oracle database]$ dbca -silent -responseFile /home/oracle/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/data/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
大功告成可以登陆oracle
[oracle@oracle database]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 4 15:57:12 2018
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
删除实例:
dbca -silent -deleteDatabase -sourcedb orcl
=======================过程中遇到的问题:
[SEVERE] - Email Address Not Specified
命令如下:
./runInstaller -silent -noconfig -ignoreSysPreReqs -responseFile /home/oracle/database/response/db_install.rsp
参数
DECLINE_SECURITY_UPDATES=true
也已经修改为true.
不思不得其解时,将命令改成
./runInstaller -ignoreSysPreReqs -silent -noconfig -responseFile /home/oracle/database/response/db_install.rsp
居然可以了。各位有没有遇到过这种情况的,还是其他原因造成。
来源:https://www.cnblogs.com/menkeyi/p/9262020.html