Oracle添加冗余控制文件

来源:互联网 发布:易经精髓 知乎 编辑:程序博客网 时间:2024/05/29 08:01
实验环境:
[root@db ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
[root@db ~]# su - grid
[grid@db ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       db                                           
ora.LISTENER.lsnr
               ONLINE  ONLINE       db                                           
ora.asm
               ONLINE  ONLINE       db                       Started             
ora.ons
               OFFLINE OFFLINE      db                                           
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       db                                           
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       db                                           
ora.orcl.db
      1        ONLINE  ONLINE       db                       Open                


SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> 


1、检查当前控制文件名称及路径
SQL> show parameter control 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DATA/orcl/controlfile/current
                                                 .262.938021411
control_management_pack_access       string      DIAGNOSTIC+TUNING


2、检查pfile路径
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/orcl/spfileorcl.ora


3、备份pfile及控制文件
SQL> create pfile='/home/oracle/pfile1114.ora' from spfile;
File created.

SQL> alter session set tracefile_identifier='bak_control';
Session altered.

SQL> alter database backup controlfile to trace;
Database altered.

4、在参数文件中添加新的控制文件路径及名称
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA/orcl/controlfile/current.262.938021411

SQL> alter system set control_files='+DATA/orcl/controlfile/current.262.938021411','+DATA' scope=spfile;
System altered.

5、重启数据库至nomount状态
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area  939495424 bytes
Fixed Size                  2258840 bytes
Variable Size             595593320 bytes
Database Buffers          335544320 bytes
Redo Buffers                6098944 bytes
SQL> show parameter control_files
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/orcl/controlfile/current
                                                 .262.938021411, +DATA
6、恢复控制文件
[oracle@db ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Nov 14 11:08:41 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (not mounted)
RMAN> restore controlfile from '+DATA/orcl/controlfile/current.262.938021411';
Starting restore at 14-NOV-2017 11:08:42
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATA/orcl/controlfile/current.262.938021411
output file name=+DATA/orcl/controlfile/current.268.960030523
Finished restore at 14-NOV-2017 11:08:44

7、启动数据库至OPEN
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1

RMAN> alter database open;
database opened

RMAN> exit

Recovery Manager complete.


[oracle@db ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 14 11:09:18 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> show parameter control_files;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      +DATA/orcl/controlfile/current
                                                 .262.938021411, +DATA/orcl/con
                                                 trolfile/current.268.960030523
原创粉丝点击