Pages

Sunday 16 December 2012

How to add and remove databases from Oracle cluster


To remove database from Oracle clusterware, use below commands using "oracle" user(Oracle software owner).

srvctl remove database -d db_name

$ srvctl remove database -d test
PRKO-3141 : Database test could not be removed because it was running

$ srvctl stop database -d test
$ srvctl remove database -d test
Remove the database test? (y/[n]) y
$


Once you remove the database,cluserware doesn't maintain any information about this database and its instances and hence you can't manage this database using srvctl.

$ srvctl status database -d TEST
PRCD-1120 : The resource for database TEST could not be found.
PRCR-1001 : Resource ora.test.db does not exist
$ srvctl status instance -d TEST -i TEST1
PRCD-1120 : The resource for database TEST could not be found.
PRCR-1001 : Resource ora.test.db does not exist
$ srvctl status instance -d TEST -i TEST2
PRCD-1120 : The resource for database TEST could not be found.
PRCR-1001 : Resource ora.test.db does not exist



To add database to Oracle clusterware,use below commands using "oracle" user(Oracle software owner).

$ srvctl add database -d test -o /u01/app/oracle/product/11.2.0/dbhome_1 --> This is $ORACLE_HOME of database
$ srvctl config database -d test
Database unique name: test
Database name:
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: test
Database instances:
Disk Groups:
Services:
Database is administrator managed
$ srvctl status database -d test
Database is not running.

$ srvctl start database -d test
Database test cannot be started since it has no configured instances.

So register the database instances as below

$ srvctl add instance -d test -i TEST1 -n rsvmsb300
$ srvctl add instance -d test -i TEST2 -n rsvmsb302
$ srvctl start database -d test
$ srvctl config database -d TEST
Database unique name: test
Database name:
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: test
Database instances: TEST1,TEST2
Disk Groups:
Services:
Database is administrator managed


$ id
uid=1000(oracle) gid=2262(oinstall) groups=1001(dba),2259(asmadmin),2260(asmdba),2261(asmoper),2262(oinstall)
$



8 comments:

  1. great info Sangamesh! helped a lot. thanks

    ReplyDelete
  2. Thank you my friend - I am a professional Oracle dba and your blog was exactly what I needed ! Very good work. Cheers, Rob

    ReplyDelete
  3. Grid Control shows some services that are down and when I run the srvctl remove service -d "database" -s "service_name" -f, I get the error PRCR-1001 : Resource ora."database"."service_name".svc does not exist. Any ideas how to resolve this?

    ReplyDelete
    Replies
    1. Is that Service registered to cluster before you remote it?

      Regards,
      Sangamesh

      Delete
  4. The steps mentioned are not working for me. Is anything wrong here?

    [oracle@blrv009b144 ~]$ srvctl status database -d test
    Instance test is running on node blrv009b144
    [oracle@blrv009b144 ~]$ srvctl stop database -d test
    [oracle@blrv009b144 ~]$
    [oracle@blrv009b144 ~]$ srvctl status database -d test
    Instance test is not running on node blrv009b144
    [oracle@blrv009b144 ~]$ srvctl remove database -d test
    Remove the database test? (y/[n]) y
    PRKO-3077 : Failed to remove database test: PRCD-1032 : Failed to remove database resource test
    PRCR-1028 : Failed to remove resource ora.test.db
    PRCR-1072 : Failed to unregister resource ora.test.db
    CRS-2730: Resource 'ora.test.testpdb1.pdb' depends on resource 'ora.test.db'
    [oracle@blrv009b144 ~]$

    ReplyDelete