一、说明
我们在安装数据库集群的时候,最后有一步是使用DBCA建库,建库的过程中到底在集群资源中做了什么呢?实际上添加了一个ora.dbname.db这个集群资源。
删除数据库的方法
1、使用DBCA进行删除,这个大家都会
2、手动删库,先删除集群资源ora.dbanme.db,然后到ASM中删除相关数据即可。
二、操作步骤
1、查看数据库配置
<rac01:+ASM1:/home/grid>$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
<rac01:+ASM1:/home/grid>$
2、删除资源
--grid用户执行
srvctl stop database -d orcl
--oracle 用户执行
<rac01:orcl1:/home/oracle>$srvctl remove instance -d orcl -i orcl1
Remove instance from the database orcl? (y/[n]) y
<rac01:orcl1:/home/oracle>$srvctl remove instance -d orcl -i orcl2
Remove instance from the database orcl? (y/[n]) y
<rac01:orcl1:/home/oracle>$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
<rac01:orcl1:/home/oracle>$
<rac01:orcl1:/home/oracle>$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
<rac01:orcl1:/home/oracle>$srvctl add database -d orcl -o $ORACLE_HOME
<rac01:orcl1:/home/oracle>$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
<rac01:orcl1:/home/oracle>$srvctl add instance -d orcl -n rac01 -i orcl1
<rac01:orcl1:/home/oracle>$srvctl add instance -d orcl -n rac02 -i orcl2
<rac01:orcl1:/home/oracle>$
<rac01:orcl1:/home/oracle>$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
<rac01:orcl1:/home/oracle>$
srvctl modify database -db orcl -spfile '+DATADG/ORCL/PARAMETERFILE/spfile.268.954540133' -pwfile '+DATADG/ORCL/PASSWORD/pwdorcl.256.954539259'
<rac01:orcl1:/home/oracle>$srvctl modify database -db orcl -spfile '+DATADG/ORCL/PARAMETERFILE/spfile.268.954540133' -pwfile '+DATADG/ORCL/PASSWORD/pwdorcl.256.954539259'
<rac01:orcl1:/home/oracle>$srvctl start database -d orcl
<rac01:orcl1:/home/oracle>$
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。