oracle18c卸载方法,Oracle 18c Sharding 删除catalog 步骤

在Oracle Sharding 中删除shard分片是要非常谨慎,如果shard中还存在chunks,那么删除时会报错,如下:

[dave@www.cndba.cn ~]$ gdsctl

GDSCTL: Version 18.0.0.0.0 - Production on Sat Oct 13 11:08:22 CST 2018

Copyright (c) 2011, 2018, Oracle. All rights reserved.

Welcome to GDSCTL, type "help" for information.

Current GSM is set to SHARDDIRECTOR

GDSCTL> config shard

Name Shard Group Status State Region Availability

---- ----------- ------ ----- ------ ------------

sh101 normal_grp Ok Deployed region1 READ ONLY

sh102 primary_grp Ok Deployed region1 ONLINE

sh103 standby_grp Ok Deployed region2 READ ONLY

GDSCTL> remove shard -shard sh101

GSM-45029: SQL error

ORA-02659: cannot remove a shard which contains chunks

ORA-06512: at "GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN", line 13392

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79

ORA-06512: at "GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN", line 13174

ORA-06512: at "GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN", line 12973

ORA-06512: at line 1

可以将这些chunk转移走,或者用force强制来进行删除,但注意,在使用force时,会删掉所有shard,而不是我们指定的那个, 如下:https://www.cndba.cn/dave/article/3083

https://www.cndba.cn/dave/article/3083https://www.cndba.cn/dave/article/3083

GDSCTL> remove shard -h

Syntax

REMOVE SHARD {-SHARD {shard_name_list | ALL} | -SHARDSPACE shardspace_list |

-SHARDGROUP shardgroup_list} [-FORCE]

Purpose

Removes one or more shards from the sharded database.

Usage Notes

-SHARD ALL removes all shards from sharded pool.

Keywords and Parameters

force: remove specified shard(s) even if they are inaccessible and/or contain

chunks. No resharding will be initiated when using this option. It may

result in a lower number of replicas or total unavailability for a certain

range of data.

shard: a comma-delimited list of shards.

shardgroup: a comma-delimited list of shardgroups.

shardspace: a comma-delimited list of shardspaces.

Examples

REMOVE SHARD -SHARDGROUP group1

GDSCTL> remove shard -shard sh101 -force

GSM Warnings:

CATALOG:ORA-03713: Shard 'sh101' contained 12 chunks.

CATALOG:ORA-02660: Shard 'sh102' was also removed.

CATALOG:ORA-03713: Shard 'sh102' contained 12 chunks.

CATALOG:ORA-02660: Shard 'sh103' was also removed.

CATALOG:ORA-03713: Shard 'sh103' contained 12 chunks.

GDSCTL> config shard

Name Shard Group Status State Region Availability

---- ----------- ------ ----- ------ ------------

此时如果在将这些shard添加到catalog中,会提示shard已经存在,所以这里可以先将catalog也删除掉,在重新添加:https://www.cndba.cn/dave/article/3083https://www.cndba.cn/dave/article/3083

GDSCTL> delete catalog

There are still some gsms connected to catalog. Do you want to continue? (Y/N)y

GDSCTL>

因为sharding 在deploy时会在每个shard上创建数据库实例,所以这里还需要将这些数据库和监听一起关闭,否则添加时还会报错。每天添加后,产生的数据库实例名都不相同,所以还要注意修改环境变量:https://www.cndba.cn/dave/article/3083

[dave@www.cndba.cn ~]$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Sat Oct 13 13:10:28 2018

Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to:

Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

Version 18.3.0.0.0

SQL> shutdown abort

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

Version 18.3.0.0.0

[dave@www.cndba.cn ~]$ lsnrctl stop

LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 13-OCT-2018 13:12:18

Copyright (c) 1991, 2018, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

The command completed successfully

[dave@www.cndba.cn ~]$

最后是删除gsm参数中的director的信息。可以参考之前的博客:

Oracle 18c Sharding GSM 的配置文件gsm.ora

https://www.cndba.cn/dave/article/3081https://www.cndba.cn/dave/article/3083https://www.cndba.cn/dave/article/3083

[dave@www.cndba.cn admin]$ pwd

/u01/app/oracle/product/18.3.0/dbhome_1/network/admin

[dave@www.cndba.cn admin]$ cat gsm.ora

# gsm.ora Network Configuration File: /u01/app/oracle/product/18.3.0/dbhome_1/network/admin/gsm.ora

# Generated by Oracle configuration tools.

SQLNET.WALLET_OVERRIDE = TRUE

WALLET_LOCATION =

(SOURCE =

(METHOD = FILE)

(METHOD_DATA =

(DIRECTORY = /u01/app/oracle/product/18.3.0/dbhome_1/network/admin/gsmwallet)

)

)

[oracle@shardcatalog admin]$

解锁gsmcatuser并设置密码https://www.cndba.cn/dave/article/3083

SQL> alter user gsmcatuser account unlock;

SQL> alter user gsmcatuser identified by oracle;

最后再次确认删除干净,就可以重新开始sharding的创建工作了:https://www.cndba.cn/dave/article/3083

GDSCTL> config

Regions

------------------------

GSMs

------------------------

GDS pools

------------------------

Databases

------------------------

Services

------------------------

GDSCTL pending requests

------------------------

Command Object Status

------- ------ ------

Global properties

------------------------

GDSCTL>

版权声明:本文为博主原创文章,未经博主允许不得转载。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值