1 原来rac环境上创建service:
srvctl add service -d lteidba -s lteidbasr -r lteidba1 -a lteidba2 -P BASIC -y automatic -e SELECT -m BASIC -z 5 -w 180
启动:
srvctl start service -d lteidba -s lteidbasr
停止:
srvctl stop service -d lteidba -s lteidbasr
删除:
srvctl remove service -d lteidba -s osslteidb2 -i osslteidb2
确认状态:
srvctl status service -d lteidba
srvctl config database -d lteidba
[oracle@osslteidb1 ~]$ srvctl config database -d lteidba
Database unique name: lteidba
Database name: lteidba
Oracle home: /oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +SYSDG/lteidba/spfilelteidba.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: lteidba
Database instances:
Disk Groups: SYSDG,FASTFLASHDG,DATADG
Mount point paths:
Services: lteidbasr
Type: RACOneNode
Online relocation timeout: 30
Instance name prefix: lteidba1
Candidate servers: osslteidb1,osslteidb2
Database is administrator managed
2 删除原有rac实例:
a dbca删除步骤省略;
b 手工删除:
srvctl stop database - d lteidba
srvctl remove instance - d lteidba -i lteidba1
srvctl remove instance - d lteidba -i lteidba2
srvctl add instance -d lteidba -i lteidba1 - n osslteidb1
c 原来建的删除后新建:
srvctl add service -d lteidba -s lteidbasr -r lteidba1 -a lteidba2 -P BASIC -y automatic -e SELECT -m BASIC -z 5 -w 180
3 CONVERT RAC TO RAC ONE NODE:
srvctl convert database -d lteidba -c RACONENODE -i lteidba1
成功后状态确认:
[oracle@osslteidb1 ~]$ srvctl config database -d lteidba
Database unique name: lteidba
Database name: lteidba
Oracle home: /oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +SYSDG/lteidba/spfilelteidba.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: lteidba
Database instances:
Disk Groups: SYSDG,FASTFLASHDG,DATADG
Mount point paths:
Services: lteidbasr
Type: RACOneNode------------------------------------这里就是one node模式
Online relocation timeout: 30
Instance name prefix: lteidba1
Candidate servers: osslteidb1,osslteidb2
Database is administrator managed
4 手工切换:
[oracle@osslteidb2 ~]$ srvctl relocate database -d lteidba -n osslteidb2
此时节点2上有实例了:
[oracle@osslteidb2 ~]$ ps -ef |grep ora_
oracle 10418 1 0 12:23 ? 00:00:00 ora_pmon_lteidba1_2
oracle 10420 1 0 12:23 ? 00:00:00 ora_psp0_lteidba1_2
oracle 10422 1 6 12:23 ? 00:00:04 ora_vktm_lteidba1_2
oracle 10426 1 0 12:23 ? 00:00:00 ora_gen0_lteidba1_2
oracle 10428 1 0 12:23 ? 00:00:00 ora_diag_lteidba1_2
oracle 10430 1 0 12:23 ? 00:00:00 ora_dbrm_lteidba1_2
oracle 10432 1 0 12:23 ? 00:00:00 ora_ping_lteidba1_2
oracle 10434 1 0 12:23 ? 00:00:00 ora_acms_lteidba1_2
oracle 10436 1 3 12:23 ? 00:00:02 ora_dia0_lteidba1_2
oracle 10438 1 2 12:23 ? 00:00:01 ora_lmon_lteidba1_2
oracle 10440 1 3 12:23 ? 00:00:02 ora_lmd0_lteidba1_2
oracle 10442 1 11 12:23 ? 00:00:08 ora_lms0_lteidba1_2
oracle 10446 1 9 12:23 ? 00:00:06 ora_lms1_lteidba1_2
oracle 10450 1 11 12:23 ? 00:00:08 ora_lms2_lteidba1_2
……
节点1没有实例:
[oracle@osslteidb1 ~]$ ps -ef |grep ora_
oracle 13313 11700 0 12:15 pts/4 00:00:00 grep ora_
[oracle@osslteidb1 ~]$
[grid@osslteidb1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRS.dg
ONLINE ONLINE osslteidb1
ora.DATADG.dg
ONLINE ONLINE osslteidb1
ora.FASTFLASHDG.dg
ONLINE ONLINE osslteidb1
ora.LISTENER.lsnr
ONLINE ONLINE osslteidb1
ora.SYSDG.dg
ONLINE ONLINE osslteidb1
ora.asm
ONLINE ONLINE osslteidb1 Started
ora.gsd
OFFLINE OFFLINE osslteidb1
ora.net1.network
ONLINE ONLINE osslteidb1
ora.ons
ONLINE ONLINE osslteidb1
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE osslteidb1
ora.cvu
1 ONLINE ONLINE osslteidb1
ora.lteidba.db
2 ONLINE ONLINE osslteidb1 Open
ora.lteidba.lteidbasr.svc
1 ONLINE ONLINE osslteidb1
ora.oc4j
1 ONLINE ONLINE osslteidb1
ora.osslteidb1.vip
1 ONLINE ONLINE osslteidb1
ora.osslteidb2.vip
1 ONLINE INTERMEDIATE osslteidb1 FAILED OVER
ora.scan1.vip
1 ONLINE ONLINE osslteidb1
5 修改环境变量:
[oracle@osslteidb1 ~]$ cat .bash_profile
# .bash_profile
export ORACLE_BASE=/oracle/product
export ORACLE_SID=lteidba1_1
参考文档:
Oracle RACOne Node -- Changes in 11.2.0.2 (文档 ID 1232802.1)
Applies to:
Oracle Server - Enterprise Edition - Version 11.2.0.2 to 11.2.0.2 [Release 11.2]
Information in this document applies to any platform.
Goal
This is a reference document for the Installation and Administration of Oracle RAC One Node 11.2.0.2.
Fix
Oracle Real Application Clusters One Node (Oracle RAC One Node) is a single instance of an Oracle Real Application Clusters (Oracle RAC) database that runs on one node in a cluster. This option adds to the flexibility that Oracle offers for database consolidation. There are significant changes in the way an Oracle RAC One Node database is administered in version 11.2.0.2 compared to 11.2.0.1.
Major Changes include:
?Oracle Universal Installer (OUI) has a new option to select an Oracle RAC One Node Installation.
?The DBCA is now capable of creating and configuring an Oracle RAC One Node database.
?SRVCTL is capable of configuring and administering an Oracle RAC One database.
(In 11.2.0.1 the administration was performed using command line tools and scripts.)
?Oracle Data Guard and the Oracle Data Guard Broker are Oracle RAC One Node aware.
Creating a new Oracle RAC One Node database in 11.2.0.2 involves the following steps:
?Install and configure 11.2.0.2 Oracle Grid Infrastructure on all the servers that you want to host the Oracle RAC One Database, either under normal operations or after a failover or relocation.
?Install the Oracle RDBMS software by selecting Oracle RAC One Node for the respective nodes.
?Create an Oracle RAC One Node database using the DBCA.
Administration of an Oracle RAC One Node Database
1). Verifying an existing Oracle RAC One Node Database
command: srvctl config database -d
Eg:
[oracle@harac1 bin]$ srvctl config database -d racone
Database unique name: racone
Database name:
Oracle home: /home/oracle/product/11gR2/11.2.0.2_RACOne
Oracle user: oracle
Spfile: +DG2/RacOne/spfileRacOne.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racone
Database instances:
Disk Groups: DG2,DG1
Mount point paths:
Services:
Type: RACOneNode <<<<
Online relocation timeout: 30
Instance name prefix: racone
Candidate servers: harac1,harac2,lfmsx3
Database is administrator managed
command: srvctl status database -d
Eg:
[oracle@harac1 bin]$ srvctl status database -d racone
Instance racone_1 is running on node harac1
Online relocation: INACTIVE
2). Performing an online migration
Command: srvctl relocate database -d
-d
-n
-w
-a Abort failed online relocation
-r Remove target node of failed online relocation request from the candidate server list of administrator-managed RAC One Node database
-v Verbose output
-h Print usage
Eg:
[oracle@harac2 dbs]$ srvctl relocate database -d racone -n harac1 -w 15 -v
Configuration updated to two instances
Instance racone_1 started
Waiting for 15 minutes for instance racone_2 to stop.....
Instance racone_2 stopped
Configuration updated to one instance
The default timeout for an online relocation is 30 minutes. This is the time for the sessions to finish their open transactions and migrate to the new instance. If a session does not finish the transaction in fly in this amount of time, the transaction will be cancelled and the session will be removed from the instance as part of the "shutdown abort" operation that is issued after the timeout has expired. If a different timeout is preferred, then one can use the -w option to specify a timeout up to 720 minutes.
Status during the relocation:
[oracle@harac2 bin]$ srvctl status database -d racone
Instance racone_1 is running on node harac1
Online relocation: ACTIVE
Source instance: racone_2 on harac2
Destination instance: racone_1 on harac1
Once the migration is completed, we should see the sessions moved to the remote instance.
Eg:
[oracle@harac2 orarootagent]$ srvctl status database -d racone
Instance racone_1 is running on node harac1
Online relocation: INACTIVE
3) Converting an Oracle RAC One Node Database to Oracle RAC or vice versa
Converting between an Oracle RAC One Node and Oracle RAC database can be achieved using the "srvctl convert database" command. For example:
To convert a database from Oracle RAC One Node to Oracle RAC:
srvctl convert database -d
srvctl convert database -d racone -c RAC -n harac1
Add more instances on other nodes as required:
[oracle@harac2 bin]$ srvctl add instance -d racone -i racone_1 -n harac1
[oracle@harac2 bin]$ srvctl add instance -d racone -i racone_3 -n lfmsx3
[oracle@harac2 bin]$ srvctl config database -d racone
Database unique name: racone
Database name:
Oracle home: /home/oracle/product/11gR2/11.2.0.2_RACOne
Oracle user: oracle
Spfile: +DG2/RacOne/spfileRacOne.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racone
Database instances: racone_1,racone_2,racone_3
Disk Groups: DG2,DG1
Mount point paths:
Services:
Type: RAC
Database is administrator managed
After starting the database on all the 3 nodes:
[oracle@harac2 bin]$ srvctl status database -d racone
Instance racone_1 is running on node harac1
Instance racone_2 is running on node harac2
Instance racone_3 is running on node lfmsx3
To convert a database from Oracle RAC to Oracle RAC One Node:
srvctl convert database -d
Eg: srvctl convert database -d racone -c RACONENODE -w 30 -i racone
[oracle@harac2 bin]$ srvctl config database -d racone
Database unique name: racone
Database name:
Oracle home: /home/oracle/product/11gR2/11.2.0.2_RACOne
Oracle user: oracle
Spfile: +DG2/RacOne/spfileRacOne.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racone
Database instances:
Disk Groups: DG2,DG1
Mount point paths:
Services: racone_taf
Type: RACOneNode
Online relocation timeout: 30
Instance name prefix: racone
Candidate servers: harac1,harac2,lfmsx3
Database is administrator managed
After starting the database:
[oracle@harac2 bin]$ srvctl status database -d racone
Instance racone_1 is running on node harac1
Online relocation: INACTIVE
Notes:
1)
Please ensure that at least one service is configured, before running the convert command, otherwise the following error will appear:
[oracle@harac2 oswtop]$ srvctl convert database -d racone -c RACONENODE -w 30 -i racone
PRCD-1242 : Unable to convert RAC database racone to RAC One Node database because the database had no service added.
2)
During the RAC to RACOne conversion, please ensure that the addition instances are removed using DBCA before we run the "srvctl convert database" command.
$ srvctl convert database -d racone -c RACONENODE -w 30 -i racone
PRCD-1214 : Administrator-managed RAC database racone has more than one instance
4) Upgrading an Oracle RAC One Node database from 11.2.0.1 to 11.2.0.2
In order to upgrade an existing 11.2.0.1 Oracle RAC One Node to 11.2.0.2 perform the following steps:
?Upgrade Oracle Grid Infrastructure to 11.2.0.2 (Only out of place upgrade is possible).
?Upgrade Oracle RAC RDBMS software to 11.2.0.2 (an out of place upgrade is recommended).
?The DBUA is not aware of Oracle RAC One in 11.2.0.2, and set the database type to RAC after the upgrade. This is addressed in internal bug 9950713 - to be fixed in 11.2.0.3.
?Development suggests the following workaround.
(a) Run the racone2rac.sh before the upgrade to convert the RACOne node to 1 node RAC.
(b) Run the the DBUA to complete the upgrade.
(c) After the upgrade, run "srvctl convert database" listed above to covert the database to RAC One.
For more details, please refer to Oracle Real Application Clusters Administration and Deployment Guide 11g Release 2 (11.2) http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/onenode.htm#RACAD7894