您的位置:首页 > 数据库 > Oracle

Oracle 11g RAC搭建(VMware环境)UDEV(三)

2017-11-13 17:39 387 查看

安装Oracle database软件(RAC)

1.安装流程

只需要在节点rac1上执行即可
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ cd db/database
[oracle@rac1 database]$ ./runInstaller

进入图形化界面,跳过更新





选择只安装数据库软件



选择Oracel Real Application Clusters database installation按钮(默认),确保勾选所有的节点



这里的SSH Connectivity是配置每个节点之间的oracle用户互信,前面已手动配置过,可以不配
选择语言English



选择安装企业版软件



选择安装Oracle软件路径,其中ORACLE_BASE,ORACLE_HOME均选择之前配置好的



oracle权限授予用户组



安装前的预检查



这两个错误前面有说明,忽略
安装RAC的概要信息



开始安装,会自动复制到其他节点



安装完,在每个节点用root用户执行脚本



[root@rac1 etc]# /u01/app/oracle/product/11.2.0/db_1/root.sh Performing root user operation for Oracle 11g

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

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 byDatabase Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.123456789101112131415161718
安装完成,close



至此在RAC双节点上完成oracle软件安装,安装日志在



2.创建集群数据库

在节点rac1上用oracle用户执行dbca创建RAC数据库
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ dbca




选择创建数据库



选择自定义数据库(也可以是通用)



配置类型选择Admin-Managed,输入全局数据库名orcl,每个节点实例SID前缀为orcl,选择双节点



选择默认,配置OEM,启用数据库自动维护任务



统一设置sys,system,dbsnmp,sysman用户的密码为oracle



使用ASM存储,使用OMF(oracle的自动管理文件),数据区选择之前创建的DATA磁盘组



设置ASM密码为oracle



指定数据闪回区,选择之前创建好的FRA磁盘组,不开归档



组建选择



选择字符集AL32UTF8



选择默认的数据存储信息



开始创建数据库,勾选生成数据库的脚本



数据库的概要信息



开始安装组建





完成数据库安装



RAC维护

1.查看服务状态

忽略gsd问题
[root@rac1 ~]# su - grid[grid@rac1 ~]$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1
ora.FRA.dg     ora....up.type ONLINE    ONLINE    rac1
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac1
ora.OCR.dg     ora....up.type ONLINE    ONLINE    rac1
ora.asm        ora.asm.type   ONLINE    ONLINE    rac1
ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac1
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE
ora....network ora....rk.type ONLINE    ONLINE    rac1
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    rac1
ora.ons        ora.ons.type   ONLINE    ONLINE    rac1
ora.orcl.db    ora....se.type ONLINE    ONLINE    rac1
ora....SM1.asm application    ONLINE    ONLINE    rac1
ora....C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    OFFLINE   OFFLINE
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1
ora....SM2.asm application    ONLINE    ONLINE    rac2
ora....C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    OFFLINE   OFFLINE
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac1123456789101112131415161718192021222324252627
检查集群运行状态
[grid@rac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rac1
Instance orcl2 is running on node rac2

2.检查CRS状态

检查本地节点的CRS状态
[grid@rac1 ~]$ crsctl check crsCRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online12345
检查集群的CRS状态
[grid@rac1 ~]$ crsctl check clusterCRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online1234

3.查看集群中节点配置信息

[grid@rac1 ~]$ olsnodes
rac1
rac2

[grid@rac1 ~]$ olsnodes -n
rac1    1rac2    2[grid@rac1 ~]$ olsnodes -n -i -s -t
rac1    1       rac1-vip        Active  Unpinnedrac2    2       rac2-vip        Active  Unpinned1234567891011

4.查看集群件的表决磁盘信息

[grid@rac1 ~]$ crsctl query css votedisk##  STATE    File Universal Id                File Name Disk group--  -----    -----------------                --------- ---------
1. ONLINE   496abcfc4e214fc9bf85cf755e0cc8e2 (/dev/raw/raw1) [OCR]Located 1 voting disk(s).12345

5.查看集群SCAN VIP信息

[grid@rac1 ~]$ srvctl config scanSCAN name: scan-ip, Network: 1/192.168.248.0/255.255.255.0/eth0SCAN VIP name: scan1, IP: /scan-ip/192.168.248.110123
查看集群SCAN Listener信息
[grid@rac1 ~]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:152112

6.启、停集群数据库

整个集群的数据库启停
进入grid用户
[grid@rac1 ~]$ srvctl stop database -d orcl

[grid@rac1 ~]$ srvctl start database -d orcl

关闭所有节点
进入root用户
关闭所有节点
[root@rac1 bin]# pwd
/u01/app/11.2.0/grid/bin
[root@rac1 bin]# ./crsctl stop crs

实际只关闭了当前结点

EM管理

oracle用户下执行
[oracle@rac1 ~]$ emctl status dbconsole
[oracle@rac1 ~]$ emctl start dbconsole
[oracle@rac1 ~]$ emctl stop dbconsole123

本地sqlplus连接

windows中安装oracle客户端版
修改tsnames.ora
D:\develop\app\orcl\product\11.2.0\client_1\network\admin\tsnames.ora
添加
RAC_ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.248.110)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)12345678910
这里的HOST写的是scan-ip
C:\Users\sxtcx>sqlplus sys/oracle@RAC_ORCL as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 4月 14 14:37:30 2016Copyright (c) 1982, 2010, Oracle.  All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name, status from v$instance;

INSTANCE_NAME                    STATUS-------------------------------- ------------------------orcl1                            OPEN1234567891011121314151617
当开启第二个命令行窗口连接时,发现实例名为orcl2,可以看出,scan-ip的加入可以具有负载均衡的作用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  REHAT 6-ORACLE 11G R