Oracle Rac to Rac One Node
阅读原文时间:2023年07月10日阅读:1

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2020.01.14 20:05:12 =~=~=~=~=~=~=~=~=~=~=~=

[oracle@rac01 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac01
Instance racdb2 is running on node rac02
[oracle@rac01 ~]$ srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /oracle/home
Oracle user: oracle
Spfile: +DGDATA/racdb/spfileracdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb1,racdb2
Disk Groups: DGDATA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[oracle@rac01 ~]$ srvctl config service -d racdb
[oracle@rac01 ~]$ srvctl stop database -d racdb
[oracle@rac01 ~]$ srvctl status database -d racdb
Instance racdb1 is not running on node rac01
Instance racdb2 is not running on node rac02
[oracle@rac01 ~]$ srvctl remove instance -d racdb -i racdb2
Remove instance from the database racdb? (y/[n]) y
[oracle@rac01 ~]$ srvctl add service -d racdb -s rac -r racdb1 -P BASIC -e SELECT -m BASIC -y AUTOMATIC
[oracle@rac01 ~]$ srvctl config service -d racdb
Service name: rac
Service is enabled
Server pool: racdb_rac
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: racdb1
Available instances:
[oracle@rac01 ~]$ srvctl start service -d racdb -s rac
[oracle@rac01 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac01
[oracle@rac01 ~]$ srvctl convert database -d racdb -c RACONENODE -i racdb1
[oracle@rac01 ~]$ srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /oracle/home
Oracle user: oracle
Spfile: +DGDATA/racdb/spfileracdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances:
Disk Groups: DGDATA
Mount point paths:
Services: rac
Type: RACOneNode
Online relocation timeout: 30
Instance name prefix: racdb1
Candidate servers: rac01
Database is administrator managed
[oracle@rac01 ~]$ srvctl config service -d racdb
Service name: rac
Service is enabled
Server pool: racdb
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: racdb1_1
Available instances:
[oracle@rac01 ~]$ ps -ef|grep smon
root 2512 1 1 Jan12 ? 00:33:13 /grid/home/bin/osysmond.bin
grid 2960 1 0 Jan12 ? 00:00:04 asm_smon_+ASM1
oracle 29723 1 0 17:19 ? 00:00:00 ora_smon_racdb1
oracle 30301 28630 0 17:21 pts/0 00:00:00 grep smon
[oracle@rac01 ~]$ srvctl stop database -d racdb
[oracle@rac01 ~]$ srvctl start database -d racdb
[oracle@rac01 ~]$ ps -ef|grep smon
root 2512 1 1 Jan12 ? 00:33:14 /grid/home/bin/osysmond.bin
grid 2960 1 0 Jan12 ? 00:00:04 asm_smon_+ASM1
oracle 30591 1 0 17:21 ? 00:00:00 ora_smon_racdb1_1
oracle 30724 28630 0 17:22 pts/0 00:00:00 grep smon
[oracle@rac01 ~]$ srvctl relocate database -d racdb -n rac02
[oracle@rac01 ~]$ crsctl stat res -t
-bash: crsctl: command not found
[oracle@rac01 ~]$ su - grid
Password:
[grid@rac01 ~]$ crs_stat -t

Name Type Target State Host

ora.DGDATA.dg ora….up.type ONLINE ONLINE rac01
ora….ER.lsnr ora….er.type ONLINE ONLINE rac01
ora….N1.lsnr ora….er.type ONLINE ONLINE rac02
ora.OGOCR.dg ora….up.type ONLINE ONLINE rac01
ora.asm ora.asm.type ONLINE ONLINE rac01
ora.cvu ora.cvu.type ONLINE ONLINE rac02
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora….network ora….rk.type ONLINE ONLINE rac01
ora.oc4j ora.oc4j.type ONLINE ONLINE rac02
ora.ons ora.ons.type ONLINE ONLINE rac01
ora….SM1.asm application ONLINE ONLINE rac01
ora….01.lsnr application ONLINE ONLINE rac01
ora.rac01.gsd application OFFLINE OFFLINE
ora.rac01.ons application ONLINE ONLINE rac01
ora.rac01.vip ora….t1.type ONLINE ONLINE rac01
ora….SM2.asm application ONLINE ONLINE rac02
ora….02.lsnr application ONLINE ONLINE rac02
ora.rac02.gsd application OFFLINE OFFLINE
ora.rac02.ons application ONLINE ONLINE rac02
ora.rac02.vip ora….t1.type ONLINE ONLINE rac02
ora.racdb.db ora….se.type ONLINE ONLINE rac02
ora….rac.svc ora….ce.type ONLINE ONLINE rac02
ora….ry.acfs ora….fs.type ONLINE ONLINE rac01
ora.scan1.vip ora….ip.type ONLINE ONLINE rac02
[grid@rac01 ~]$ srvctl relocate database -d racdb -n rac01
PRCD-1222 : Online relocation of database "racdb" failed but database was restored to its original state
PRCR-1037 : Failed to update cardinality of the resource ora.racdb.db to 2
PRCR-1071 : Failed to register or update resource ora.racdb.db
CRS-0245: User doesn't have enough privilege to perform the operation
[grid@rac01 ~]$ exit
logout
[oracle@rac01 ~]$ srvctl relocate database -d racdb -n rac01
[oracle@rac01 ~]$ su - grid
Password:
[grid@rac01 ~]$ crs_stat -t

Name Type Target State Host

ora.DGDATA.dg ora….up.type ONLINE ONLINE rac01
ora….ER.lsnr ora….er.type ONLINE ONLINE rac01
ora….N1.lsnr ora….er.type ONLINE ONLINE rac02
ora.OGOCR.dg ora….up.type ONLINE ONLINE rac01
ora.asm ora.asm.type ONLINE ONLINE rac01
ora.cvu ora.cvu.type ONLINE ONLINE rac02
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora….network ora….rk.type ONLINE ONLINE rac01
ora.oc4j ora.oc4j.type ONLINE ONLINE rac02
ora.ons ora.ons.type ONLINE ONLINE rac01
ora….SM1.asm application ONLINE ONLINE rac01
ora….01.lsnr application ONLINE ONLINE rac01
ora.rac01.gsd application OFFLINE OFFLINE
ora.rac01.ons application ONLINE ONLINE rac01
ora.rac01.vip ora….t1.type ONLINE ONLINE rac01
ora….SM2.asm application ONLINE ONLINE rac02
ora….02.lsnr application ONLINE ONLINE rac02
ora.rac02.gsd application OFFLINE OFFLINE
ora.rac02.ons application ONLINE ONLINE rac02
ora.rac02.vip ora….t1.type ONLINE ONLINE rac02
ora.racdb.db ora….se.type ONLINE ONLINE rac01
ora….rac.svc ora….ce.type ONLINE ONLINE rac01
ora….ry.acfs ora….fs.type ONLINE ONLINE rac01
ora.scan1.vip ora….ip.type ONLINE ONLINE rac02
[grid@rac01 ~]$ exit
logout
[oracle@rac01 ~]$ exit
logout

1.删除实例的时候,要保留一个实例,如果两个都删除,新建的实例会因为没有spfile起不来

2.转换后实例在一节点上会变成racdb1_1,在二节点上会变成racdb1_2,并会在spfile中自动加入