在前面的12CR2 RAC安装最后,我发现自己的两个节点的实例名并不是预期的:
节点一:lenka1
节点二:lenka2

而是比较容易混淆的变成了:
节点一:lenka_2
节点二:lenka_1

这里,我决定改变这种状况。

——————————
首先,看看当前环境中的实例名的分布情况:

[grid@oracle12c1 ~]$ srvctl status database -d lenka
Instance lenka_1 is running on node oracle12c2
Instance lenka_2 is running on node oracle12c1
[grid@oracle12c1 ~]$ 

停掉RAC集群的数据库资源:

[grid@oracle12c1 ~]$ srvctl stop database -d lenka
[grid@oracle12c1 ~]$ 
[grid@oracle12c1 ~]$ srvctl status database -d lenka
Instance lenka_1 is not running on node oracle12c2
Instance lenka_2 is not running on node oracle12c1
[grid@oracle12c1 ~]$ 

注意,上面的这个操作会影响RAC集群的所有数据库节点。

接下来,在各个节点上操作:

节点一:
修改环境变量:

[oracle@oracle12c1 dbs]$ cat ~/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=oracle12c1
export ORACLE_UNQNAME=lenka
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12/db_1

#export ORACLE_SID=lenka1
export ORACLE_SID=lenka_1

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[oracle@oracle12c1 dbs]$ 

可以从上面ORACLE_SID的环境变量的注释中看到,我之前的SID的配置确实没有问题,但最后RAC装好了,却在实例名这里出了问题。
可能的原因:12C R2开始,实例名的格式变掉了?变成了:[DB_NAME]_[INS_NUM]?

然后,重新启动数据库实例:

[root@oracle12c1 ~]# su - oracle
Last login: Fri Mar 31 10:17:14 CST 2017 on pts/2
[oracle@oracle12c1 ~]$ cd $ORACLE_HOME/dbs
[oracle@oracle12c1 dbs]$ ls
hc_lenka_1.dat  hc_lenka_2.dat  init.ora
[oracle@oracle12c1 dbs]$
[oracle@oracle12c1 dbs]$ source ~/.bash_profile
[oracle@oracle12c1 dbs]$ env | grep SID
ORACLE_SID=lenka_1
[oracle@oracle12c1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 31 10:47:25 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> !ps -ef | grep pmon
grid      5018     1  0 Mar30 ?        00:00:03 mdb_pmon_-MGMTDB
oracle    8443  8364  0 10:47 pts/4    00:00:00 /bin/bash -c ps -ef | grep pmon
oracle    8445  8443  0 10:47 pts/4    00:00:00 grep pmon
grid     26574     1  0 Mar30 ?        00:00:03 asm_pmon_+ASM1

SQL> 
SQL> startup
ORACLE instance started.

Total System Global Area 5049942016 bytes
Fixed Size                  8803168 bytes
Variable Size            1107299488 bytes
Database Buffers         3925868544 bytes
Redo Buffers                7970816 bytes
Database mounted.
Database opened.
SQL> 
SQL> !ps -ef | grep pmon
grid      5018     1  0 Mar30 ?        00:00:03 mdb_pmon_-MGMTDB
oracle    8498     1  0 10:47 ?        00:00:00 ora_pmon_lenka_1
oracle    9036  8364  0 10:48 pts/4    00:00:00 /bin/bash -c ps -ef | grep pmon
oracle    9038  9036  0 10:48 pts/4    00:00:00 grep pmon
grid     26574     1  0 Mar30 ?        00:00:03 asm_pmon_+ASM1

SQL> 
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@oracle12c1 dbs]$ 

再次查看集群中的数据库实例状态:

[grid@oracle12c1 ~]$ srvctl status database -d lenka
Instance lenka_1 is running on node oracle12c1
Database lenka is not running on node oracle12c2
[grid@oracle12c1 ~]$ 

可以看到,确实按照如期的状态运行了。

节点二如上,做一样的操作。
节点二:

[root@oracle12c2 ~]# su - oracle
Last login: Fri Mar 31 10:18:10 CST 2017 on pts/0
[oracle@oracle12c2 ~]$ 
[oracle@oracle12c2 ~]$ cd $ORACLE_HOME/dbs
[oracle@oracle12c2 dbs]$ ls
hc_lenka_1.dat  init.ora
[oracle@oracle12c2 dbs]$ 
[oracle@oracle12c2 dbs]$ cat ~/.bash_profile | grep --color ORACLE_SID
#export ORACLE_SID=lenka2
export ORACLE_SID=lenka_2
[oracle@oracle12c2 dbs]$ 
[oracle@oracle12c2 dbs]$ source ~/.bash_profile
[oracle@oracle12c2 dbs]$ env | grep SID
ORACLE_SID=lenka_2
[oracle@oracle12c2 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 31 10:47:25 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> 
SQL> startup
ORACLE instance started.

Total System Global Area 5049942016 bytes
Fixed Size                  8803168 bytes
Variable Size            1107299488 bytes
Database Buffers         3925868544 bytes
Redo Buffers                7970816 bytes
Database mounted.
Database opened.
SQL> 
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@oracle12c2 dbs]$ 
[oracle@oracle12c2 dbs]$ ps -ef | grep pmon
oracle   13902     1  0 10:50 ?        00:00:00 ora_pmon_lenka_2
oracle   16641 12806  0 10:59 pts/1    00:00:00 grep --color=auto pmon
grid     31309     1  0 Mar30 ?        00:00:03 asm_pmon_+ASM2
[oracle@oracle12c2 dbs]$ 
[oracle@oracle12c2 dbs]$ 

然后,再查看集群中数据库实例的状态:

[grid@oracle12c1 ~]$ srvctl status database -d lenka
Instance lenka_1 is running on node oracle12c1
Instance lenka_2 is running on node oracle12c2
[grid@oracle12c1 ~]$ 

至此,所有的节点的实例,都按照如期的运行了。
——————————————
Done。

说点什么

avatar

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒