一、说明
我们在安装数据库集群的时候,最后有一步是使用DBCA建库,建库的过程中到底在集群资源中做了什么呢?实际上添加了一个ora.dbname.db这个集群资源。
删除数据库的方法
1、使用DBCA进行删除,这个大家都会
2、手动删库,先删除集群资源ora.dbanme.db,然后到ASM中删除相关数据即可。
二、操作步骤
1、查看数据库配置
$srvctl config database -d orcl
Database unique name: orcl
Database name: orcl
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile: +DATADG/ORCL/PARAMETERFILE/spfile.268.954540133
Password file: +DATADG/ORCL/PASSWORD/pwdorcl.256.954539259
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATADG
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: orcl1,orcl2
Configured nodes: rac01,rac02
Database is administrator managed
$
2、删除资源
--grid用户执行
srvctl stop database -d orcl
--oracle 用户执行
$srvctl remove instance -d orcl -i orcl1
Remove instance from the database orcl? (y/[n]) y
$srvctl remove instance -d orcl -i orcl2
Remove instance from the database orcl? (y/[n]) y
$srvctl config database -d orcl
Database unique name: orcl
Database name: orcl
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile: +DATADG/ORCL/PARAMETERFILE/spfile.268.954540133
Password file: +DATADG/ORCL/PASSWORD/pwdorcl.256.954539259
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATADG
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances:
Configured nodes:
Database is administrator managed
$
$srvctl remove database -d orcl
Remove the database orcl? (y/[n]) y
3、再添加资源
--oracle 用户
srvctl add database -d orcl -o $ORACLE_HOME
srvctl add instance -d orcl -n rac01 -i orcl1
srvctl add instance -d orcl -n rac02 -i orcl2
$srvctl add database -d orcl -o $ORACLE_HOME
$srvctl config database -d orcl
Database unique name: orcl
Database name:
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_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:
Database is administrator managed
$srvctl add instance -d orcl -n rac01 -i orcl1
$srvctl add instance -d orcl -n rac02 -i orcl2
$
$srvctl config database -d orcl
Database unique name: orcl
Database name:
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_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: orcl1,orcl2
Configured nodes: rac01,rac02
Database is administrator managed
$
srvctl modify database -db orcl -spfile '+DATADG/ORCL/PARAMETERFILE/spfile.268.954540133' -pwfile '+DATADG/ORCL/PASSWORD/pwdorcl.256.954539259'
$srvctl modify database -db orcl -spfile '+DATADG/ORCL/PARAMETERFILE/spfile.268.954540133' -pwfile '+DATADG/ORCL/PASSWORD/pwdorcl.256.954539259'
$srvctl start database -d orcl
$
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。