oracle RAC安装 保姆级教程

使用SSH+Xmanager

我的本地IP是172.17.68.68

服务器配置

python 复制代码
[root@rac12-1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
#Public IP
172.17.212.100 rac12-1
172.17.212.101 rac12-2
#Private IP
1.1.1.1 rac12-1-priv
1.1.1.2 rac12-2-priv
#Vip IP
172.17.212.200 rac12-1-vip
172.17.212.201 rac12-2-vip

#Scan IP
172.17.212.10 rac12-scan

安全限制

python 复制代码
# cat /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock 134217728
oracle soft memlock 134217728

grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft nproc 2047
grid hard nproc 16384

# cat /etc/pam.d/login
session required pam_limits.so 
session required /lib64/security/pam_limits.so

确认基础配置

python 复制代码
# cat /home/grid/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM2
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysasm'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ ' 


# cat /home/oracle/.bash_profile
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=\$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.3.0/db
export ORACLE_HOSTNAME=rac12-2
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=rac12-2
export PATH=/usr/sbin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$ORACLE_HOME/OPatch:\$PATH
alias sas='sqlplus / as sysdba'
export PS1="[\`whoami\`@\`hostname\`:"'\$PWD]\$ '
################OracleEnd#########################

确认ASM

python 复制代码
[grid@rac12-1:/home/grid]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac12-1                  STABLE
               ONLINE  ONLINE       rac12-2                  STABLE
ora.chad
               ONLINE  ONLINE       rac12-1                  STABLE
               ONLINE  ONLINE       rac12-2                  STABLE
ora.net1.network
               ONLINE  ONLINE       rac12-1                  STABLE
               ONLINE  ONLINE       rac12-2                  STABLE
ora.ons
               ONLINE  ONLINE       rac12-1                  STABLE
               ONLINE  ONLINE       rac12-2                  STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       rac12-1                  STABLE
      2        ONLINE  ONLINE       rac12-2                  STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac12-1                  STABLE
      2        ONLINE  ONLINE       rac12-2                  STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac12-1                  STABLE
ora.OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       rac12-1                  STABLE
      2        ONLINE  ONLINE       rac12-2                  STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       rac12-1                  Started,STABLE
      2        ONLINE  ONLINE       rac12-2                  Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       rac12-1                  STABLE
      2        ONLINE  ONLINE       rac12-2                  STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       rac12-1                  STABLE
ora.qosmserver
      1        ONLINE  ONLINE       rac12-1                  STABLE
ora.rac12-1.vip
      1        ONLINE  ONLINE       rac12-1                  STABLE
ora.rac12-2.vip
      1        ONLINE  ONLINE       rac12-2                  STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac12-1                  STABLE
--------------------------------------------------------------------------------

开始安装oracle

python 复制代码
[root@rac12-1 ~]# su - oracle
Last login: Wed Jun 12 19:21:03 CST 2024 on pts/0
[oracle@rac12-1:/home/oracle]$ source ~/.bash_profile
[oracle@rac12-1:/home/oracle]$ cd $ORACLE_HOME
[oracle@rac12-1:/u01/app/oracle/product/19.3.0/db]$ ./runInstaller
ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable.

No X11 DISPLAY variable was set, but this program performed an operation which requires it.
[oracle@rac12-1:/u01/app/oracle/product/19.3.0/db]$ export DISPLAY=172.17.68.68:0.0
[oracle@rac12-1:/u01/app/oracle/product/19.3.0/db]$ ./runInstaller
Launching Oracle Database Setup Wizard...

选择仅安装软件

选择集群模式




注意在第二节点上要建立目录

python 复制代码
[root@rac12-2 app]# mkdir -p /u01/app/oracle/product/19.3.0/db
[root@rac12-2 app]# chown -R oracle:oinstall /u01/app/oracle





弹出这框来千万不能点OK!!!

两个结点依序使用root执行命令

/u01/app/oracle/product/19.3.0/db/root.sh

python 复制代码
[root@rac12-1 ~]# /u01/app/oracle/product/19.3.0/db/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.3.0/db

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[root@rac12-1 ~]#

两节点都执行完成后再点OK

检查

python 复制代码
[oracle@rac12-1:/u01/app/oracle/product/19.3.0/db]$ sqlplus -version

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

创建数据库实例

python 复制代码
[oracle@rac12-1:/u01/app/oracle/product/19.3.0/db]$ dbca




默认会添加1与2

所以只写到sqwh0

这里不启用cdb与pdb模式

不开闪回,不开归档,建完实例后再配置

调整内存使用到80%左右

按需调整Processes

字元集可不动, 默认大字元集满足使用

取消第二个, 只勾第一个

填写密码


全部忽略, 理由同上






登录数据库查看

由于前期规划想让SID叫做rac12-1与rac12-2

但是过程中SID不能包含-

所以我们要修改环境变量

export ORACLE_SID=sqwh01

python 复制代码
[oracle@rac12-1:/u01/app/oracle/product/19.3.0/db]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 13 09:51:56 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select instance_number,instance_name,startup_time,status from gv$Instance;

INSTANCE_NUMBER INSTANCE_NAME    STARTUP_TIME       STATUS
--------------- ---------------- ------------------ ------------
              1 sqwh01           13-JUN-24          OPEN
              2 sqwh02           13-JUN-24          OPEN

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
相关推荐
明月看潮生1 分钟前
青少年编程与数学 02-007 PostgreSQL数据库应用 11课题、视图的操作
数据库·青少年编程·postgresql·编程与数学
阿猿收手吧!9 分钟前
【Redis】Redis入门以及什么是分布式系统{Redis引入+分布式系统介绍}
数据库·redis·缓存
奈葵12 分钟前
Spring Boot/MVC
java·数据库·spring boot
leegong2311120 分钟前
Oracle、PostgreSQL该学哪一个?
数据库·postgresql·oracle
中东大鹅26 分钟前
MongoDB基本操作
数据库·分布式·mongodb·hbase
夜光小兔纸1 小时前
Oracle 普通用户连接hang住处理方法
运维·数据库·oracle
兩尛2 小时前
订单状态定时处理、来单提醒和客户催单(day10)
java·前端·数据库
web2u3 小时前
MySQL 中如何进行 SQL 调优?
java·数据库·后端·sql·mysql·缓存
Elastic 中国社区官方博客3 小时前
使用 Elasticsearch 导航检索增强生成图表
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
小金的学习笔记3 小时前
RedisTemplate和Redisson的使用和区别
数据库·redis·缓存