rac 环境下增加控制文件

 

检查数据库控制文件

SQL> show parameter contro

 

NAME                            TYPE     VALUE

------------------------------------ ----------- ------------------------------

control_file_record_keep_time          integer  7

control_files                   string   +DATA/MOMDB/CONTROLFILE/curren

                                          t.261.931355075

 

 

就一个控制文件,明显不安全

 

 

-- 关闭所有节点的  数据库

 

[oracle@momdb1 ~]$ srvctl stop database -db momdb

[oracle@momdb1 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 12.1.0.2.0 Production on Sat Dec 31 10:22:07 2016

 

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SQL> startup nomount;

ORA-15124: ASM file name '+DATA/MOMDB/CONTROLFILE/current.261.931355075 ' contains an invalid alias name

 

 

SQL> shutdown immediate;

ERROR:

ORA-01034: ORACLE not available

ORA-27101: shared memory realm does not exist

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3640

Additional information: 1347479667

Process ID: 0

Session ID: 0 Serial number: 0

 

 

SQL> startup pfile='/u01/app/oracle/product/11.2.0/db_home1/dbs/initmomdb1.ora' mount;

ORACLE instance started.

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

Database mounted.

SQL> show parameter control

 

NAME                            TYPE     VALUE

------------------------------------ ----------- ------------------------------

control_file_record_keep_time          integer  7

control_files                   string   +DATA/MOMDB/CONTROLFILE/curren

                                          t.261.931355075

control_management_pack_access         string   NONE

SQL> create spfile from pfile;

 

File created.

 

SQL> shutdown immediate;

ORA-01109: database not open

 

 

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

Database mounted.

 

注意,逗号里面不要有多余的空格,否则就会报后面的ORA-15124错误

SQL> alter system set control_files='+DATA/MOMDB/CONTROLFILE/current.261.931355075' , '+DATA'  scope=spfile;

 

System altered.

 

SQL> shutdown immediate;

ORA-01109: database not open

 

 

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORA-15124: ASM file name '+DATA/MOMDB/CONTROLFILE/current.261.931355075 ' contains an invalid alias name

SQL> shutdown immediate;

ERROR:

ORA-01034: ORACLE not available

ORA-27101: shared memory realm does not exist

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3640

Additional information: 1347479667

Process ID: 0

Session ID: 0 Serial number: 0

 

 

SQL> startup pfile='/u01/app/oracle/product/11.2.0/db_home1/dbs/initmomdb1.ora' mount;

ORACLE instance started.

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

Database mounted.

SQL> create spfile from pfile;

 

File created.

 

SQL> startup force;

ORACLE instance started.

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

Database mounted.

Database opened.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

 

 

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

Database mounted.

SQL> alter system set control_files='+DATA/MOMDB/CONTROLFILE/current.261.931355075' , '+DATA'  scope=spfile

  2  /

 

System altered.

 

SQL> shutdown immediate;

ORA-01109: database not open

 

 

Database dismounted.

ORACLE instance shut down.

 

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

 

 

SQL> exit

Disconnected from Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production

With the Real Application Clusters option

[oracle@momdb1 ~]$ rman target/

 

Recovery Manager: Release 12.1.0.2.0 - Production on Sat Dec 31 10:32:00 2016

 

Copyright (c) 1982, 2015, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: MOMDB (not mounted)

 

RMAN> list backup of controlfile;

 

using target database control file instead of recovery catalog

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of list command at 12/31/2016 10:32:13

ORA-01507: database not mounted

 

RMAN> list copy;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of list command at 12/31/2016 10:32:30

ORA-01507: database not mounted

 

RMAN> restore controlfile from autobackup;

 

Starting restore at 31-DEC-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=245 instance=momdb1 device type=DISK

 

recovery area destination: +DATA

database name (or database unique name) used for search: MOMDB

channel ORA_DISK_1: AUTOBACKUP +DATA/MOMDB/AUTOBACKUP/2016_12_30/s_931972621.279.931972625 found in the recovery area

AUTOBACKUP search with format "%F" not attempted because DBID was not set

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 12/31/2016 10:32:44

RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

 

可见在非mount模式下,不能做以上的任何操作

 

 

指定路径 恢复控制文件

 

 

RMAN> restore controlfile from '+DATA/MOMDB/AUTOBACKUP/2016_12_30/s_931972621.279.931972625'

2> ;

 

Starting restore at 31-DEC-16

using channel ORA_DISK_1

 

channel ORA_DISK_1: copied control file copy

output file name=+DATA/MOMDB/CONTROLFILE/current.261.931355075

output file name=+DATA/MOMDB/CONTROLFILE/current.300.932034797

Finished restore at 31-DEC-16

 

RMAN> alter database mount;

 

Statement processed

released channel: ORA_DISK_1

 

 

RMAN> alter database open;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of sql statement command at 12/31/2016 10:34:00

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

 

RMAN> alter database open noresetlogs;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of sql statement command at 12/31/2016 10:34:14

ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

 

RMAN> recover database;

 

Starting recover at 31-DEC-16

Starting implicit crosscheck backup at 31-DEC-16

allocated channel: ORA_DISK_1

Crosschecked 2 objects

Finished implicit crosscheck backup at 31-DEC-16

 

Starting implicit crosscheck copy at 31-DEC-16

using channel ORA_DISK_1

Finished implicit crosscheck copy at 31-DEC-16

 

searching for all files in the recovery area

cataloging files...

cataloging done

 

List of Cataloged Files

=======================

File Name: +DATA/MOMDB/AUTOBACKUP/2016_12_30/s_931972621.279.931972625

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_15.289.932018413

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_34.290.932032011

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_35.291.932032013

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_16.293.932033067

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_17.294.932033069

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_18.295.932033071

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_36.296.932033073

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_37.297.932033151

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_38.298.932033153

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_19.299.932034009

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_12.280.931973405

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_29.262.931975291

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_30.282.931975633

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_31.283.931975633

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_13.287.931977577

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_32.285.931977901

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_33.284.931977903

File Name: +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_14.288.931989651

 

using channel ORA_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 29 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_29.262.931975291

archived log for thread 1 with sequence 30 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_30.282.931975633

archived log for thread 1 with sequence 31 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_31.283.931975633

archived log for thread 1 with sequence 32 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_32.285.931977901

archived log for thread 1 with sequence 33 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_33.284.931977903

archived log for thread 1 with sequence 34 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_34.290.932032011

archived log for thread 1 with sequence 35 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_35.291.932032013

archived log for thread 1 with sequence 36 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_36.296.932033073

archived log for thread 1 with sequence 37 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_37.297.932033151

archived log for thread 1 with sequence 38 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_38.298.932033153

archived log for thread 1 with sequence 39 is already on disk as file +DATA/MOMDB/ONLINELOG/group_1.263.931355077

archived log for thread 2 with sequence 12 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_12.280.931973405

archived log for thread 2 with sequence 13 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_13.287.931977577

archived log for thread 2 with sequence 14 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_14.288.931989651

archived log for thread 2 with sequence 15 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_15.289.932018413

archived log for thread 2 with sequence 16 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_16.293.932033067

archived log for thread 2 with sequence 17 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_17.294.932033069

archived log for thread 2 with sequence 18 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_18.295.932033071

archived log for thread 2 with sequence 19 is already on disk as file +DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_19.299.932034009

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_29.262.931975291 thread=1 sequence=29

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_12.280.931973405 thread=2 sequence=12

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_30.282.931975633 thread=1 sequence=30

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_31.283.931975633 thread=1 sequence=31

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_13.287.931977577 thread=2 sequence=13

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_32.285.931977901 thread=1 sequence=32

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_1_seq_33.284.931977903 thread=1 sequence=33

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_30/thread_2_seq_14.288.931989651 thread=2 sequence=14

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_34.290.932032011 thread=1 sequence=34

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_15.289.932018413 thread=2 sequence=15

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_16.293.932033067 thread=2 sequence=16

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_35.291.932032013 thread=1 sequence=35

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_17.294.932033069 thread=2 sequence=17

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_36.296.932033073 thread=1 sequence=36

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_18.295.932033071 thread=2 sequence=18

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_37.297.932033151 thread=1 sequence=37

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_1_seq_38.298.932033153 thread=1 sequence=38

archived log file name=+DATA/MOMDB/ARCHIVELOG/2016_12_31/thread_2_seq_19.299.932034009 thread=2 sequence=19

archived log file name=+DATA/MOMDB/ONLINELOG/group_1.263.931355077 thread=1 sequence=39

Finished recover at 31-DEC-16

 

RMAN> alter database open;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of sql statement command at 12/31/2016 10:34:54

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

 

RMAN> alter database open resetlogs;

 

Statement processed

 

RMAN> exit

 

 

Recovery Manager complete.

 

 

以上节点1 已经打开

 

打开节点2,查看配置文件

 

 

 

[oracle@momdb2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 12.1.0.2.0 Production on Sat Dec 31 10:36:44 2016

 

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SQL> startup;

ORACLE instance started.

 

Total System Global Area 9193914368 bytes

Fixed Size               3719928 bytes

Variable Size        4932504840 bytes

Database Buffers     4227858432 bytes

Redo Buffers            29831168 bytes

Database mounted.

Database opened.

SQL> show parameter con

 

NAME                            TYPE     VALUE

------------------------------------ ----------- ------------------------------

cluster_interconnects                  string

connection_brokers              string   ((TYPE=DEDICATED)(BROKERS=1)),

                                           ((TYPE=EMON)(BROKERS=1))

control_file_record_keep_time          integer  7

control_files                   string   +DATA/MOMDB/CONTROLFILE/curren

                                          t.261.931355075, +DATA/MOMDB/C

                                          ONTROLFILE/current.300.9320347

                                          97

control_management_pack_access         string   NONE

db_file_name_convert            string

dg_broker_config_file1                 string   /u01/app/oracle/product/11.2.0

 

 

 

 

NAME                            TYPE     VALUE

------------------------------------ ----------- ------------------------------

                                          /db_home1/dbs/dr1momdb.dat

dg_broker_config_file2                 string   /u01/app/oracle/product/11.2.0

                                          /db_home1/dbs/dr2momdb.dat

dst_upgrade_insert_conv          boolean  TRUE

global_context_pool_size        string

log_archive_config              string

log_file_name_convert                  string

nls_nchar_conv_excp             string   FALSE

pdb_file_name_convert                  string

SQL>

 

 

这样控制文件的修改就完成了

 

 

在生产文件上如果备份控制文件的话,应该先关闭数据库,然后启动到mount模式下,备份当前的控制文件

 

最后再增加控制文件

 

这样就避免数据回退了

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值