查看: 1968|回复: 0

[Oracle数据库] 12c RAC 添加删除ora.dbanme.db资源

发表于 2018-1-25 08:00:00

一、说明
我们在安装数据库集群的时候,最后有一步是使用DBCA建库,建库的过程中到底在集群资源中做了什么呢?实际上添加了一个ora.dbname.db这个集群资源。
删除数据库的方法
1、使用DBCA进行删除,这个大家都会
2、手动删库,先删除集群资源ora.dbanme.db,然后到ASM中删除相关数据即可。

二、操作步骤
1、查看数据库配置

  1. <rac01:+ASM1:/home/grid>$srvctl config database -d orcl
  2. Database unique name: orcl
  3. Database name: orcl
  4. Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
  5. Oracle user: oracle
  6. Spfile: +DATADG/ORCL/PARAMETERFILE/spfile.268.954540133
  7. Password file: +DATADG/ORCL/PASSWORD/pwdorcl.256.954539259
  8. Domain:
  9. Start options: open
  10. Stop options: immediate
  11. Database role: PRIMARY
  12. Management policy: AUTOMATIC
  13. Server pools:
  14. Disk Groups: DATADG
  15. Mount point paths:
  16. Services:
  17. Type: RAC
  18. Start concurrency:
  19. Stop concurrency:
  20. OSDBA group: dba
  21. OSOPER group: oper
  22. Database instances: orcl1,orcl2
  23. Configured nodes: rac01,rac02
  24. Database is administrator managed
  25. <rac01:+ASM1:/home/grid>$
复制代码

2、删除资源

  1. --grid用户执行
  2. srvctl stop database -d orcl
  3. --oracle 用户执行
  4. <rac01:orcl1:/home/oracle>$srvctl remove instance -d orcl -i orcl1
  5. Remove instance from the database orcl? (y/[n]) y
  6. <rac01:orcl1:/home/oracle>$srvctl remove instance -d orcl -i orcl2
  7. Remove instance from the database orcl? (y/[n]) y
  8. <rac01:orcl1:/home/oracle>$srvctl config database -d orcl
  9. Database unique name: orcl
  10. Database name: orcl
  11. Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
  12. Oracle user: oracle
  13. Spfile: +DATADG/ORCL/PARAMETERFILE/spfile.268.954540133
  14. Password file: +DATADG/ORCL/PASSWORD/pwdorcl.256.954539259
  15. Domain:
  16. Start options: open
  17. Stop options: immediate
  18. Database role: PRIMARY
  19. Management policy: AUTOMATIC
  20. Server pools:
  21. Disk Groups: DATADG
  22. Mount point paths:
  23. Services:
  24. Type: RAC
  25. Start concurrency:
  26. Stop concurrency:
  27. OSDBA group: dba
  28. OSOPER group: oper
  29. Database instances:
  30. Configured nodes:
  31. Database is administrator managed
  32. <rac01:orcl1:/home/oracle>$
  33. <rac01:orcl1:/home/oracle>$srvctl remove database -d orcl
  34. Remove the database orcl? (y/[n]) y
复制代码

3、再添加资源

  1. --oracle 用户
  2. srvctl add database -d orcl -o $ORACLE_HOME
  3. srvctl add instance -d orcl -n rac01 -i orcl1
  4. srvctl add instance -d orcl -n rac02 -i orcl2
  5. <rac01:orcl1:/home/oracle>$srvctl add database -d orcl -o $ORACLE_HOME
  6. <rac01:orcl1:/home/oracle>$srvctl config database -d orcl
  7. Database unique name: orcl
  8. Database name:
  9. Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
  10. Oracle user: oracle
  11. Spfile:
  12. Password file:
  13. Domain:
  14. Start options: open
  15. Stop options: immediate
  16. Database role: PRIMARY
  17. Management policy: AUTOMATIC
  18. Server pools:
  19. Disk Groups:
  20. Mount point paths:
  21. Services:
  22. Type: RAC
  23. Start concurrency:
  24. Stop concurrency:
  25. OSDBA group: dba
  26. OSOPER group: oper
  27. Database instances:
  28. Configured nodes:
  29. Database is administrator managed
  30. <rac01:orcl1:/home/oracle>$srvctl add instance -d orcl -n rac01 -i orcl1
  31. <rac01:orcl1:/home/oracle>$srvctl add instance -d orcl -n rac02 -i orcl2
  32. <rac01:orcl1:/home/oracle>$
  33. <rac01:orcl1:/home/oracle>$srvctl config database -d orcl
  34. Database unique name: orcl
  35. Database name:
  36. Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
  37. Oracle user: oracle
  38. Spfile:
  39. Password file:
  40. Domain:
  41. Start options: open
  42. Stop options: immediate
  43. Database role: PRIMARY
  44. Management policy: AUTOMATIC
  45. Server pools:
  46. Disk Groups:
  47. Mount point paths:
  48. Services:
  49. Type: RAC
  50. Start concurrency:
  51. Stop concurrency:
  52. OSDBA group: dba
  53. OSOPER group: oper
  54. Database instances: orcl1,orcl2
  55. Configured nodes: rac01,rac02
  56. Database is administrator managed
  57. <rac01:orcl1:/home/oracle>$
  58. srvctl modify database -db orcl -spfile '+DATADG/ORCL/PARAMETERFILE/spfile.268.954540133' -pwfile '+DATADG/ORCL/PASSWORD/pwdorcl.256.954539259'
  59. <rac01:orcl1:/home/oracle>$srvctl modify database -db orcl -spfile '+DATADG/ORCL/PARAMETERFILE/spfile.268.954540133' -pwfile '+DATADG/ORCL/PASSWORD/pwdorcl.256.954539259'
  60. <rac01:orcl1:/home/oracle>$srvctl start database -d orcl
  61. <rac01:orcl1:/home/oracle>$
复制代码


回复

使用道具 举报