背景
为PDB添加指定服务名报错,因要添加的服务名与数据库默认服务名重名,因此可以修改数据库唯一名绕过此问题。
[oracle@rac01 ~]$ srvctl add service -db testdb -service testdb -pdb PDBOD1A -preferred TESTDB1,TESTDB2 PRCD-1210 : The service name testdb cannot be same as the database default service name TESTDB [oracle@rac01 ~]$
复制
变更步骤
移除数据库集群资源
因为数据库注册在集群里,需要首先移除数据库集群资源,否则修改唯一名报错如下。
SQL> alter system set db_unique_name='TESTDBA' scope=spfile;
alter system set db_unique_name='TESTDBA' scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-65500: could not modify DB_UNIQUE_NAME, resource exists
SQL> !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
// modifying DB_UNIQUE_NAME.
SQL>
复制
- 配置记录下来,添加资源时候使用
[oracle@rac01 ~]$ srvctl config database -d testdb
复制
- 移除
[oracle@rac01 ~]$ srvctl stop database -db testdb [oracle@rac01 ~]$ srvctl remove database -db testdb Remove the database testdb? (y/[n]) y [oracle@rac01 ~]$
复制
修改数据库唯一名
注意按规范定一个新的数据库唯一名。
SQL> startup nomount
SQL> alter system set db_unique_name='TESTDBA' scope=spfile;
SQL> shutdown immediate
复制
添加数据库集群资源
指定好移除前记录的参数文件和密码文件路径
[oracle@rac01 ~]$ srvctl add database -db TESTDBA -oraclehome /u01/app/oracle/product/19.0.0/db_1 -spfile '+DATADG/TESTDB/PARAMETERFILE/spfile.272.1140521277' -pwfile '+DATADG/TESTDB/PASSWORD/pwdtestdb.256.1140519587' [oracle@rac01 ~]$ srvctl add instance -db TESTDBA -instance TESTDB1 -node rac01 [oracle@rac01 ~]$ srvctl add instance -db TESTDBA -instance TESTDB2 -node rac02 [oracle@rac01 ~]$ srvctl start database -db testdba
复制
添加服务并启动
[oracle@rac01 ~]$ srvctl add service -db TESTDBA -service testdb -pdb PDBOD1A -preferred TESTDB1,TESTDB2 [oracle@rac01 ~]$ srvctl start service -db testdba -service testdb
复制
验证
指定监听名称
[oracle@rac01 ~]$ lsnrctl status listener_name
复制
订阅号:DongDB手记
墨天轮:https://www.modb.pro/u/231198
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。