DBLOG
» WTF
Toggle navigation
DBLOG
主页
OCM
1、概览
2、数据导入导出
3、GaussDB(DWS)数据库管理
4、数据库调优与开发实践
5、湖仓一体
6、开发应用
7、集群管理
8、巡检和维运维
About Me
归档
标签
Module 4
无
2025-03-12 09:19:08
18
0
0
admin
### Module 4: Configuring Real Application Clusters 模块 4:配置真实应用集群 #### Description 描述 In this module, you will manage Grid infrastructure and RAC database. Activities include creating RAC database and administering Clusterware. 在本模块中,您将管理网格基础设施和 RAC 数据库。活动包括创建 RAC 数据库和管理集群软件。 #### Objectives 目标 - Create RAC database. 创建 RAC 数据库。 - Convert RAC database to RAC One Node database and convert RAC One Node database to RAC database. 将 RAC 数据库转换为 RAC One Node 数据库,并将 RAC One Node 数据库转换为 RAC 数据库。 - Administer ASM disk group. 管理 ASM 磁盘组。 - Configure and manage Grid Infrastructure. 配置和管理网格基础设施。 #### End State 结束状态 At the end of this module, your RACDB databases must be open. 在本模块结束时,您的 RACDB 数据库必须处于打开状态。 --- ### IMPORTANT: Read First 重要提示:请先阅读 #### Connection Details 连接详细信息 You must use ssh to connect to the virtual machines from the Candidate Gateway machine. 您必须使用 ssh 从候选网关机器连接到虚拟机。 - To connect to host03 virtual machine: `ssh -X oracle@host03` or `ssh -X grid@host03` 连接到 host03 虚拟机:`ssh -X oracle@host03` 或 `ssh -X grid@host03` - To connect to host04 virtual machine: `ssh -X oracle@host04` or `ssh -X grid@host04` 连接到 host04 虚拟机:`ssh -X oracle@host04` 或 `ssh -X grid@host04` - The oracle password on the host03 and host04 virtual machines is `oracle`. host03 和 host04 虚拟机上的 oracle 密码是 `oracle`。 - The grid password on the host03 and host04 virtual machines is `oracle`. host03 和 host04 虚拟机上的 grid 密码是 `oracle`。 #### Passwords 密码 Do not change any of the default passwords for the databases or the OS. You may fail the exam if you change the passwords. 请勿更改数据库或操作系统的任何默认密码。如果更改密码,您可能会未通过考试。 - The sys and system schema password in all databases can be accessed with the password `oracle4U`. 所有数据库中的 sys 和 system 架构密码可以使用密码 `oracle4U` 访问。 - The root password on the host03 and host04 virtual machines is `oracle`. host03 和 host04 虚拟机上的 root 密码是 `oracle`。 #### Directories 目录 All scripts are located in `/home/oracle/scripts` or `/home/grid/scripts` on host03. 所有脚本位于 host03 的 `/home/oracle/scripts` 或 `/home/grid/scripts` 中。 - Do not delete or change the directory structure or files unless instructed. Unspecified deletions or changes to the directory structure or files can cause you to fail the exam. 除非指示,否则请勿删除或更改目录结构或文件。未指定的删除或更改目录结构或文件可能导致您未通过考试。 - Do not use `/home/oracle/scripts` on the virtual machines or `/home/oracle/temp` on the Candidate Gateway machine to store any of your files. 请勿在虚拟机上使用 `/home/oracle/scripts` 或在候选网关机器上使用 `/home/oracle/temp` 存储您的任何文件。 ### Documentation 文档 To access the Oracle Database documentation, enter the following URL: `file:///stage/doc/db/index.html` 要访问 Oracle 数据库文档,请输入以下 URL:`file:///stage/doc/db/index.html` --- ### General 一般说明 - You can configure and use GUI tools such as Enterprise Manager Database Express, if desired. 如果需要,您可以配置和使用图形用户界面工具,例如企业管理器数据库快速访问(Enterprise Manager Database Express)。 - Datafiles should not exceed 2 GB in size. 数据文件的大小不得超过 2 GB。 - At the end of solving the module, ensure that a minimum of 1 GB free space is available in the FRA for each database. 在完成模块后,请确保每个数据库的闪存恢复区(FRA)中至少有 1 GB 的可用空间。 - At the end of the module, before the proctor starts the scoring, ensure that you have a minimum of 15% free space for the / (root) file system on the Database Server (host03). Use the `df -h` command at the command prompt to check the free space. 在模块结束时,在监考人员开始评分之前,请确保数据库服务器(host03)的根文件系统(/)中至少有 15% 的可用空间。请在命令提示符下使用 `df -h` 命令检查可用空间。 --- ### TASKS 任务 #### Section 1: Enabling Grid Infrastructure 第 1 节:启用网格基础设施 1. **All Grid infrastructure components are currently shutdown on both host03 and host04. Startup Grid infrastructure on both nodes and ensure that future reboots of either node will automatically start Grid infrastructure on that node.** 1. 所有网格基础设施组件当前在 host03 和 host04 上均已关闭。启动两个节点上的网格基础设施,并确保将来任一节点的重启将自动启动该节点上的网格基础设施。 ``` crsctl config crs crsctl enable crs ``` ### Section 2: Configuring Grid Infrastructure and Creating ASM Disk Groups 第 2 节:配置网格基础设施和创建 ASM 磁盘组 For network configuration for Grid infrastructure, use `eth0` as the public network and `eth1` and `eth2` for the ASM and the private interconnect networks. 网格基础设施的网络配置中,使用 `eth0` 作为公共网络,使用 `eth1` 和 `eth2` 作为 ASM 和私有互连网络。 1. **Connect as grid user, and use eth3 to build high availability of the Grid infrastructure private interconnect network (ASM & Private).** 1. 以 grid 用户身份连接,并使用 `eth3` 建立网格基础设施私有互连网络(ASM 和私有)的高可用性。 ``` oifcfg getif oifcfg setif -global ens37/20.0.0.0:cluster_interconnect,asm ##如果不在一个网段 srvctl config asm srvctl config listener -asmlistener srvctl add listener -asmlistener -l ASMNET_LSNR2 -subnet 20.0.0.0 srvctl config asm srvctl config asmnetwork srvctl add asmnetwork -netnum 2 -subnet 20.0.0.0 srvctl start asmnetwork -netnum 2 srvctl config asmnetwork ``` 2. **Create a disk group, +DGACFS, with external redundancy that can be used as an ADVM volume file. Select the following ASM disks:** 2. 创建一个名为 `+DGACFS` 的磁盘组,具有外部冗余,可用作 ADVM 卷文件。选择以下 ASM 磁盘: - `/dev/cli DATA1 dsk6` - `/dev/cli DATA1 dsk7` 3. **Create a disk group, +DGFRA, with external redundancy to hold the Fast Recovery Area (FRA). Select the following ASM disks:** 3. 创建一个名为 `+DGFRA` 的磁盘组,具有外部冗余,用于存放快速恢复区(FRA)。选择以下 ASM 磁盘: - `/dev/cli FRA dsk1` - `/dev/cli FRA dsk2` - `/dev/cli FRA dsk3` - `/dev/cli FRA dsk4` - `/dev/cli FRA dsk5` - `/dev/cli FRA dsk6` - `/dev/cli FRA dsk7` 4. **Create and mount ACFS filesystem on host03 using an ADVM volume called ACFS_VOL1 in the +DGACFS disk group with the following specifications:** 4. 使用 +DGACFS 磁盘组中的 ADVM 卷 `ACFS_VOL1` 在 host03 上创建并挂载 ACFS 文件系统,规格如下: - **Size:** 2 GB (stripe columns: 8, stripe width: 1M) - **Mount point:** `/u01/app/oracle/acfs_share` 5. **Adjust the attribute of disk group +DGDATA such that ASM will wait for 8 hours when a disk goes offline before dropping it and rebalances the disk group.** 5. 调整磁盘组 `+DGDATA` 的属性,以便在磁盘下线时,ASM 等待 8 小时再将其删除并重新平衡磁盘组。 6. **Create a disk group template in +DGDATA called 'unprotect' with external redundancy.** 6. 在 `+DGDATA` 中创建一个名为 'unprotect' 的磁盘组模板,具有外部冗余。 ### Section 3: Administering Grid Infrastructure 第 3 节:管理网格基础设施 1. **Mirror the OCR into the DGFRA and DGACFS disk group.** 1. 将 OCR 镜像到 `DGFRA` 和 `DGACFS` 磁盘组中。 ``` ocrconfig -add +DGACFS ``` 2. **Dump the Oracle Local Repository (OLR) file on host03. Create the dump file named ASMOLR in TEXT format in the location /home/grid/.** 2. 在 host03 上转储 Oracle 本地存储库(OLR)文件。创建名为 `ASMOLR` 的文本格式转储文件,存放在 `/home/grid/` 目录中。 ``` ocrdump -local /home/grid/ASMOLR ``` 3. **Copy the pictures.zip file from /home/grid/scripts/ on host03 to the ACFS file system mounted on /u01/app/oracle/acfs_share.** 3. 将 `host03` 上 `/home/grid/scripts/` 中的 `pictures.zip` 文件复制到挂载在 `/u01/app/oracle/acfs_share` 的 ACFS 文件系统中。 ``` 挂在acfs mount.acfs -o all 查询acfs acfsutl info fs ``` 4. **Create a snapshot of the ACFS file system and name it SNAP01 in upper case.** 4. 创建 ACFS 文件系统的快照,并将其命名为 `SNAP01`(大写)。 ``` acfsutil snap create SNAP01 /u01/app/oracle/acfs_share/ 查看 acfsutil snap info /u01/app/oracle/acfs_share/ ``` 5. **Configure clusterware so that new OCR backups are created on +DGFRA disk group.** 5. 配置集群软件,以便在 `+DGFRA` 磁盘组上创建新的 OCR 备份。 ``` ocrconfig -backuploc +DGFRA ocrconfig -showbackuploc +DGFRA ``` 6. **Set Cluster Synchronization Services maximum time that a network heartbeat can be missed to 120 seconds.** 6. 将集群同步服务(Cluster Synchronization Services)允许网络心跳丢失的最大时间设置为 120 秒。 ``` --查看当前心跳 crsctl get css misscount --修改心跳时间 crsctl set css misscount 120 ``` ### Section 4: Creating a RAC Database 第 4 节:创建 RAC 数据库 Create a Real Application Database, called **RACDB** (SID Prefix: RACDB), with these attributes: 创建一个名为 **RACDB** 的真实应用数据库(SID 前缀:RACDB),其属性如下: 1. **Two instances, one each on host03 and host04.** 1. 两个实例,分别位于 host03 和 host04。 2. **General Purpose or Transaction Processing Container Database.** 2. 一般用途或事务处理的容器数据库。 3. **The configuration type should be administrator-managed.** 3. 配置类型应为管理员管理。 4. **Supports two pluggable databases: RACPDB1 and RACPDB2, and local UNDO.** 4. 支持两个可插拔数据库:RACPDB1 和 RACPDB2,并使用本地 UNDO。 5. **The Sys and SYSTEM users must use the password oracle_4U.** 5. Sys 和 SYSTEM 用户的密码必须为 `oracle_4U`。 6. **Disk group +DGDATA stores all the database files.** 6. 磁盘组 `+DGDATA` 存储所有数据库文件。 7. **A Fast Recovery Area (FRA) of 12 GB in the disk group: +DGFRA.** 7. 在磁盘组 `+DGFRA` 中配置 12 GB 的闪存恢复区(FRA)。 8. **No sample schemas installed.** 8. 不安装示例架构。 9. **Use Automatic Shared Memory Management and set the SGA to 2GB and the PGA to 500 MB.** 9. 使用自动共享内存管理,将 SGA 设置为 2GB,PGA 设置为 500 MB。 ### Section 5: Configuring the RAC Environment 第 5 节:配置 RAC 环境 1. **Configure the degree of parallelism for the channel when RMAN takes backups to 3.** 1. 配置 RMAN 备份时通道的并行度为 3。 ``` show all ONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; ``` 2. **Convert the RACDB database to a RAC One Node database. You should stop the instance on host04. When the conversion completes, run `/home/oracle/scripts/2_5_2.sh` to ensure that the type is RAC One Node.** 2. 将 RACDB 数据库转换为 RAC One Node 数据库。您应该在 host04 上停止实例。转换完成后,运行 `/home/oracle/scripts/2_5_2.sh` 以确保类型为 RAC One Node。 ``` srvctl stop instance -db racdb -node host04 -f srvctl remove instance -d racdb -i RACDB2 srvctl add service -db racdb -s racdb1 -preferred RACDB1 srvctl convert database -db racdb -dbtype RACONENODE -instance RACDB srvctl config database -db racdb ``` 3. **Run the script `/home/oracle/scripts/8_2_5.sql` using SQL*Plus. SALSEQ will be used to populate the primary key of table SH.SALES, which will contain approximately 125 leaf rows per leaf block. Occasionally, high table insert activity may result in leaf block contention across instances. Modify the sequence or index definitions or both to reduce contention, speed up range scans, and to hold a range of 100,000 sequence values in memory.** 3. 使用 SQL*Plus 运行脚本 `/home/oracle/scripts/8_2_5.sql`。SALSEQ 将用于填充表 SH.SALES 的主键,每个叶子块将包含大约 125 行叶子行。偶尔,高表插入活动可能导致实例间的叶子块竞争。修改序列或索引定义,或者两者皆修改,以减少竞争,加速范围扫描,并在内存中保留 100,000 个序列值的范围。 ``` @/home/oracle/scripts/2_5_3.sql select sales.nextval from dual; alter table sales primary keyl create unique index uidx_cust_id on sales(cust_id) global partition by hash(cust_id) partitions 4 parallel 4; alter table sales add constraint pl_sales primary key(cust_id) using index uidx_cust_id; ``` 4. **Convert the RAC One Node database back to a two-instance RAC database.** 4. 将 RAC One Node 数据库转换回双实例 RAC 数据库。 ``` srvctl convert database -db racdb -dbtype RAC srvctl add instance -d racdb -i racdb2 -n host04 srvctl remove service -db racdb -s racdb1 srvctl start instance -db racdb -node host04 srvctl config database -db racdb srvctl status instance -db racdb -node host03,host04 ``` 5. **Create a service SERV1 that meets the following requirements:** 5. 创建一个名为 SERV1 的服务,满足以下要求: - **i. Create a service called SERV1 which is associated with the RACPDB1 pluggable database. This service runs on the preferred instance as RACDB1 and the available instance as RACDB2.** i. 创建一个名为 SERV1 的服务,与 RACPDB1 可插拔数据库关联。该服务在首选实例 RACDB1 上运行,在可用实例 RACDB2 上运行。 - **ii. After the service fails over from the preferred instance to the available instance, configure the service to fall back automatically when the preferred instance becomes available.** ii. 在服务从首选实例故障转移到可用实例后,配置该服务以在首选实例恢复可用时自动恢复。 - **iii. Start the SERV1 on the preferred instance.** iii. 在首选实例上启动 SERV1。 ``` srvctl add service -db racdb -pdb RACPDB1 -s SERV1 -preferred RACDB1 -available RACDB2 -failovertype TRANSATION -commit_outcome TURE -failback yes srvctl start service -db racdb -s SERV1 --验证 sqlplus sys/oracle_4U@cluster01:1521/SERV1 show pdbs ``` 6. **Create a service SERV2 that meets the following requirements:** 6. 创建一个名为 SERV2 的服务,满足以下要求: - **i. Create a service called SERV2 which is associated with the RACPDB2 pluggable database. This service runs on the preferred instance as RACDB2 and the available instance as RACDB1.** i. 创建一个名为 SERV2 的服务,与 RACPDB2 可插拔数据库关联。该服务在首选实例 RACDB2 上运行,在可用实例 RACDB1 上运行。 - **ii. In the event of a single instance failure, this service must support transaction failover to the remaining instances.** ii. 在单个实例故障时,该服务必须支持事务故障转移到剩余实例。 - **iii. Start the SERV2 on the preferred instance.** iii. 在首选实例上启动 SERV2。 ``` srvctl add service -db racdb -pdb RACPDB2 -s SERV2 -preferred RACDB2 -available RACDB1 -failovertype transaction -commit_outcome true srvctl start service -db racdb -s SERV2 --验证 sqlplus sys/oracle_4U@cluster01:1521/SERV2 show pdbs ``` 7. **Create a service SERV3 that meets the following requirements:** 7. 创建一个名为 SERV3 的服务,满足以下要求: - **i. Create a service called SERV3 which is associated with the RACPDB2 pluggable database. This service starts on all instances.** i. 创建一个名为 SERV3 的服务,与 RACPDB2 可插拔数据库关联。该服务在所有实例上启动。 - **ii. When this service starts, the associated pluggable database must be opened.** ii. 当该服务启动时,关联的可插拔数据库必须被打开。 - **iii. Start the SERV3 which you created.** iii. 启动您创建的 SERV3。 ``` srvctl add service -db racdb -pdb racpdb2 -s SERV3 -preferred "RACDB1,RACDB2" srvctl start service -db racdb -s SERV3 --验证 sqlplus sys/oracle_4U@cluster01:1521/SERV3 show pdbs ``` 8. **Configure RACDB to reduce the number of duplicated block images for tables queried in parallel, when such duplicate images are stored in more than one instance's buffer cache.** 8. 配置 RACDB,以减少在并行查询表时存储在多个实例的缓冲区缓存中的重复块图像的数量。 ``` show parameter parallel alter system set parallel_degree_policy=auto; alter system set parallel_force_local=ture; ``` 9. **Create a sequence, `SYS.PS_SEQ`, where the sequence number is generated in order across all instances. The sequence must retain the original value of NEXTVAL during replay for Application Continuity. The sequence specifications are as follows:** 9. 创建一个序列 `SYS.PS_SEQ`,其序列号在所有实例中按顺序生成。该序列在应用程序连续性重放期间必须保留 NEXTVAL 的原始值。序列规格如下: - **Starting Number:** 100 - **Maximum Value:** 99999 ``` create sequence PS_SEQ start with 100 increment by 1 maxvalue 99999 nocycle order cache 10; select PS_SEQ.NEXTVAL FROM DUAL; / / / ``` ### Section 6: Configuring Additional Options 第 6 节:配置附加选项 1. **Consider adding the pluggable database PDB3 to the RACDB database. This pluggable database uses a flex disk group. Configure a flex disk group that meets the following requirements:** 1. 考虑将可插拔数据库 PDB3 添加到 RACDB 数据库。此可插拔数据库使用灵活磁盘组。配置一个满足以下要求的灵活磁盘组: - **i. The disk group name is DGFLEX.** i. 磁盘组名称为 DGFLEX。 - **ii. Use the following ASM disks:** ii. 使用以下 ASM 磁盘: - `/dev/c1_FRA_dsk8` - `/dev/c1_FRA_dsk9` - `/dev/c1_FRA_dsk10` - `/dev/c1_FRA_dsk11` - `/dev/c1_FRA_dsk12` - `/dev/c1_FRA_dsk13` - `/dev/c1_FRA_dsk14` - **iii. Create a file group which should be used by the pluggable database PDB3. The file group name is PDB3_filegroup.** iii. 创建一个应由可插拔数据库 PDB3 使用的文件组。文件组名称为 PDB3_filegroup。 - **iv. The quota of PDB3_filegroup must be 8 GB. The quota group name you specify must be PDB3_limit.** iv. PDB3_filegroup 的配额必须为 8 GB。您指定的配额组名称必须为 PDB3_limit。 ``` asmca 创建DGFLEX磁盘组 su - grid sqlplus / as sysdba select filegroup_number,name,guid,client_name from v$asm_frilgroup; alter diskgroup dgflex add filegroup PDB3_filegroup database PDB3 set 'quota_group'='QutaGroup_PDB3'; --或 看是否指定配额组 alter diskgroup dgflex add filegroup PDB3_filegroup database PDB3 alter diskgroup dgflex add quotagroup=PDB3_filegroup set 'quota'=8G; ``` 2. **Use PDB3_filegroup to create the pluggable database PDB3 in the RACDB database. The PDB3 you create must be open.** 2. 使用 PDB3_filegroup 在 RACDB 数据库中创建可插拔数据库 PDB3。您创建的 PDB3 必须处于打开状态。 ``` create pluggable database pdb3 admin user pdbadmin identified by oracle create_file_dest='+DGFLEX'; ``` 3. **The interval between checks for Cluster Verification Utility (CVU) should be 12 hours.** 3. 集群验证工具(CVU)检查之间的间隔应为 12 小时。 ``` srvctl config cvu srvctl modity cvu -t 720 --只在一个节点上有 srvctl status cvu ``` 4. **You must use Cluster Health Monitor (CHM) to maintain information about OS and cluster resources. Perform the necessary operations to set the retention time for the administrative database to 200,000 seconds and ensure that the retention time is 200,000 seconds.** 4. 您必须使用集群健康监控(CHM)来维护有关操作系统和集群资源的信息。执行必要的操作,将管理数据库的保留时间设置为 200,000 秒,并确保保留时间为 200,000 秒。 ``` oclumon manage -repos checkretentiontime 259220 oclumon manage -repos changerepossize 3896 ``` 5. **Configure the Cluster Health Advisor (CHA) to monitor cluster nodes and databases. Set the maximum retention time for data collected by the Cluster Health Advisor to 90 hours.** 5. 配置集群健康顾问(CHA)以监控集群节点和数据库。将集群健康顾问收集的数据的最大保留时间设置为 90 小时。 ``` chactl query repository chactl set maxretention -time 90 ```
上一篇:
Module 3
下一篇:
S1
0
赞
18 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网