【ORACLE RAC】root.sh原理,ocr管理
************************************************************************ ****原文: blog.csdn.net/clark_xu 徐长亮的专栏 ************************************************************************ Root.sh的原理 1. In root.sh script, it will ad
************************************************************************ ****原文:blog.csdn.net/clark_xu 徐长亮的专栏 ************************************************************************ Root.sh的原理
1. In root.sh script, it will addCRS related entry in /etc/inittab,
2. Root.sh运行
/oracle/product/crs/install/rootinstall
/oracle/product/crs/install/rootconfig
3. Rootinstall作用:
a) /oracle/product/crs/bin/crs*的程序改成root 555
b) /oracle/product/crs/bin/crsd改为 744
c) 建立路径:/oracle/product/crs/crs/init
d) /oracle/product/crs/crs/public被所有读写 777.
e) Crs/evm crs/evm/init 750
f) Crs/css crs/css/initcrs/css/log crs/css/auth 711
4. Rootconfig的作用
a) 概述:
i. 1) Stop if any GSDs are runningfrom 9.x oracle homes
ii. 2) Initialize new OCR device orupgrade the existing OCR device
iii. 3) Setup OCR for running CRSstack
iv. 4) Copy the CRS init script toinit.d for init process to start
v. 5) Start the CRS stack
vi. 6) Configure NodeApps if CRS is up and runningon all nodes
b) Setup ocr
i. $CH/bin/clscfg -install -nn$CRS_NODE_NAME_LIST -pn $CRS_PRIVATE_NAME_LIST \
$HOSTNAMES_ARGS-o $CH -c $CRS_CLUSTER_NAME -l "$CRS_LANGUAGE_ID" -q $CRS_V
OTING_DISKS \
$CLSCFG_MISCNT
c) 更改/tmp/.oracle的属性
i. 复杂# basic copies first...
ii. $CP $CH/evm/admin/init.evmd$ID/init.evmd || { $ECHO $?; exit 1; }
iii. $CP $CH/css/admin/init.cssd $ID/init.cssd|| { $ECHO $?; exit 1; }
iv. $CP $CH/crs/admin/init.crsd$ID/init.crsd || { $ECHO $?; exit 1; }
v. $CP $CH/crs/admin/init.crs$ID/init.crs || { $ECHO $?; exit 1; }
d) 启动crs stack过程
i. # Prepare to start the daemons. /init.crs start
ii. #Check to see if they are goingto start.
$ID/init.cssd startcheck CSS
$CRSCTL check install -wait 600
检查VIP:$CH/bin/vipca -silent -nodelist $CRS_NODELIST -nodevips$CRS_NODEVIPS
5. Init.crs
a) 概述
i. # init.crs start manual startup of the CRS stack
ii. # init.crs stop shuts down the CRS stack
iii. # init.crs disable prevents CRS stack from starting at boottime
iv. # init.crs enable allows CRS stack to start at boot time
b) cssd and evmd. evmd should beshutdown before crsd.
6. Init.cssd
a) [root@host1 etc]# ps -ef | grep-v grep | grep init.cssd
b) root 2598 1 0 08:16 ? 00:00:11 /bin/sh /etc/init.d/init.cssdfatal
c) root 3014 2598 0 08:17 ? 00:00:00 /bin/sh /etc/init.d/init.cssddaemon
d) [root@host1 etc]# pstree 2598-a
OCR
1.定义
集群注册表(Oracle ClusterRegistry:OCR):维护集群的配置信息及集群中任何集群数据库的配置信息。OCR也管理那些Oracle Clusterware控制的相关进程的相关信息。OCR将配置信息存储在一个目录树结构中的一系列关键字-值对中(key-value pairs)。OCR必须位于集群中所有结点可同时访问的共享磁盘中。Oracle Clusterware可使用多重OCR(multiplex或称为多路复用)。Oracle建议使用此特性以保证高可用性。你可以在联机时替换一个故障的OCR,可通过支持的API(如企业管理器、srvctl及dbca)来更新OCR。
备份
[root@host1 crs]# ls
backup00.ocr backup01.ocr day_.ocr day.ocr OCRDUMPFILE week.ocr
[root@host1 crs]# pwd
/oracle/product/crs/cdata/crs
Oracle 每4个小时对其做一次备份,并且保留最后的3个备份,以及前一天,前一周的最后一个备份。只有一个节点能对OCR Disk进行读写操作,这个节点叫作Master Node,所有节点都会在内存中保留一份OCR的拷贝。
日志
/oracle/product/crs/log/host1/client/路径下面
OCR磁盘最多只能有两个,一个PrimaryOCR和一个Mirror OCR。
/oracle/product/crs/cdata/crs /OCRDUMPFILE文件中存放ocr注册表信息。
检测
cluvfy comp ocr -n all
导入与恢复
[root@host1 oracle]#/oracle/product/crs/bin/ocrconfig -import /oracle/ocr.exp
[root@host1oracle]# /oracle/product/crs/bin/ocrconfig -export /oracle/ocr.exp
恢复OCR文件:ocrconfig-restore /u01/app/oracle/product/10.2.0/crs_1/cdata/crs/backup00.ocr
添加OCR文件,crs必须启动,否则会遇到PROT-1错误:(PROT-1:Failed to initialize ocrconfig
查看主和镜像
[oracle@host1 crs]$ cat /etc/oracle/ocr.loc
ocrconfig_loc=/dev/raw/raw1
ocrmirrorconfig_loc=/dev/raw/raw2
local_only=FALSE
voting disk
查看
[oracle@host1 crs]$ crsctl query cssvotedisk
0. 0 /dev/raw/raw3
1. 0 /dev/raw/raw4
2. 0 /dev/raw/raw5
located 3 votedisk(s).
VIPCA
出于种种原因我们可能需要为已安装的Oracle集群软件修改其使用的公用或私有网络所使用的网络接口(How to Change Interconnect/Public Interface IP or Subnet in OracleClusterware),这些共有或私有网络(public/private network)被保存在ocr中,我们需要以root用户的身份执行oifcfg命令来对这些网络接口信息进行修改:
/* 使用ocrdump命令转储ocr信息 */
[oracle@vrh1 ~]$ ocrdump ocr
[oracle@vrh1 ~]$ cat ocr
[SYSTEM.css.interfaces]UNDEF
[SYSTEM.css.interfaces.global]UNDEF
[SYSTEM.css.interfaces.global.eth0]UNDEF
[SYSTEM.css.interfaces.global.eth0.131|d32|d1|d0]UNDEF
[SYSTEM.css.interfaces.global.eth0.131|d32|d1|d0]ORATEXT: public
[SYSTEM.css.interfaces.global.eth1]UNDEF
[SYSTEM.css.interfaces.global.eth1.131|d33|d1|d0]UNDEF:
[SYSTEM.css.interfaces.global.eth1.131|d33|d1|d0]ORATEXT: cluster_interconnect
.............
/* 实际上css的misscount参数和votingdisk所在的位置也存在ocr文件中 */
[SYSTEM.css.misscount]UB4 (10) : 60
[SYSTEM.css.diskfile]ORATEXT :/dev/raw/raw2
1.首先我们可以通过oifcfg getif了解当前的public/interconnect网络配置情况:
[root@vrh1 ~]# who am i
root pts/1 2011-04-18 18:23(192.168.0.1)
[root@vrh1 ~]# cd $ORA_CRS_HOME/bin
[root@vrh1 bin]# oifcfg getif
eth0 131.32.1.0 global public
eth1 131.33.1.0 global cluster_interconnect
/* 可以看到这里分别用131.32.1/2网段配置了public和cluster_interconnect网络 */
2.确认在/etc/hosts文件中为新的网络接口IP做了必要的修改,之后我们要保证当前CRS已经启动(否则将出现PRIF-10: failed to initialize the cluster registry错误而无法配置),使用oifcfgsetif命令首先添加新的public公用网络接口:
[root@vrh1 bin]# oifcfg delif -global eth0
/* 首先删除旧有的公用网络接口信息 */
[root@vrh1 bin]# oifcfg setif -globaleth0/192.168.1.0:public
/* 注意这里制定192.168.1.0这个网段即可,不用输入完整的ip */
/* 因为以上操作是global全局操作,在单个节点完成即可 */
3.修改内联网络(cluster_interconnect)接口的方法也是类似的:
[root@vrh1 bin]# oifcfg delif -global eth1
[root@vrh1 bin]# oifcfg setif -globaleth1/192.168.0.0:cluster_interconnect
/* 与public network配置时类似指定网段即可 */
4.确认网络接口的修改情况,以及当前数据库使用的inter connecter状况:
[oracle@vrh1 ~]$ oifcfg getif
eth0 192.168.1.0 global public
eth1 192.168.0.0 global cluster_interconnect
SQL> select * from x$skgxpia;
ADDR INDX INST_ID PUB_SKGXPI PICKED_SKGXPIA
-------- ---------- ---------- ---------------------------------------------
NAME_SKGXPIA IP_SKGXPIA
--------------- ----------------
4572EC54 0 1 N OSD
eth1 131.33.1.107
/* 可以看到当前数据库实例仍使用旧有的interconnect网络 */
[root@vrh1 ~]# crsctl stop crs
[root@vrh1 ~]# crsctl start crs
[oracle@vrh1 ~]$ sqlplus / as sysdba
Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - Production
With the Partitioning, Real ApplicationClusters, OLAP, Data Mining
and Real Application Testing options
SQL>
SQL> select * from x$skgxpia;
ADDR INDX INST_ID PUB_SKGXPI PICKED_SKGXPIA
-------- ---------- ---------- ---------------------------------------------
NAME_SKGXPIA IP_SKGXPIA
--------------- ----------------
4572EC54 0 1 N OSD
eth1 192.168.0.107
/* 这里需要重启CRS后实例才能正确使用更新后的clusterinterconnect网络接口 */

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The function in Oracle to calculate the number of days between two dates is DATEDIFF(). The specific usage is as follows: Specify the time interval unit: interval (such as day, month, year) Specify two date values: date1 and date2DATEDIFF(interval, date1, date2) Return the difference in days

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

The Oracle database startup sequence is: 1. Check the preconditions; 2. Start the listener; 3. Start the database instance; 4. Wait for the database to open; 5. Connect to the database; 6. Verify the database status; 7. Enable the service (if necessary ); 8. Test the connection.

The INTERVAL data type in Oracle is used to represent time intervals. The syntax is INTERVAL <precision> <unit>. You can use addition, subtraction, multiplication and division operations to operate INTERVAL, which is suitable for scenarios such as storing time data and calculating date differences.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

To find the number of occurrences of a character in Oracle, perform the following steps: Get the total length of a string; Get the length of the substring in which a character occurs; Count the number of occurrences of a character by subtracting the substring length from the total length.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

Oracle uses the "||" symbol to concatenate strings. The usage method is as follows: connect the strings to be connected with the "||" symbol; the priority of string connection is low, and parentheses need to be used to ensure the priority; an empty string will still be an empty string after connection; NULL value connection is still NULL.
