Oracle 11gr2 rac nid change db_name and dbid practice
2016/12/23 19:24:091.主机版本信息:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
# arch
x86_64
# uname -a
Linux node1 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
#
#
#
#
2.drop dbconsole
未配置略
3.原有数据库dbid db_name:
# su - orardbms
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:24:35 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> select open_mode,inst_id,dbid,name from gv$database;
OPEN_MODE INST_ID DBID NAME
-------------------- ---------- ---------- ---------
READ WRITE 1986006396 ORCC
READ WRITE 2986006396 ORCC
SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
原有环境集群信息:
$ crs_stat -t
-bash: crs_stat: command not found
$ exit
logout
# su - oragrid
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcc.db ora....se.type ONLINE ONLINE node1
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
$ exit
logout
cluster 参数信息:
# su - orardbms
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:26:14 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
SQL>
SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
$
4.备份数据库(略)
5.修改cluster_database参数:
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:34:04 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> show parameter cluster;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=SPFILE;
System altered.
SQL> EXIT
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
6.关闭数据库:
$ srvctl stop database -d orcc -o immediate;
# su - oragrid
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcc.db ora....se.type OFFLINE OFFLINE
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
7.仅启动数据库实例1至mount状态:
$ srvctl start instance -d orcc -i orcc1 -o mount;
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcc.db ora....se.type ONLINE ONLINE node1
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
$ exit
logout
8.修改前备份参数文件,用于调整后修改:
# su - orardbms
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:37:50 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> create pfile='/tmp/a.ora' from spfile;
File created.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
$
$
$
$
$
9.主机node1上mount状态下修改dbname:
$ nid TARGET=sys/oracle@orcc DBNAME=ORCL
DBNEWID: Release 11.2.0.4.0 - Production on Sat Dec 24 03:39:11 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
Connected to database ORCC (DBID=986006396)
Connected to server version 11.2.0
Control Files in database:
+DATA/orcc/controlfile/current.256.917398463
+ARCH/orcc/controlfile/current.256.917398465
Change database ID and database name ORCC to ORCL? (Y/) => Y
Proceeding with operation
Changing database ID from 986006396 to 1459221727
Changing database name from ORCC to ORCL
Control File +DATA/orcc/controlfile/current.256.917398463 - modified
Control File +ARCH/orcc/controlfile/current.256.917398465 - modified
Datafile +DATA/orcc/datafile/system.259.91739846 - dbid changed, wrote new name
Datafile +DATA/orcc/datafile/sysaux.260.91739847 - dbid changed, wrote new name
Datafile +DATA/orcc/datafile/undotbs1.261.91739848 - dbid changed, wrote new name
Datafile +DATA/orcc/datafile/undotbs2.263.91739848 - dbid changed, wrote new name
Datafile +DATA/orcc/datafile/users.264.91739849 - dbid changed, wrote new name
Datafile +DATA/orcc/tempfile/temp.262.91739848 - dbid changed, wrote new name
Control File +DATA/orcc/controlfile/current.256.917398463 - dbid changed, wrote new name
Control File +ARCH/orcc/controlfile/current.256.917398465 - dbid changed, wrote new name
Instance shut down
Database name changed to ORCL.
Modify parameter file and generate a new password file before restarting.
Database ID for database ORCL changed to 1459221727.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
$
$
$
$
10.修改参数文件
修改前参数文件:
$ cat /tmp/a.ora
orcc2.__db_cache_size=1828716544
orcc1.__db_cache_size=1828716544
orcc2.__java_pool_size=16777216
orcc1.__java_pool_size=16777216
orcc2.__large_pool_size=33554432
orcc1.__large_pool_size=100663296
orcc2.__pga_aggregate_target=838860800
orcc1.__pga_aggregate_target=838860800
orcc2.__sga_target=2483027968
orcc1.__sga_target=2483027968
orcc2.__shared_io_pool_size=0
orcc1.__shared_io_pool_size=0
orcc2.__shared_pool_size=570425344
orcc1.__shared_pool_size=503316480
orcc2.__streams_pool_size=0
orcc1.__streams_pool_size=0
*.audit_file_dest='/oracle/oracle_base/admin/orcc/adump'
*.audit_trail='db'
*.cluster_database=FALSE
*.compatible='11.2.0.4.0'
*.control_files='+DATA/orcc/controlfile/current.256.917398463','+ARCH/orcc/controlfile/current.256.917398465'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='orcc'
*.db_recovery_file_dest='+ARCH'
*.db_recovery_file_dest_size=6005194752
*.diagnostic_dest='/oracle/oracle_base'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orccXDB)'
orcc1.instance_number=1
orcc2.instance_number=2
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=823132160
*.processes=150
*.remote_listener='node-scan:1521'
*.remote_login_passwordfile='exclusive'
*.sga_target=2470445056
orcc2.thread=2
orcc1.thread=1
orcc2.undo_tablespace='UNDOTBS2'
orcc1.undo_tablespace='UNDOTBS1'
调整后参数文件:
$ vi /tmp/a.ora
$ cat /tmp/a.ora
orcl2.__db_cache_size=1828716544
orcl1.__db_cache_size=1828716544
orcl2.__java_pool_size=16777216
orcl1.__java_pool_size=16777216
orcl2.__large_pool_size=33554432
orcl1.__large_pool_size=100663296
orcl2.__pga_aggregate_target=838860800
orcl1.__pga_aggregate_target=838860800
orcl2.__sga_target=2483027968
orcl1.__sga_target=2483027968
orcl2.__shared_io_pool_size=0
orcl1.__shared_io_pool_size=0
orcl2.__shared_pool_size=570425344
orcl1.__shared_pool_size=503316480
orcl2.__streams_pool_size=0
orcl1.__streams_pool_size=0
*.audit_file_dest='/oracle/oracle_base/admin/orcc/adump'
*.audit_trail='db'
*.cluster_database=FALSE
*.compatible='11.2.0.4.0'
*.control_files='+DATA/orcc/controlfile/current.256.917398463','+ARCH/orcc/controlfile/current.256.917398465'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='+ARCH'
*.db_recovery_file_dest_size=6005194752
*.diagnostic_dest='/oracle/oracle_base'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
orcl1.instance_number=1
orcl2.instance_number=2
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=823132160
*.processes=150
*.remote_listener='node-scan:1521'
*.remote_login_passwordfile='exclusive'
*.sga_target=2470445056
orcl2.thread=2
orcl1.thread=1
orcl2.undo_tablespace='UNDOTBS2'
orcl1.undo_tablespace='UNDOTBS1'
$
$
$
$
$
$
11.nid命令执行成功后数据库数据库已经关闭:
Database name changed to ORCL.
Modify parameter file and generate a new password file before restarting.
Database ID for database ORCL changed to 1459221727.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
12.编辑后的静态参数文件创建spfile,此时数据库处于关闭状态:
export ORACLE_SID=orcl1
su - orardbms
sqlplus /nolog
SQL> create spfile='+DATA/orcc/spfileorcl.ora' from pfile='/tmp/a.ora';
File created.
13.启动数据库并open resetlogs 模式打开:
SQL> startup
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2255752 bytes
Variable Size 620758136 bytes
Database Buffers 1828716544 bytes
Redo Buffers 20201472 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
SQL> alter database open resetlogs;
Database altered.
SQL> select name,dbid,open_mode from v$database;
NAME DBID OPEN_MODE
--------- ---------- --------------------
ORCL 1459221727 READ WRITE
14.调整参数cluster_database=TRUE,并重启数据库
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string
SQL> alter system set cluster_database=TRUE scope=spfile;
System altered.
SQL> startup force;
ORA-29760: instance_number parameter not specified
此报错是应为为调整ORACLE_SID全局变量
下面声明全局变量后启动再次报另外一个错误
SQL> exit
Disconnected
$ echo $ORACLE_SID
orcc1
$ export ORACLE_SID=orcl1
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:51:24 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/oracle_home/dbs/initorcl1.ora'
此报错原因 node1 $ORACLE_HOME/dbs/initorcc1.ora 替换为initorcl1.ora
node2 $ORACLE_HOME/dbs/initorcc2.ora 替换为initorcl2.ora
且文件中的链接调整为SPFILE='+DATA/orcc/spfileorcl.ora',调整步骤如下:
SQL> exit
Disconnected
$ cd $ORACLE_HOME/dbs
$ ls
hc_orcc1.datinit.orainitorcc1.oraorapworcc1
$ more initorcc1.ora
SPFILE='+DATA/orcc/spfileorcc.ora'
$ mv initorcc1.ora initorcl1.ora
$ vi initorcl1.ora
$ cat initorcl1.ora
SPFILE='+DATA/orcc/spfileorcl.ora'
$
$
$ ssh node2
$ cd $ORACLE_HOME/dbs
$ mv initorcc2.ora initorcl2.ora
$ vi initorcl2.ora
$ cat initorcl2.ora
SPFILE='+DATA/orcc/spfileorcl.ora'
$
$
$ exit
logout
Connection to node2 closed.
14.上面报错处理后调整cluster_database=TRUE,重启数据库
$
$ echo $ORACLE_SID
orcl1
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:55:24 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2255752 bytes
Variable Size 620758136 bytes
Database Buffers 1828716544 bytes
Redo Buffers 20201472 bytes
Database mounted.
Database opened.
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string
SQL> alter system set cluster_database=TRUE scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2255752 bytes
Variable Size 620758136 bytes
Database Buffers 1828716544 bytes
Redo Buffers 20201472 bytes
Database mounted.
Database opened.
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
SQL> select dbid,open_mode,name from gv$database;
DBID OPEN_MODE NAME
---------- -------------------- ---------
1459221727 READ WRITE ORCL
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
$ ssh node2
Last login: Sat Dec 24 03:54:33 2016 from node1
登录node2,启动数据库实例orcl2
$ echo $ORACLE_SID
orcc2
$ export ORACLE_SID=orcl2
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 03:58:31 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2255752 bytes
Variable Size 687867000 bytes
Database Buffers 1761607680 bytes
Redo Buffers 20201472 bytes
Database mounted.
Database opened.
SQL> select dbid,open_mode,name from gv$database;
DBID OPEN_MODE NAME
---------- -------------------- ---------
1459221727 READ WRITE ORCL
1459221727 READ WRITE ORCL
SQL> select inst_id,dbid,open_mode from gv$database;
INST_ID DBID OPEN_MODE
---------- ---------- --------------------
2 1459221727 READ WRITE
1 1459221727 READ WRITE
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
$ exit
logout
Connection to node2 closed.
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 04:00:02 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> select inst_id,dbid,open_mode from gv$database;
INST_ID DBID OPEN_MODE
---------- ---------- --------------------
1 1459221727 READ WRITE
2 1459221727 READ WRITE
SQL> exit
15.下面步骤为调整密码文件,listener.ora,tnsnames.ora,remove database ,add database ,add instance 步骤
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
$ exit
logout
# su - oragrid
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcc.db ora....se.type OFFLINE OFFLINE
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
$
$
$
$ cd $ORACLE_HOME/dbs
$ ls -l
总用量 16
-rw-rw---- 1 oragrid oinstall 1053 12月 24 03:05 ab_+ASM1.dat
-rw-rw---- 1 oragrid oinstall 1544 12月 24 03:05 hc_+ASM1.dat
-rw-r--r-- 1 oragrid oinstall 2851 5月15 2009 init.ora
-rw-r----- 1 oragrid oinstall 1536 7月17 00:17 orapw+ASM
$ exit
logout
# su - orardbms
$ cd $ORACLE_HOME/dbs
$ ls -l
总用量 20
-rw-rw---- 1 orardbms asmadmin 1544 12月 24 03:47 hc_orcc1.dat
-rw-rw---- 1 orardbms asmadmin 1544 12月 24 03:58 hc_orcl1.dat
-rw-r--r-- 1 orardbms oinstall 2851 5月15 2009 init.ora
-rw-r----- 1 orardbms oinstall 35 12月 24 03:54 initorcl1.ora
-rw-r----- 1 orardbms oinstall 1536 7月17 00:54 orapworcc1
$ mv orapworcc1 orapworcl1
$ ssh node2
Last login: Sat Dec 24 03:58:01 2016 from node1
$ cd $ORACLE_HOME/dbs
$ mv orapworcc2 orapworcl2
$
$
$ cd
$ vi .bash_profile
$ 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/bin
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=node2
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/oracle/oracle_base
export ORACLE_HOME=/oracle/oracle_home
export ORACLE_SID=orcl2
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
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
# Set the default file mode creation mask
# (umask) to 022 to ensure that the user performing
# the Oracle software installation creates files
# with 644 permissions.
# ---------------------------------------------------
umask 022
$ source .bash_profile
$ cd $ORACLE_HOME/network/admin
$ ls
samplesshrept.lsttnsnames.ora
$ vi tnsnames.ora
$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/oracle_home/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
$ su - oragrid
密码:
$ cd $ORACLE_HOME/network/admin
$ ls
endpoints_listener.oralistener.oralistener.ora.bak.node2samplesshrept.lstsqlnet.ora
$ vi listener.ora
$ cat listener.ora
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
$
$
$ exit
logout
$ exit
logout
Connection to node2 closed.
$ cd $ORACLE_HOME/network/admin
$ ls
samplesshrept.lsttnsnames.ora
$ vi tnsnames.ora
$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/oracle_home/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
$ vi .bash_profile
$ cd
$ vi .bash_profile
$ source .bash_profile
$ 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/bin
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=node1
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/oracle/oracle_base
export ORACLE_HOME=/oracle/oracle_home
export ORACLE_SID=orcl1
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
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
# Set the default file mode creation mask
# (umask) to 022 to ensure that the user performing
# the Oracle software installation creates files
# with 644 permissions.
# ---------------------------------------------------
umask 022
$
$
$
$
$ exit
logout
# su - oragrid
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcc.db ora....se.type OFFLINE OFFLINE
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
$ exit
logout
# su - orardbms
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 24 04:06:34 2016
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> show parameter db_domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string
SQL>
SQL>
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
$ exit
logout
# su - oragrid
$ exit
logout
# su - orardbms
$ echo $ORACLE_HOME
/oracle/oracle_home
# su - orardbms
$ srvctl add database -d orcl -o $ORACLE_HOME
$ srvctl add instance -d orcl -i orcl1 -n node1
$ srvctl add instance -d orcl -i orcl2 -n node2
$ srvctl remove database -d orcc
是否删除数据库 orcc? (y/) y
$ exit
logout
# su - oragrid
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcl.db ora....se.type OFFLINE OFFLINE
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
数据库在集群中的状态为及时更新,重启更新一下
$ srvctl stop database -d orcl -o immediate;
PRCC-1016 : orcl 已停止
$ srvctl start database -d orcl -o open
$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.ARCH.dg ora....up.type ONLINE ONLINE node1
ora.DATA.dg ora....up.type ONLINE ONLINE node1
ora....ER.lsnr ora....er.type ONLINE ONLINE node1
ora....N1.lsnr ora....er.type ONLINE ONLINE node2
ora.OCRVOTE.dg ora....up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE node1
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsdapplication OFFLINE OFFLINE
ora.node1.onsapplication ONLINE ONLINE node1
ora.node1.vipora....t1.type ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsdapplication OFFLINE OFFLINE
ora.node2.onsapplication ONLINE ONLINE node2
ora.node2.vipora....t1.type ONLINE ONLINE node2
ora.oc4j ora.oc4j.typeONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.orcl.db ora....se.type ONLINE ONLINE node1
ora....ry.acfs ora....fs.type ONLINE ONLINE node1
ora.scan1.vipora....ip.type ONLINE ONLINE node2
$
$
$
$
$
$
# su - orardbms
$ tnsping orcl
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 24-DEC-2016 04:11:57
Copyright (c) 1997, 2013, Oracle.All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = node-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)
2016/12/23 20:12:10
Metalink -----How to Change the DBID, DBNAME Using NID Utility (Doc ID 863800.1),小测一下仅供参考
页:
[1]