相关推荐recommended
Vagrant创建Oracle RAC环境示例
作者:mmseoamin日期:2024-01-25

利用Vagrant安装Oracle RAC(默认为non-CDB模式),生成2台虚机,耗时约1小时。

    node1: -----------------------------------------------------------------
    node1: INFO: 2024-01-11 18:25:54: Make create database command
    node1: -----------------------------------------------------------------
    node1: -----------------------------------------------------------------
    node1: INFO: 2024-01-11 18:25:54: Create database
    node1: -----------------------------------------------------------------
    node1: [WARNING] [DBT-06801] Specified Fast Recovery Area size (2,048 MB) is less than the recommended value.
    node1:    CAUSE: Fast Recovery Area size should at least be three times the database size (692 MB).
    node1:    ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
    node1: [WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
    node1:    CAUSE:
    node1: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
    node1: b.The password entered is a keyword that Oracle does not recommend to be used as password
    node1:    ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
    node1: [WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
    node1:    CAUSE:
    node1: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
    node1: b.The password entered is a keyword that Oracle does not recommend to be used as password
    node1:    ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
    node1: [WARNING] [DBT-06801] Specified Fast Recovery Area size (2,048 MB) is less than the recommended value.
    node1:    CAUSE: Fast Recovery Area size should at least be three times the database size (2,377 MB).
    node1:    ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
    node1: Prepare for db operation
    node1: 8% complete
    node1: Copying database files
    node1: 33% complete
    node1: Creating and starting Oracle instance
    node1: 34% complete
    node1: 35% complete
    node1: 39% complete
    node1: 42% complete
    node1: 45% complete
    node1: 50% complete
    node1: Creating cluster database views
    node1: 52% complete
    node1: 67% complete
    node1: Completing Database Creation
    node1: 71% complete
    node1: 73% complete
    node1: 75% complete
    node1: Executing Post Configuration Actions
    node1: 100% complete
    node1: Database creation complete. For details check the logfiles at:
    node1:  /u01/app/oracle/cfgtoollogs/dbca/DB193H1.
    node1: Database Information:
    node1: Global Database Name:DB193H1
    node1: System Identifier(SID) Prefix:DB193H1
    node1: Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/DB193H1/DB193H1.log" for further details.
    node1: -----------------------------------------------------------------
    node1: INFO: 2024-01-11 18:40:27: Check database
    node1: -----------------------------------------------------------------
    node1: -----------------------------------------------------------------
    node1: INFO: 2024-01-11 18:40:27: Config database
    node1: -----------------------------------------------------------------
    node1: Database unique name: DB193H1
    node1: Database name: DB193H1
    node1: Oracle home: /u01/app/oracle/product/19.3.0.0/dbhome_1
    node1: Oracle user: oracle
    node1: Spfile: +DATA/DB193H1/PARAMETERFILE/spfile.270.1157999845
    node1: Password file: +DATA/DB193H1/PASSWORD/pwddb193h1.258.1157999243
    node1: Domain:
    node1: Start options: open
    node1: Stop options: immediate
    node1: Database role: PRIMARY
    node1: Management policy: AUTOMATIC
    node1: Server pools:
    node1: Disk Groups: RECO,DATA
    node1: Mount point paths:
    node1: Services:
    node1: Type: RAC
    node1: Start concurrency:
    node1: Stop concurrency:
    node1: OSDBA group: dba
    node1: OSOPER group: oper
    node1: Database instances: DB193H11,DB193H12
    node1: Configured nodes: node1,node2
    node1: CSS critical: no
    node1: CPU count: 0
    node1: Memory target: 0
    node1: Maximum memory: 0
    node1: Default network number for database services:
    node1: Database is administrator managed
    node1: -----------------------------------------------------------------
    node1: INFO: 2024-01-11 18:40:32: Database Status
    node1: -----------------------------------------------------------------
    node1: Instance DB193H11 is running on node node1
    node1: Instance DB193H12 is running on node node2
    node1: -----------------------------------------------------------------------------------
    node1: SUCCESS: 2024-01-11 18:40:35: Oracle RAC on Vagrant has been created successfully!
    node1: -----------------------------------------------------------------------------------
    node1: -----------------------------------------------------------------
    node1: INFO: 2024-01-11 18:40:35: Running user-defined post-setup scripts
    node1: -----------------------------------------------------------------
real    60m10.215s
user    0m0.000s
sys     0m0.031s

可以看到vagrant生成了node1和node2两台虚机:

$ vagrant status
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
 Oracle RAC (Real Application Cluster) Vagrant box for KVM/libVirt or VirtualBox
 Copyright (c) 1982-2020 Oracle and/or its affiliates
----------------------------------------------------------------------------------
 Author: Ruggero Citton 
         RAC Pack, Cloud Innovation and Solution Engineering Team
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
--------------------
Detected virtualbox
--------------------
getting Proxy Configuration from Host...
Current machine states:
node2                     running (virtualbox)
node1                     running (virtualbox)
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.

两台虚机启动后,32G的电脑内存占用由29%升至69%,消耗内存约13G。

空间方面,两台虚机刚生成时,新增空间占用为vagrant目录下的113G(共享存储)加虚机目录下的6.13G(各自的操作系统),总共约120G。

Vagrant创建Oracle RAC环境示例,在这里插入图片描述,第1张

存储使用了ASM:

[grid@node1 ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     65520    63012                0           63012              0             Y  DATA/
MOUNTED  NORMAL  N         512             512   4096  4194304     16368    15364             4092            5636              0             N  RECO/

如果要使用SQL Developer管理此两RAC示例,则需要连接此两主机的公共IP或SCAN IP,例如192.168.56.111和192.168.56.121。他们定义在文件vagrant.yml中:

$ pwd
.../vagrant-projects/OracleRAC/OL7/config
$ ls
setup.env  vagrant.yml
$ cat vagrant.yml
# -----------------------------------------------
# vagrant.yml for VirtualBox
# -----------------------------------------------
node1:
  vm_name: node1
  mem_size: 8192
  cpus: 2
  public_ip:  192.168.56.111
  vip_ip:     192.168.56.112
  private_ip: 192.168.200.111
  u01_disk: ./node1_u01.vdi
node2:
  vm_name: node2
  mem_size: 8192
  cpus: 2
  public_ip:  192.168.56.121
  vip_ip:     192.168.56.122
  private_ip: 192.168.200.122
  u01_disk: ./node2_u01.vdi
shared:
  prefix_name:   vgtol7-rac
  # ---------------------------------------------
  domain  : localdomain
  scan_ip1: 192.168.56.115
  scan_ip2: 192.168.56.116
  scan_ip3: 192.168.56.117
  # ---------------------------------------------
  non_rotational: 'on'
  asm_disk_path:
  asm_disk_num:   4
  asm_disk_size: 20
  p1_ratio:      80
  asm_lib_type: 'ASMLIB'
  # ---------------------------------------------
env:
  provider: virtualbox
  # ---------------------------------------------
  gi_software:     LINUX.X64_193000_grid_home.zip
  db_software:     LINUX.X64_193000_db_home.zip
  # ---------------------------------------------
  root_password:   welcome1
  grid_password:   welcome1
  oracle_password: welcome1
  sys_password:    welcome1
  pdb_password:    welcome1
  # ---------------------------------------------
  ora_languages:   en,en_GB
  # ---------------------------------------------
  nomgmtdb:        true
  orestart:        false
  # ---------------------------------------------
  db_name:         DB193H1
  pdb_name:        PDB1
  db_type:         RAC
  cdb:             false
  # ---------------------------------------------
...

有几个地方可以表明其为RAC。见下图,RAC #1表明其为集群中的节点1:

Vagrant创建Oracle RAC环境示例,在这里插入图片描述,第2张

然后就是“数据库状态”中,可以看到有2个实例,即DB193H11和DB193H12:

Vagrant创建Oracle RAC环境示例,在这里插入图片描述,第3张

以及“状态”中的“Oracle主机”标签页:

Vagrant创建Oracle RAC环境示例,在这里插入图片描述,第4张