P509 Wenping
If you use dbca to create databases, cluster services, or use netca to configure cluster listeners,
The corresponding configuration results are automatically written into the OCR registration records. However, if you have manually created a database (create database) and manually edited
The listener file is not recorded in OCR. This requires the Administrator to use the srvctl add command to manually register the cluster service information box OCR.
If you have directly deleted the database and other similar operations without using the dbca tool, you need to use the reverse command srvctl remove.
Manually delete information.
For example, run the Add database command to manually add a set of cluster database sdzy and add instances to node_ B of node_a.
Sdzy1 and sdzy2:
$ Srvctl add database-D sdzy-o/DB/Oracle/product/10.2.0/db_1
$ Srvctl add instance-D sdzy-I sdzy1-N node_a
$ Srvctl add instance-D sdzy-I sdzy2-N node_ B
During the above process, the definition of the database sdzy is added to the cluster Registry (this does not mean that this database must exist)
. The-D parameter is followed by the database name. The-O parameter declares the ORACLE_HOME of the database, and the-I parameter declares the database on each node.
Instance name, while the-n parameter describes the node name.
Check the registration result of the database in OCR and query the database sdzy as follows:
$ Srvctl config database-D sdzy
Node_a sdzy1/DB/Oracle/product/10.2.0/db_1
Node_ B sdzy2/DB/Oracle/product/10.2.0/db_1
$ Crs_stat-T
Name type target State host
------------------------------------------------------------
Ora... t1.inst application online cctt1
Ora... t2.inst application online cctt2
Ora. cctt. DB application online cctt1
Ora... tt1.srv application online cctt1
Ora... tt2.srv application online cctt2
Ora... TAF. CS application online cctt1
Ora... sm1.asm application online cctt1
Ora... t1.lsnr application online cctt1
Ora. cctt1.gsd application online cctt1
Ora. cctt1.ons application online cctt1
Ora. cctt1.vip application online cctt1
Ora... sm2.asm application online cctt2
Ora... t2.lsnr application online cctt2
Ora. cctt2.gsd application online cctt2
Ora. cctt2.ons application online cctt2
Ora. cctt2.vip application online cctt2
Ora. sdzy. DB application offline
Ora... y1.inst application offline
Ora... y2.inst application offline
$ Srvctl config database-D sdzy
Cctt1 sdzy1/Oracle/product/DB
Cctt2 sdzy2/Oracle/product/DB
After the addition is complete, the administrator can create a manual sdzy database from any node, and start and
Shut down the database or use the database in a cluster. You only need to create other related information, such as the network listening service.
Deleting OCR information is equally important. If a database is manually deleted or needs to be reconstructed, the cluster Registry already contains such information. Therefore, you must delete the original database information before you can re-create the database.
Run the srvctl remove command to manually delete a set of cluster database sdzy, and delete the instance sdzy1 and
Sdzy2:
Srvctl remove instance-D sdzy-I sdzy1
Srvctl remove instance-D sdzy-I sdzy2
|
$ Srvctl config database-D sdzy
Cctt1 sdzy1/Oracle/product/DB
Cctt2 sdzy2/Oracle/product/DB
$ Srvctl remove instance-D sdzy-I sdzy1
Remove instance sdzy1 from the database sdzy? (Y/[N]) y
$ Srvctl remove instance-D sdzy-I sdzy2
Remove instance sdzy2 from the database sdzy? (Y/[N]) y
$ Srvctl remove database-D sdzy
Remove the database sdzy? (Y/[N]) y
$ Crs_stat-T
Name type target State host
------------------------------------------------------------
Ora... t1.inst application online cctt1
Ora... t2.inst application online cctt2
Ora. cctt. DB application online cctt1
Ora... tt1.srv application online cctt1
Ora... tt2.srv application online cctt2
Ora... TAF. CS application online cctt1
Ora... sm1.asm application online cctt1
Ora... t1.lsnr application online cctt1
Ora. cctt1.gsd application online cctt1
Ora. cctt1.ons application online cctt1
Ora. cctt1.vip application online cctt1
Ora... sm2.asm application online cctt2
Ora... t2.lsnr application online cctt2
Ora. cctt2.gsd application online cctt2
Ora. cctt2.ons application online cctt2
Ora. cctt2.vip application online cctt2
$
| |
OCR includes cluster service-related information, including mass instance information, ASM instance information, and cluster database information.
Such information maintains the operation of the RAC cluster and requires necessary reliability maintenance. The information of all nodes will not be missing.
The OCR settings can be obtained through the ocrcheck in the $ crs_home/bin directory.
$ Ocrcheck
Status of Oracle cluster registry is as follows:
Version: 2
Total Space (Kbytes): 524044
Used space (Kbytes): 4636
Available space (Kbytes): 519408
ID: 344313012
Device/File Name:/dev/roradsk/oradsk00
Device/file integrity check succeeded
Device/File Not Configured
Cluster registry integrity check succeeded
As OCR information is very important to the cluster, Oracle design includes the backup of OCR information. OCR information in running status
Backup is performed every 4 hours and stored in the CDATA/<clustername> directory of crs_home. At the same time, bin in the crs_home directory
The directory also contains the corresponding Orc maintenance command ocrconfig. You can query the OCR backup information through this command.
|
$ CD $ ora_crs_home
$ Pwd
/Oracle/product/CRS
$ CD CDATA
$ Ls
CRS-cctt localhost
$ Cd crs-cctt
$ Ls
Backup00.ocr backup02.ocr day _. OCR week _. OCR
Backup01.ocr day. OCR week. OCR
$ Pwd
/Oracle/product/CRS/CDATA/CRS-cctt
| |
$ Ocrconfig-showbackup
Cctt1 2010/01/28 10:09:37/Oracle/product/CRS/CDATA/CRS-cctt
Cctt1 2010/01/28 06:09:36/Oracle/product/CRS/CDATA/CRS-cctt
Cctt1 2010/01/28 02:09:35/Oracle/product/CRS/CDATA/CRS-cctt
Cctt1 2010/01/27 02:09:30/Oracle/product/CRS/CDATA/CRS-cctt
Cctt1 2010/01/18 02:08:41/Oracle/product/CRS/CDATA/CRS-cctt
$
|
Of course, this backup can be changed. If you want OCR to back up data to another directory, the administrator can use the following command:
. First, log on to the system as the root user, go to the $ crs_home/bin directory, and run the following command:
This backup location is in another directory CRS-Backup:
#./Ocrconfig-backuploc/DB/Oracle/product/10.2.0/CRS/CDATA/crs_backup
Oracle ensures that OCR is automatically backed up every four hours. In addition, we can use the ocrconfig tool to customize
Periodic OCR logical backup. The following uses the export syntax of the ocrconfig command to back up OCR to a file in the/DB/Oracle directory.
In ocr_export1.dmp, the process is as follows:
#./Ocrconfig-export/DB/Oracle/orc_export1.dmp
| |
$ Which ocrconfig
/Oracle/product/DB/bin/ocrconfig
$ CD/Oracle/product/DB/bin/
$ Su
Password:
#
#./Ocrconfig-export/Oracle/ocr_export1.dmp
#
# Ls-L/Oracle/ocr_export1.dmp
-RW-1 root sys 104160 Jan 28/Oracle/ocr_export1.dmp
| |
On Aix, use the./ocrconfig-Export command to form a shell script, and run the crontab-e command to put the OCR backup plan
This is obviously an engineering alternative in a routine backup plan.
If the cluster OCR is unavailable and the cluster cannot be started and used, the importance of OCR backup is highlighted. Only one node of the cluster is started,
Log on to the system in single-user mode to avoid starting the CSS and CRS daemon, and use OCR logical backup to reconstruct OCR. The method is as follows:
#./Ocrconfig-import/DB/Oracle/ocr_export1.dmp
After the import is successful, start all nodes in normal mode.
If you use OCR for automatic physical backup, use the./ocrconfig-resotre command for recovery.