when it comes to the grid infrastructure ( single node or cluster configuration ) oracle needs to store and manage some configuration data about the state of the node(s) and its resources. each node in the configuration has its own container to store and manage data which is called the “oracle local registry (olr)”.
by using the ocrcheck utility one can check the current the status of the local registry:
ocrcheck -local Status of Oracle Local Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 2472 Available space (kbytes) : 259648 ID : 1322090758 Device/File Name : /opt/oracle/product/crs/18.104.22.168/cdata/localhost/oracleplayground.olr Device/File integrity check succeeded Local registry integrity check succeeded Logical corruption check bypassed due to non-privileged user
beside some other information this tells that the local registry is located here:
if you wonder about the “Logical corruption check bypassed due to non-privileged user” message, this is because the ocrcheck command was executed as the grid infrastructure software owner. re-executing the same command as root user will show “Logical corruption check succeeded”. why root? because some parts of the grid infrastructure run with root privileges ( remember the roothas.pl or rootcrs.pl setup script ).
as the local registry is essential for the cluster stack to start up there must be a way to do proper backups and restores of it in case it gets lost or corrupted. oracle creates an initial backup of the olr after the configuration of the grid infrastructure. from that point onwards it is up to you to create and manage the backups. you will find the initial backup of your olr under ORACLE_HOME/cdata/[HOSTNAME]/, in my case:
ls -al /opt/oracle/product/crs/22.214.171.124/cdata/oracleplayground/ total 5644 drwxr-x--- 2 grid oinstall 4096 Mar 23 09:18 . drwxrwx--- 4 grid oinstall 4096 Mar 23 09:17 .. -rw------- 1 grid oinstall 5746688 Mar 23 09:18 backup_20120323_091815.olr
first of all one should decide where to store the manual backups of the olr. the default location is fine if you do regular backups of your $ORACLE_HOME ( and it is strongly recommended to do so ). to list the current configuration use:
./ocrconfig -local -showbackup oracleplayground 2012/03/23 09:18:15 /opt/oracle/product/crs/126.96.36.199/cdata/oracleplayground/backup_20120323_091815.olr
if you need to change the location for any reason, you can do so by using the ocrconfig command:
./ocrconfig -local -backuploc [BACKUP_DESTINATION]
doing backups of your olr is as easy as:
/ocrconfig -local -manualbackup oracleplayground 2012/05/03 15:51:38 /opt/oracle/product/crs/188.8.131.52/cdata/oracleplayground/backup_20120503_155138.olr oracleplayground 2012/03/23 09:18:15 /opt/oracle/product/crs/184.108.40.206/cdata/oracleplayground/backup_20120323_091815.olr
…which will also list the current backups of the olr. of course you need to ensure that these files are being backuped up to a safe location ( to a tape, for example ).
another way for doing backups and restores is to use the “import” and “export” parameters of the ocrconfig command:
./ocrconfig -local -export /tmp/olr.dmp ./ocrconfig -local -import /tmp/olr.dmp
as oracle recommends not to use the “export” and “import” procedures for backups and restores i wonder what these parameters are for.
perhaps you should do both kinds of backups to be sure that one of it really works :)
in case you need to restore a backup of the local registry make sure you stop the cluster stack before:
crsctl stop has ocrconfig -local -restore [OLR_BACKUP_FILE] ocrcheck -local crsctl start has
as it should be clear now how to backup and restore the local registry lets take look at the contents. oracle provides another command for dumping the contents of the local ( or cluster ) registry:
./ocrdump -local -stdout
this will dump the contents of the local registry to the screen. take a look at the output and you will see why the registry is essential for the stack. if you registered a database and listener with the grid infrastructure you will see something like this:
[SYSTEM.OHASD.RESOURCES.ora!db112!db] [SYSTEM.OHASD.RESOURCES.ora!db112!db.CONFIG] ORATEXT : ACL=owner:grid:rwx,pgrp:asmdba:r-x,other::r--,group:oinstall:r-x,user:oracle:rwx~ACTION_FAILURE_TEMPLATE=~ACTION_SCRIPT=~ACTIVE_PLACEMENT=1~AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%~AUTO_START=restore~BASE_TYPE=ora.cluster_resource.type~CARDINALITY=1~CHECK_INTERVAL=1~CHECK_TIMEOUT=30~CLUSTER_DATABASE=false~DATABASE_TYPE=SINGLE~DB_UNIQUE_NAME=DB112~DEFAULT_TEMPLATE=PROPERTY(RESOURCE_CLASS=database) PROPERTY(DB_UNIQUE_NAME= CONCAT(PARSE(%NAME %, ., 2), %USR_ORA_DOMAIN%, .)) ELEMENT(INSTANCE_NAME= %GEN_USR_ORA_INST_NAME%) ELEMENT(DATABASE_TYPE= %DATABASE_TYPE%)~DEGREE=1~DESCRIPTION=Oracle Database resource~ENABLED=1~FAILOVER_DELAY=0~FAILURE_INTERVAL=60~FAILURE_THRESHOLD=1~GEN_AUDIT_FILE_DEST=/oradata/DB112/admin/adump~GEN_START_OPTIONS=open~GEN_USR_ORA_INST_NAME=DB112~HOSTING_MEMBERS=~INSTANCE_FAILOVER=1~LOAD=1~LOGGING_LEVEL=1~MANAGEMENT_POLICY=AUTOMATIC~NAME=ora.db112.db~NLS_LANG=~NOT_RESTARTING_TEMPLATE=~OFFLINE_CHECK_INTERVAL=0~ONLINE_RELOCATI ON_TIMEOUT=0~ORACLE_HOME=/opt/oracle/product/base/220.127.116.11~ORACLE_HOME_OLD=~PLACEMENT=balanced~PROFILE_CHANGE_TEMPLATE=~RESTART_ATTEMPTS=2~ROLE=PRIMARY~SCRIPT_TIMEOUT=60~SERVER_POOLS=~SPFILE=/opt/oracle/product/base/18.104.22.168/dbs/spfileDB112.ora~START_DEPENDENCIES=weak(type:ora.listener.type,uniform:ora.ons) hard(ora.DB112_DATA_DG.dg,ora.DB112_ARCH_DG.dg) pullup(ora.DB112_DATA_DG.dg,ora.DB112_ARCH_DG.dg)~START_TIMEOUT=600~STATE_CHANGE_TEMPLATE=~STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DB112_D ATA_DG.dg,shutdown:ora.DB112_ARCH_DG.dg)~STOP_TIMEOUT=600~TYPE=ora.database.type~TYPE_ACL=owner:oracle:rwx,pgrp:oinstall:rwx,other::r--~TYPE_NAME=ora.database.type~TYPE_VERSION=3.2~UPTIME_THRESHOLD=1h~USR_ORA_DB_NAME=~USR_ORA_DOMAIN=~USR_ORA_ENV=~USR_ORA_FLAGS=~USR_ORA_INST_NAME=DB112~USR_ORA_OPEN_MODE=open~USR_ORA_OPI=false~USR_ORA_STOP_MODE=immediate~VERSION=22.214.171.124.0~
everything the cluster stack needs to know about the registered resource is recorded here. this includes all the dependencies of the resource as well as the different kinds of parameters, e.g. :
… which tells where to find the spfile of the registered database, or:
… which tells that the diskgroups DB112_DATA_DG and DB112_ARCH_DG must be available before the database can start up. this is a hard dependency, so the startup of the database will stop if the diskgroups are not available.
you can get a more readable format by dumping the contents to a xml file:
./ocrdump -local /tmp/olr.xml -xml
as the backups of the olr are the same format as the current olr, ocrdump works the same way if you want to dump the backups. this can help when searching for changes in the olr:
./ocrdump -local /tmp/olr_backup.xml -backupfile /opt/oracle/product/crs/126.96.36.199/cdata/oracleplayground/backup_20120503_155138.olr -xml
you may have observed, that all the commands ( ocrconfig, orcdump, ocrcheck ) are used to manage the local registry as well as the cluster registry in case you have a clustered setup ( RAC or RAC one node, for example ). so, no matter if you are on a single node or cluster configuration: make sure your backup and restore strategy includes the oracle local and cluster registry.