文章目录
- 前言
- 一、问题描述
- 二、修改DB_UNIQUE_NAME
- 1.查看集群配置
- 2.将hip40实例从集群中移除
- 3.修改db_unique_name
- 4.将hip40dg实例添加到集群资源中
- 5.重新启动实例
- 三、19C RAC 密码文件替换
前言
主库环境是19C RAC备库环境也是19C RAC,主库到备库做adg,dg配置和11g没有太大区别,RAC主库到单实例备库配置没有任何区别,19c和11g rac到rac备库配置唯一的区别在于19C修改db_unique_name的时候不能在实例层面直接修改,19C的db_unique_name是作为集群资源管理的,所有修改需要在集群层面进行操作。
一、问题描述
备库在dg配置过程中修改db_unique_name报错:ORA-32017 ORA-65500,提示不能在实例层面编辑db_unique_name
[oracle@rac18c-n2 ~]$ oerr ora 65500
65500, 00000, "could not modify DB_UNIQUE_NAME, resource exists"
// *Cause: DB_UNIQUE_NAME could not be modified, because a database resource
// identified by DB_UNIQUE_NAME existed in the cluster. To modify
// DB_UNIQUE_NAME, any resource it identifies must first be removed.
// *Action: Remove the database resource identified by DB_UNIQUE_NAME before
二、修改DB_UNIQUE_NAME
1.查看集群配置
[oracle@nptdb1dg ~]$ srvctl config database -d hip40
Database unique name: hip40
Database name: hip40
Oracle home: /u01/app/oracle/product/19.3.0.0/db_1
Oracle user: oracle
Spfile: +DATA/HIP40/PARAMETERFILE/spfile.280.1135195669
Password file: +DATA/HIP40/PASSWORD/pwdhip40 --19C的密码文件也存放在了存储中,并且命名也变了。
--spfile和密码文件的路径要记录一下,等会重新添加db的时候要用到
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: hip401,hip402
Configured nodes: nptdb1dg,nptdb2dg
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
2.将hip40实例从集群中移除
[oracle@nptdb1dg ~]$ srvctl remove database -d hip40
PRKO-3141 : Database hip40 could not be removed because it was running
--报错提示实例正在运行,可以先停止实例,再移除,我这里加-f强制移除。
[oracle@nptdb1dg ~]$ srvctl remove database -d hip40 -f
3.修改db_unique_name
[oracle@nptdb1dg ~]$ sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Thu May 4 10:11:20 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> alter system set db_unique_name='hip40dg' scope=spfile sid='*';
System altered.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@nptdb1dg ~]$ srvctl config database -d hip40dg --修改后还不能在集群资源中查看修改后的实例信息,需要将新的实例信息添加到集群资源中去。
PRCD-1120 : The resource for database hip40dg could not be found.
PRCR-1001 : Resource ora.hip40dg.db does not exist
4.将hip40dg实例添加到集群资源中
[oracle@nptdb1dg ~]$ srvctl add database -db hip40dg -dbname hip40
PRKO-2082 : Missing mandatory option -oraclehome
--提示要加上oraclehome
[oracle@nptdb1dg ~]$ srvctl add database -db hip40dg -dbname hip40 -oraclehome
PRKO-2388 : Command line option -oraclehome should be followed by a value.
[oracle@nptdb1dg ~]$ srvctl add database -db hip40dg -dbname hip40 -oraclehome /u01/app/oracle/product/19.3.0.0/db_1
[oracle@nptdb1dg ~]$ srvctl config database -d hip40dg
Database unique name: hip40dg
Database name: hip40
Oracle home: /u01/app/oracle/product/19.3.0.0/db_1
Oracle user: oracle
Spfile:
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances:
Configured nodes:
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@nptdb1dg ~]$ srvctl add instance -db hip40dg -instance hip401 -node nptdb1dg
[oracle@nptdb1dg ~]$ srvctl add instance -db hip40dg -instance hip402 -node nptdb2dg
--将db分别添加到两个节点
[oracle@nptdb1dg ~]$ srvctl config database -d hip40dg
Database unique name: hip40dg
Database name: hip40
Oracle home: /u01/app/oracle/product/19.3.0.0/db_1
Oracle user: oracle
Spfile:
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: hip401,hip402
Configured nodes: nptdb1dg,nptdb2dg
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@nptdb1dg ~]$ srvctl modify database -db hip40dg -spfile '+DATA/HIP40/PARAMETERFILE/spfile.280.1135195669' -pwfile '+DATA/HIP40/PASSWORD/pwdhip40'
[oracle@nptdb1dg ~]$ srvctl config database -d hip40dg
Database unique name: hip40dg
Database name: hip40
Oracle home: /u01/app/oracle/product/19.3.0.0/db_1
Oracle user: oracle
Spfile: +DATA/HIP40/PARAMETERFILE/spfile.280.1135195669
Password file: +DATA/HIP40/PASSWORD/pwdhip40
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: hip401,hip402
Configured nodes: nptdb1dg,nptdb2dg
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
5.重新启动实例
[oracle@nptdb1dg ~]$ srvctl stop database -d hip40dg
[oracle@nptdb1dg ~]$ srvctl start database -d hip40dg
三、19C RAC 密码文件替换
19C的密码文件保存在了ASM中,替换方式与11G不同。这里简单记录一下。
1.我们可以在主库将密码文件从asm中拷贝到系统本地,再将主库的密码文件拷贝到备库asm
ASMCMD> pwcopy pwdhip40.256.1135194859 /tmp
copying +data/hip40/password/pwdhip40.256.1135194859 -> /tmp/pwdhip40.256.1135194859
2.我们也可以在备库本地直接生成密码文件(注意密码文件名格式),然后将生成的密码文件拷贝到asm
[oracle@nptdb1dg ~]$orapwd file=pwdhip40 asm=data password=manager
--这个没试过,可以试试
ASMCMD> pwcopy /u01/app/oracle/product/19.3.0.0/db_1/dbs/pwdhip40 .
copying /u01/app/oracle/product/19.3.0.0/db_1/dbs/pwdhip40 -> +DATA/hip40/password/pwdhip40
3.在集群中修改密码文件配置
[oracle@nptdb1dg ~]$srvctl modify database -d hip40 -pwfile +DATA/HIP40/PASSWORD/pwdhip40
--修改完可以通过命令srvctl config database -d hip40查看配置