重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1836|回复: 0
打印 上一主题 下一主题

[Oracle] ORACLE RAC添加控制文件

[复制链接]
跳转到指定楼层
楼主
发表于 2019-4-12 14:36:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1.   Os版本及数据库版本
[oracle@db1 ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3(Maipo)
[oracle@db1 ~]$ uname -a
Linux db1 3.10.0-514.el7.x86_64 #1 SMP WedOct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
   CON_ID
----------
Oracle Database 12c Enterprise EditionRelease 12.1.0.2.0 - 64bit Production
        0

PL/SQL Release 12.1.0.2.0 - Production
        0

CORE   12.1.0.2.0      Production
        0
2.   查看控制文件位置
SQL> select name from  v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA/orcl/controlfile/current.260.1000030467

3.   修改参数文件
SQL>alter system setcontrol_files='+DATA/orcl/controlfile02','+DATA/orcl/controlfile/current.260.1000030467
  2 'scope=spfile;
System altered.
4.关闭数据库(2个节点)
SQL> shutdown immediate;
Database closed.
Database dismounted.

ORACLE instance shut down.

SQL> shutdown immediate;
Database closed.
Database dismounted.

ORACLE instance shut down.

验证
[oracle@db1 ~]$  srvctl status database -d orcl
实例 orcl1 没有在 db1 节点上运行
实例 orcl2 没有在 db2 节点上运行
5.恢复控制文件
[oracle@db1 ~]$ rman target /
Recovery Manager: Release 12.1.0.2.0 -Production on Tue Apr 9 13:23:34 2019
Copyright (c) 1982, 2014, Oracle and/or itsaffiliates.  All rights reserved.
connected to target database (not started)

RMAN> startup nomount;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGESTACK FOLLOWS ===============
RMAN-00571:===========================================================
RMAN-03002: failure of startup command at04/09/2019 13:24:35
RMAN-04014: startup failed: ORA-15124: ASMfile name '+DATA/orcl/controlfile/current.260.1000030467
' contains an invalid alias name

解决办法:
spfile二进制文件转存为pfile文本文件
SQL>create pfile='/home/oracle/init.ora'from spfile='+DATA/ORCL/spfileorcl.ora';
File created.
  
[oracle@db1 ~]$ ll
  
总用量 4
  
drwxr-xr-x 7 oracle oinstall  136 2  12 10:12 database
  
-rw-r--r-- 1 oracle asmadmin 1420 4   9 13:28 init.ora
  
[oracle@db1 ~]$ more init.ora
  
orcl1.__db_cache_size=1879048192
  
orcl2.__db_cache_size=1879048192
  
orcl1.__java_pool_size=16777216
  
orcl2.__java_pool_size=16777216
  
orcl1.__large_pool_size=33554432
  
orcl2.__large_pool_size=33554432
  
orcl1.__oracle_base='/u01/app/oracle'#ORACLE_BASE  set from environment
  
orcl2.__oracle_base='/u01/app/oracle'#ORACLE_BASE  set from environment
  
orcl1.__pga_aggregate_target=838860800
  
orcl2.__pga_aggregate_target=838860800
  
orcl1.__sga_target=2516582400
  
orcl2.__sga_target=2516582400
  
orcl1.__shared_io_pool_size=0
  
orcl2.__shared_io_pool_size=0
  
orcl1.__shared_pool_size=570425344
  
orcl2.__shared_pool_size=570425344
  
orcl1.__streams_pool_size=0
  
orcl2.__streams_pool_size=0
  
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
  
*.audit_trail='DB'
  
*.cluster_database=true
  
*.compatible='11.2.0.4.0'
  
*.control_files='+DATA/orcl/controlfile02','+DATA/orcl/controlfile/current.260.1000030467
  
'
  
*.db_block_size=8192
  
*.db_create_file_dest='+DATA'
  
*.db_domain=''
  
*.db_name='orcl'
  
*.diagnostic_dest='/u01/app/oracle'
  
*.dispatchers='(PROTOCOL=TCP)  (SERVICE=orclXDB)'
  
*.event=''
  
orcl1.instance_number=1
  
orcl2.instance_number=2
  
*.log_archive_dest_1='location=/u01/app/oracle/archive'
  
*.open_cursors=300
  
*.pga_aggregate_target=835715072
  
*.processes=300
  
*.remote_listener='db-scan:1521'
  
*.remote_login_passwordfile='EXCLUSIVE'
  
*.sga_target=2516582400
  
orcl1.thread=1
  
orcl2.thread=2
  
orcl1.undo_tablespace='UNDOTBS1'
  
orcl2.undo_tablespace='UNDOTBS2'
  
  
  
[oracle@db1 ~]$ vi init.ora
  
*.control_files='+DATA/orcl/controlfile02','+DATA/orcl/controlfile/current.260.1000030467
  
orcl1.__db_cache_size=1879048192
  
orcl2.__db_cache_size=1879048192
  
orcl1.__java_pool_size=16777216
  
orcl2.__java_pool_size=16777216
  
orcl1.__large_pool_size=33554432
  
orcl2.__large_pool_size=33554432
  
orcl1.__oracle_base='/u01/app/oracle'#ORACLE_BASE  set from environment
  
orcl2.__oracle_base='/u01/app/oracle'#ORACLE_BASE  set from environment
  
orcl1.__pga_aggregate_target=838860800
  
orcl2.__pga_aggregate_target=838860800
  
orcl1.__sga_target=2516582400
  
orcl2.__sga_target=2516582400
  
orcl1.__shared_io_pool_size=0
  
orcl2.__shared_io_pool_size=0
  
orcl1.__shared_pool_size=570425344
  
orcl2.__shared_pool_size=570425344
  
orcl1.__streams_pool_size=0
  
orcl2.__streams_pool_size=0
  
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
  
*.audit_trail='DB'
  
*.cluster_database=true
  
*.compatible='11.2.0.4.0'
  
*.control_files='+DATA/orcl/controlfile02','+DATA/orcl/controlfile/current.260.1000030467'
  
*.db_block_size=8192
  
*.db_create_file_dest='+DATA'
  
*.db_domain=''
  
*.db_name='orcl'
  
*.diagnostic_dest='/u01/app/oracle'
  
*.dispatchers='(PROTOCOL=TCP)  (SERVICE=orclXDB)'
  
*.event=''
  
orcl1.instance_number=1
  
orcl2.instance_number=2
  
*.log_archive_dest_1='location=/u01/app/oracle/archive'
  
*.open_cursors=300
  
*.pga_aggregate_target=835715072
  
*.processes=300
  
*.remote_listener='db-scan:1521'
  
*.remote_login_passwordfile='EXCLUSIVE'
  
*.sga_target=2516582400
  
orcl1.thread=1
  
orcl2.thread=2
  
orcl1.undo_tablespace='UNDOTBS1'
  
orcl2.undo_tablespace='UNDOTBS2'
  
~
  
"init.ora" 43L, 1419C 已写入                                                                           
  

[oracle@db1 ~]$ rman target /
Recovery Manager: Release 12.1.0.2.0 -Production on Tue Apr 9 13:31:37 2019
Copyright (c) 1982, 2014, Oracle and/or itsaffiliates.  All rights reserved.
connected to target database (not started)

RMAN> startup pfile='/home/oracle/init.ora' nomount;
Oracle instance started
Total System Global Area    2516582400 bytes

Fixed Size                     2927528 bytes
Variable Size                738198616 bytes
Database Buffers            1761607680 bytes
Redo Buffers                  13848576 bytes

RMAN> restore controlfile from'+DATA/orcl/controlfile/current.260.1000030467';
Starting restore at 09-APR-19
using target database control file insteadof recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=7 instance=orcl1device type=DISK

channel ORA_DISK_1: copied control filecopy
output file name=+DATA/orcl/controlfile02
output filename=+DATA/orcl/controlfile/current.260.1000030467
Finished restore at 09-APR-19

6.创建spfile
SQL> startup  pfile='/home/oracle/init.ora' mount;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size                  2927528 bytes
Variable Size             738198616 bytes
Database Buffers         1761607680 bytes
Redo Buffers               13848576 bytes
Database mounted.

SQL> create spfile='+DATA/ORCL/spfileorcl.ora'from pfile='/home/oracle/init.ora';
File created.

7.使用spfile启动数据库
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

[oracle@db1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production onTue Apr 9 13:44:36 2019
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 2516582400 bytes
Fixed Size                  2927528 bytes
Variable Size             738198616 bytes
Database Buffers         1761607680 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.

[grid@db1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State       Server                   Statedetails      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE      db1                      STABLE
               ONLINE  ONLINE      db2                      STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE      db1                      STABLE
               ONLINE  ONLINE      db2                      STABLE
ora.asm
               ONLINE  ONLINE      db1                     Started,STABLE
               ONLINE  ONLINE      db2                     Started,STABLE
ora.net1.network
               ONLINE  ONLINE      db1                      STABLE
               ONLINE  ONLINE      db2                      STABLE
ora.ons
               ONLINE  ONLINE      db1                      STABLE
               ONLINE  ONLINE      db2                      STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
     1        ONLINE  ONLINE      db1                      STABLE
ora.MGMTLSNR
     1        ONLINE  ONLINE      db1                      169.254.102.11110.1
                                                            0.10.150,STABLE
ora.cvu
     1        ONLINE  ONLINE      db1                      STABLE
ora.db1.vip
     1        ONLINE  ONLINE      db1                      STABLE
ora.db2.vip
     1        ONLINE  ONLINE      db2                      STABLE
ora.mgmtdb
     1        ONLINE  ONLINE      db1                      Open,STABLE
ora.oc4j
     1        ONLINE  ONLINE      db1                      STABLE
ora.orcl.db
     1        ONLINE  ONLINE      db1                      Open,STABLE
     2        ONLINE  ONLINE      db2                      Open,STABLE
ora.scan1.vip
     1        ONLINE  ONLINE      db1                      STABLE
--------------------------------------------------------------------------------
[grid@db1 ~]$
验证v$ controlfile
SQL> select name from  v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA/orcl/controlfile02
+DATA/orcl/controlfile/current.260.1000030467
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-27 08:48 , Processed in 0.115567 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表