How to Setup Oracle External Database For Cloudera Manager

Configuring an external metastore is easy at installation time, but it gets a little more complicated to migrate an already running cluster to a new external database.

In this section we are going to see.

Take cloudera cluster configuration backup first.

Stop the scm-server and the embedded PostgreSQL database services:

Note: You Should Have Full Permission to Stop Services.


service cloudera-scm-server stop
service cloudera-scm-server-db stop


Backup the current PostgreSQL database and the scm server directory:


cd /var/lib/cloudera-scm-server-db
mkdir /usr/backup
tar -cvf /usr/backup/database.tar /usr/backup/
cd /etc/cloudera-scm-server
tar -cvf /usr/backup/properties.tar /usr/backup/



Prepare Oracle Database.

Download Oracle Java Connector and Copy to /usr/share/java/

cp /tmp/oracle-connector-java.jar /usr/share/java/oracle-connector-java.jar

Now Create The User/Schema For Cloudera Manager and Assign Privileges

create user scmserver identified by scmserver default tablespace users;
grant CREATE SESSION to scmserver;
grant CREATE ANY TABLE to scmserver;
grant CREATE ANY SEQUENCE to scmserver;
grant CREATE ANY INDEX to scmserver;
grant ALTER ANY TABLE to scmserver;
grant ALTER ANY INDEX to scmserver;
alter user scmserver quota unlimited on users;

We Should Create Oracle Users And Databases For Below Services

  1. Activity Monitor
  2. Reports Manager
  3. Hive Metastore
  4. Sentry Server
  5. Navigator Audit Server
  6. Cloudera Navigator Metadata Server

Find Below Script


alter session set container=cloudera;

create user amon identified by amon container=current default tablespace users;
grant CREATE SESSION to amon;
grant CREATE ANY TABLE to amon;
grant CREATE ANY SEQUENCE to amon;
grant CREATE ANY INDEX to amon;
grant ALTER ANY TABLE to amon;
grant ALTER ANY INDEX to amon;
alter user amon quota unlimited on users;


create user rman identified by rman container=current default tablespace users;
grant CREATE SESSION to rman;
grant CREATE ANY TABLE to rman;
grant CREATE ANY SEQUENCE to rman;
grant CREATE ANY INDEX to rman;
grant ALTER ANY TABLE to rman;
grant ALTER ANY INDEX to rman;
alter user rman quota unlimited on users;

create user hive identified by hive container=current default tablespace users;
grant CREATE SESSION to hive;
grant CREATE ANY TABLE to hive;
grant CREATE ANY SEQUENCE to hive;
grant CREATE ANY INDEX to hive;
grant ALTER ANY TABLE to hive;
grant ALTER ANY INDEX to hive;
alter user hive quota unlimited on users;

create user nav identified by nav container=current default tablespace users;
grant CREATE SESSION to nav;
grant CREATE ANY TABLE to nav;
grant CREATE ANY SEQUENCE to nav;
grant CREATE ANY INDEX to nav;
grant ALTER ANY TABLE to nav;
grant ALTER ANY INDEX to nav;
alter user nav quota unlimited on users;

create user navms identified by navms container=current default tablespace users;
grant CREATE SESSION to navms;
grant CREATE ANY TABLE to navms;
grant CREATE ANY SEQUENCE to navms;
grant CREATE ANY INDEX to navms;
grant ALTER ANY TABLE to navms;
grant ALTER ANY INDEX to navms;
alter user navms quota unlimited on users;

GRANT EXECUTE ON sys.dbms_crypto TO nav;
GRANT CREATE VIEW TO nav;

Configuring Cloudera Manager to Use The New Database

Take Backup of Properties File. If Anything Goes Wrong We Can Reconfigure Old Databases.

cp /etc/cloudera-scm-server/db.properties /home/sam/

Run Below Command to Configure Databases.


[root@cmhost~]# /usr/share/cmf/schema/scm_prepare_database.sh oracle -h oracle.db.host cloudera scmserver scmserver
JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing: /usr/java/jdk1.7.0_67-cloudera/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
[ main] DbCommandExecutor INFO Successfully connected to database.
All done, your SCM database is configured correctly!

Rename The old db.management.properties File Because It Contains Old Management Services Database Information.


mv /etc/cloudera-scm-server/db.mgmt.properties /etc/cloudera-scm-server/db.mgmt.properties.old

Start Cloudera Server


service cloudera-scm-server start
rm -f /var/lib/cloudera-scm-agent/cm_guid
service cloudera-scm-agent restart

Go to Cluster -> Configuration-> Database Settings:

Manually Change PostgreSQL to Oracle Database

how to setup oracle external database for cloudera manager

Redeploy The Client Configuration Files.