2013/05/15

Converting an Administrator-Managed Database to a Policy-Managed Database and vise versa.


Hi, 
Cluster database configuration can be Policy-Managed or Administrator-Managed. A Policy-Managed database is dynamic with instances managed automatically based on server pools for effective resource utilization. Admin-Managed database results in instances tied to specific servers.

When we create 11g Release 2 RAC database, on database configuration assistant’s 3 of 13 step we must choose Configuration type : Admin-Managed or Polisy-Managed.





As you know, we can convert configuration type of Oracle RAC Database after installation.In this post I want share steps of conversion of Admin-Managed database to Policy managed (Case #1) and Policy-Managed to Admin-Managed (Case #2). In  my case my test RAC Database (racdb) is created Adminstrator-Managed. 

Case #1 : Convert Administrator-Managed Database to Policy-Managed Database

Checking configuration of racdb database.

[oracle@oel62-rac1 /]$ srvctl config database -d racdb   
 Database unique name: racdb  
 Database name:   
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome  
 Oracle user: oracle  
 Spfile:   
 Domain:   
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Server pools: racdb  
 Database instances: racdb1,racdb2  
 Disk Groups: DATA,FRA  
 Mount point paths:   
 Services:   
 Type: RAC  
 Database is administrator managed  
 [oracle@oel62-rac1 /]$  

1. Create a server pool for the Policy-Managed database

 [oracle@oel62-rac1 /]$ srvctl add srvpool -g PMSRVPOOL -l 0 -u 2  
 [oracle@oel62-rac1 /]$ srvctl config serverpool  
 Server pool name: Free  
 Importance: 0, Min: 0, Max: -1  
 Candidate server names:   
 Server pool name: Generic  
 Importance: 0, Min: 0, Max: -1  
 Candidate server names: oel62-rac1,oel62-rac2  
 Server pool name: PMSRVPOOL  
 Importance: 0, Min: 0, Max: 2  
 Candidate server names:   
 [oracle@oel62-rac1 /]$   

2. Modify the database to be in the new server pool, as follows:


 [oracle@oel62-rac1 /]$ srvctl modify database -d racdb -g PMSRVPOOL  
 [oracle@oel62-rac1 /]$ srvctl config database -d racdb   
 Database unique name: racdb  
 Database name:   
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome  
 Oracle user: oracle  
 Spfile:   
 Domain:   
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Server pools: PMSRVPOOL  
 Database instances:   
 Disk Groups: DATA,FRA  
 Mount point paths:   
 Services:   
 Type: RAC  
 Database is policy managed  

Servers already  located in PMSRVPOOL

 [oracle@oel62-rac1 /]$ srvctl status srvpool  
 Server pool name: Free  
 Active servers count: 0  
 Server pool name: Generic  
 Active servers count: 0  
 Server pool name: PMSRVPOOL  
 Active servers count: 2  

3. Last step is configuration of Oracle Enterprise Manager

Documentation says : 

Configure
Oracle Enterprise Manager to recognize the change you made in the previous procedure, as follows:

  1. In order for Oracle Enterprise Manager Database Control to recognize the new database instances, you must change the instance name fromdb_unique_name# to db_unique_name_# (notice the additional underscore (_) before the number sign (#) character).
  2. Rename the orapwd file in the dbs/database directory (or create a new orapwd file by running the orapwd command). By default, there is an orapwd file with the instance name appended to it, such as orapwdORCL1. You must change the name of the file to correspond to the instance name you changed in the previous step. For example, you must change orapwdORCL1 to orapwdORCL_1 or create a new orapwd file.
  3. Run emca to reconfigure Oracle Enterprise Manager Database Control, as follows:
    emca -config dbcontrol db –cluster

Database is Policy Managed, now.

 [oracle@oel62-rac1 /]$ srvctl config database -d racdb   
 Database unique name: racdb  
 Database name:   
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome  
 Oracle user: oracle  
 Spfile:   
 Domain:   
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Server pools: PMSRVPOOL  
 Database instances:   
 Disk Groups: DATA,FRA  
 Mount point paths:   
 Services:   
 Type: RAC  
 Database is policy managed  
 [oracle@oel62-rac1 /]$   

Case #2 : Convert Policy Managed Database to Administrator Managed Database

Documentation says:
You cannot directly convert a policy-managed database to an administrator-managed database. Instead, you can remove the policy-managed configuration using the srvctl remove database and srvctl remove service commands, and then register the same database as an administrator-managed database using the srvctl add database and srvctl add instance commands. Once you register the database and instance, you must use the srvctl add service command to add back the services as you removed them.

1. Remove database with SRVCTL tool. 


 [oracle@oel62-rac1 /]$ srvctl remove database -d racdb  
 PRKO-3141 : Database racdb could not be removed because it was running  

If your database running you can use –f (force) for remove running database. But this way is not recommended. 

Stopping database and removing.

 [oracle@oel62-rac1 /]$ srvctl stop database -d racdb   
 [oracle@oel62-rac1 /]$ srvctl status database -d racdb   
 Instance racdb1 is not running on node oel62-rac1  
 Instance racdb2 is not running on node oel62-rac2  
 [oracle@oel62-rac1 /]$ srvctl remove database -d racdb  
 Remove the database racdb? (y/[n]) y  
 [oracle@oel62-rac1 /]$ srvctl status database -d racdb  
 PRCD-1120 : The resource for database racdb could not be found.  
 PRCR-1001 : Resource ora.racdb.db does not exist  
 [oracle@oel62-rac1 /]$   

2. Add database Administrator Managed

 [oracle@oel62-rac1 /]$ srvctl add database -d racdb -o /u01/app/oracle/product/11.2.0/dbhome -y automatic  
 [oracle@oel62-rac1 /]$ srvctl config database -d racdb  
 Database unique name: racdb  
 Database name:   
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome  
 Oracle user: oracle  
 Spfile:   
 Domain:   
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Server pools: racdb  
 Database instances:   
 Disk Groups:   
 Mount point paths:   
 Services:   
 Type: RAC  
 Database is administrator managed  
 [oracle@oel62-rac1 /]$   

3. Adding database instances

 [oracle@oel62-rac1 /]$ srvctl add instance -d racdb -i racdb1 -n oel62-rac1  
 [oracle@oel62-rac1 /]$ srvctl add instance -d racdb -i racdb2 -n oel62-rac2  
 [oracle@oel62-rac1 /]$   
 [oracle@oel62-rac1 /]$ srvctl start database -d racdb   
 [oracle@oel62-rac1 /]$ srvctl status database -d racdb   
 Instance racdb1 is running on node oel62-rac1  
 Instance racdb2 is running on node oel62-rac2  
 [oracle@oel62-rac1 /]$ srvctl config database -d racdb  
 Database unique name: racdb  
 Database name:   
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome  
 Oracle user: oracle  
 Spfile:   
 Domain:   
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Server pools: racdb  
 Database instances: racdb1,racdb2  
 Disk Groups: DATA,FRA  
 Mount point paths:   
 Services:   
 Type: RAC  
 Database is administrator managed  
 [oracle@oel62-rac1 /]$   

4. You must  configure Oracle Enterprise Manager on last step.


References :
Oracle Real Application Clusters Administration and Deployment Guide 11g Release 2 (11.2)
Policy Managed Databases and Server Pools – by Aychin Gasimov


Regards
Mahir M. Quluzade