Oracle安装EMCC
安装操作系统版本为Redhat 7.6
内核 8
内存 20G
Oracle软件包为 18c
EMCC软件包为 13c
替换yum:
1
2
3
|
rpm -qa| grep yum rpm -qa| grep yum| xargs rpm -e --nodeps(不检查依赖,直接删除rpm包) rpm -qa | grep yum (查询确认) |
下载centos 的yum并生成新的缓存
1
2
3
4
5
6
7
|
wget http: //mirrors .163.com /centos/7/os/x86_64/Packages/yum-3 .4.3-167.el7.centos.noarch.rpm wget http: //mirrors .163.com /centos/7/os/x86_64/Packages/yum-metadata-parser-1 .1.4-10.el7.x86_64.rpm wget http: //mirrors .163.com /centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1 .1.31-53.el7.noarch.rpm wget http: //mirrors .163.com /centos/7/os/x86_64/Packages/yum-utils-1 .1.31-53.el7.noarch.rpm<br><br>rpm -ivh *.rpm<br><br>wget -O /etc/yum .repos.d /Centos-7 .repo http: //mirrors .aliyun.com /repo/Centos-7 .repo<br><br>vim /etc/yum .repos.d /Centos-7 .repo<br><br>替换所有的$releasever为7<br>:%s/$releasever /7/g <br><br>yum clean all<br>yum makecache<br><br>yum repolist |
1
2
3
4
|
vim /etc/hostname 将主机名改为oraemcc 重启电脑生效 |
设置环境变量
1
2
|
echo "xhost + export DISPLAY=oraemcc:0.0" >> /etc/profile |
修改系统参数
1
2
3
4
|
echo "net.ipv4.ip_local_port_range = 11000 65000 <br>fs.aio-max-nr = 1048576 <br>fs.file-max = 6815744 <br>kernel.shmmni = 4096 <br>kernel.sem = 250 32000 100 128 <br>kernel.shmall = 2097152 <br>kernel.shmmax = 4294967295<br>net.ipv4.icmp_echo_ignore_broadcasts = 1 <br>net.ipv4.conf.all.rp_filter = 1 <br>net.core.rmem_default = 262144 <br>net.core.rmem_max= 4194304 <br>net.core.wmem_default= 262144 <br>net.core.wmem_max= 1048576" >> /etc/sysctl.conf sysctl -p 刷新sysctl文件使之生效 systemctl restart network 重启网络 |
关闭防火墙并设置开机不启动
1.防火墙
1
|
systemctl stop firewalld.service;systemctl disable firewalld.service |
2.SELINUX
1
2
3
|
setenforce 0 sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config |
安装预装包
1
2
3
|
yum install -y compat-libstdc+* elfutils-libelf-* elfutils-libelf-devel-* gcc-c++* libaio-devel-* libgcc-* libstdc+* \<br>libstdc+±devel-* make-* numactl-* sysstat-* glibc-common-* glibc-devel-* glibc-headers-* glibc-utils-* glibc-* \<br>binutils-* gcc-* libaio-* glibc-common-* libstdc++-* libXtst-* sysstat-* glibc-devel-* glibc-devel-* yum install -y binutils compat-libcap1 compat-libstdc++-33 ksh libaio libaio-devel libgcc libstdc++ \<br>libstdc++-devel libXext libXtst libX11 libXau libxcb libXi make sysstat libutil.so.1 tree<br><br>wget http: //mirror.centos.org/centos/7/os/x86_64/Packages/glibc-devel-2.17-307.el7.1.i686.rpm<br><br>rpm -ivh glibc-devel-2.17-307.el7.1.i686.rpm |
创建用户及组
1
2
3
4
5
6
7
|
groupadd oinstall #创建安装oracle程序用户组 groupadd dba #创建DBA用户组 useradd -g dba -m oracle #创建用户oracle 并加入到dba组 usermod -a -G oinstall oracle #将用户oracle加入到oinstall组 passwd oracle #修改用户oracle的密码# id oracle #查看用户oracle的信息 id oracle #查看用户Oracle的信息 |
创建安装目录
1
|
mkdir -p /u01/app/oracle/product/18c <br><br>mkdir /u01/app/oracle/{middleware,middlewareagent} |
将Oracle软件包下载至/u01/app/oracle/profuct/18c目录下
授权该目录给Oracle
1
|
chown -R oracle.oinstall /u01/* |
修改oracle用户的安全性能设置
修改文件: /etc/security/limits.conf
在文件最后一行前,追加以下内容
1
2
3
4
5
6
7
8
9
10
11
|
echo " export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/18c/ export ORACLE_SID=orcl export ORACLE_UNQNAME=orcl 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.AL32UTF8" >> /home/oracle/.bashrc source /home/oracle/.bashrc |
安装Oracle软件
解压安装包
1
|
cd /u01/app/oracle/product/18c<br>unzip oracle\ DB2018_Linux.zip |
切换至Oracle用户 su - oracle
安装主程序
1
|
cp
/u01/app/oracle/product/18c/install/response/db_install.rsp
/u01/app/oracle/product/18c/install/response/db_install.bck.rsp #备份文件模板<br><br>vim
/db_install.rsp<br><br>oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0<br>oracle.install.option=INSTALL_DB_SWONLY
# 安装类型<br>UNIX_GROUP_NAME=oinstall #
安装组<br>INVENTORY_LOCATION=/u01/app/oracle/oraInventory
#INVENTORY目录(不填就是默认值)<br>ORACLE_HOME=/u01/app/oracle/product/18c/<br>ORACLE_BASE=/u01/app/oracle/<br>oracle.install.db.InstallEdition=EE
#企业版本<br>oracle.install.db.OSDBA_GROUP=dba<br>oracle.install.db.OSOPER_GROUP=oinstall<br>oracle.install.db.OSBACKUPDBA_GROUP=oinstall<br>oracle.install.db.OSDGDBA_GROUP=oinstall<br>oracle.install.db.OSKMDBA_GROUP=oinstall<br>oracle.install.db.OSRACDBA_GROUP=oinstall<br>oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
#数据库类型<br>oracle.install.db.config.starterdb.globalDBName=orcl<br>oracle.install.db.config.starterdb.SID=orcl<br>oracle.install.db.config.starterdb.characterSet=AL32UTF8<br>oracle.install.db.config.starterdb.memoryOption= true <br>oracle.install.db.config.starterdb.memoryLimit=15360
#自动管理内存的内存(M)<br>oracle.install.db.config.starterdb.password.ALL=oracle #设定所有数据库用户使用同一个密码
<br>oracle.install.db.config.starterdb.enableRecovery= true <br><br><br><br><br>echo "SECURITY_UPDATES_VIA_MYORACLESUPPORT=false<br>DECLINE_SECURITY_UPDATES=true" >>
/u01/app/oracle/product/18c/install/response/db_install.rsp<br><br>执行db_install.rsp文件<br><br>cd
/u01/app/oracle/product/18c |
/u01/app/oracle/product/18c
/runInstaller
-ignorePrereq -waitforcompletion -silent
-responseFile
/u01/app/oracle/product/18c
/install/response/db_install
.rsp
。。
。。
。。
As a root user, execute the followingscript(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
切换至root用户执行两个脚本即可
安装监听,启动监听
1
|
/u01/app/oracle/product/18c/bin/netca -silent -responsefile /u01/app/oracle/product/18c/assistants/netca/netca .rsp |
安装数据库实例
编辑创建数据库文件
1
2
3
4
5
6
7
8
9
10
11
12
13
|
$ find /u01 -name *.rsp<br><br>$ vim /u01/app/oracle/product/18c/assistants/dbca/dbca .rsp<br><br>responseFileVersion= /oracle/assistants/rspfmt_dbca_response_schema_v12 .2.0 gdbName=orcl sid=orcl templateName= /u01/app/oracle/product/18c/assistants/dbca/templates/General_Purpose .dbc # 指定数据库模板 sysPassword=oracle systemPassword=oracle oracleHomeUserPassword=oracle |
可选的模板
1
2
|
/u01/app/oracle/product/18c/assistants/dbca/templates/Data_Warehouse .dbc #数据仓库 /u01/app/oracle/product/18c/assistants/dbca/templates/General_Purpose .dbc #一般用途 |
执行安装
1
|
/u01/app/oracle/product/18c/bin/dbca -silent -createDatabase -responseFile /u01/app/oracle/product/18c/assistants/dbca/dbca .rsp |
安装好数据库之后,要对相应的参数做一定的修改,否则会在安装的时候报错,具体的报错信息会在下面给出:
修改参数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
SQL> alter system set parallel_min_servers=0; SQL> alter system set session_cached_cursors=400 scope=spfile; SQL> alter system set log_buffer=8M scope=spfile; SQL> alter system set memory_max_target=7G scope=spfile; SQL> alter system set memory_target=7G scope=spfile; SQL> alter system set open_cursors=600 scope=spfile; SQL> alter system set pga_aggregate_target=2G scope=spfile; SQL> alter system set processes=800 scope=spfile; SQL> alter system set session_cached_cursors=400 scope=spfile; SQL> alter system set sga_max_size=5G scope=spfile; SQL> alter system set sga_target=5G scope=spfile; SQL> alter system set shared_pool_size=1G scope=spfile;<br><br>SQL> alter system set "_allow_insert_with_update_check" =TRUE |
安装emcc需要创建4组大小为300M以上的redolog文件
1
2
3
|
SQL> select group #,thread#,bytes/1024/1024,status from v$log; GROUP # THREAD# BYTES/1024/1024 STATUS<br>---------- ---------- --------------- ----------------<br> 1 1 200 INACTIVE<br> 2 1 200 INACTIVE<br> 3 1 200 CURRENT<br><br> |
1
2
3
4
5
6
7
8
|
SQL> col member format a50 SQL> select *from v $logfile; GROUP # STATUS TYPE MEMBER IS_ CON_ID ---------- ------- ------- -------------------------------------------------- --- ---------- 3 ONLINE /u01/app/oracle/oradata/ORCL/redo03 .log NO 0 2 ONLINE /u01/app/oracle/oradata/ORCL/redo02 .log NO 0 1 ONLINE /u01/app/oracle/oradata/ORCL/redo01 .log NO 0 |
status 有几个值分别是:
- UNUSED(还没有使用过);
- CURRENT(正在使用);
- ACTIVE(日志处于活动状态,但不是当前日志。 崩溃恢复需要它);
- INACTIVE(实例恢复不再需要当前日志)
由于ORACLE并没有提供类似RESIZE的参数来重新调整REDO LOG FILE的大小,因此只能先把这个文件删除了,然后再重建。又由于ORACLE要求最少有两组日志文件在用,所以不能直接删除,必须要创建中间过渡的REDO LOG日志组。只有处于INACTIVE状态的redolog才能被删除
首先重新创建4组redolog
1
|
SQL> alter database add logfile group 4 '/u01/app/oracle/oradata/ORCL/redo04.log' size 300m;<br><br> |
1
|
SQL> alter database add logfile group 5 '/u01/app/oracle/oradata/ORCL/redo05.log' size 300m;<br><br> |
1
|
SQL> alter database add logfile group 6 '/u01/app/oracle/oradata/ORCL/redo06.log' size 300m;<br><br> |
1
|
SQL> alter database add logfile group 7 '/u01/app/oracle/oradata/ORCL/redo07.log' size 300m; |
切换日志组
1
2
3
4
5
6
7
|
SQL> alter system switch logfile; SQL> alter system switch logfile; SQL> alter system switch logfile; SQL> alter system switch logfile; |
删除原先的日志组
1
2
3
4
5
|
SQL> alter database drop logfile group 1; SQL> alter database drop logfile group 2; SQL> alter database drop logfile group 3; |
删除老旧的物理文件
1
|
! rm -rf /u01/app/oracle/oradata/ORCL/redo0 {1,2,3}.log |
安装emcc
将emcc的安装包下载至/data文件夹
切换至root用户,授予全局用户使用图形化界面的权限
1
2
3
4
5
6
7
|
su - root xhost+<br><br> chmod +x /data/em13200_linux64 .bin su - oracle export DISPLAY=localhost:0.0 (不行就换成ip:0.0)<br><br> /data/em13200_linux64 .bin |
进入图形化安装界面,前两部跳过即可
保证与检查全部通过
选择高级选项
选择一开始创建好的中间件和代理路径,名字不能为localhost
密码强度要符合要求,不少于8位,不能含有特殊字符 oracle123
填写本机IP,监听的端口,实例名和SYS用户密码
设置sysman和代理密码一样即可 oracle123
设置服务的端口,默认即可
执行图中脚本即可
web地址:
emcc地址:
https://192.168.230.211:7803/em
sysman/Oracle123
weblogic控制台地址:
https://192.168.230.211:7102/console
weblogic/Oracle123