12.2 数据库控制文件复制到ASM磁盘组

描述

当前数据库t12csia1 参数文件与控制文件皆在文件系统上。 

本文档目的是将数据库参数文件与数据库控制文件都放入asm中去。 

ASM实例有两个磁盘组DATA  和 RECOED02, 将文件系统上的控制文件分别放入这两个磁盘组中。 

操作环境

OEL7.2 x8664 + oracle grid 12.2 + oracle database 12.2 

 

数据库启动的临时参数文件 : /home/oracle/dbpfile.ora

数据库当前控制文件位置 : /home/oracle/Current.277.941623135

 

过程设计

将控制文件移入ASM磁盘组中

使用rman复制控制文件

编辑临时数据库参数文件以使用新的控制文件,重启数据库

 

编辑数据库默认启动参数文件 initSID.ora

创建spfile

创建spfile asm别名

重启数据库

 

详细步骤操作

开启三个terminal窗口:

窗口1 T12CSIA1数据库sqlplus 操作(oracle用户)

窗口2 +ASM数据库sqlplus操作(grid用户)

窗口3 操作系统oracle用户

4.1 将控制文件移入ASM磁盘组中

启动数据库到nomount状态

SQL> startup nomount pfile='/home/oracle/dbpfile.ora';

ORACLE instance started.

 

Total System Global Area 3070230528 bytes

Fixed Size     8625416 bytes

Variable Size   754975480 bytes

Database Buffers  2298478592 bytes

Redo Buffers     8151040 bytes

SQL> 

SQL> show parameter control_files;

 

NAME      TYPE

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

VALUE

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

control_files      string

/home/oracle/Current.277.94162

3135

SQL>

使用rman复制控制文件

[oracle@localhost 12.2.0.1.0:(T12CSIA1) ~ ] $ rman target / 

 

Recovery Manager: Release 12.2.0.1.0 - Production on Sun Apr 23 14:41:00 2017

 

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

 

connected to target database: T12CSIA1 (not mounted)

 

RMAN> restore controlfile to '+RECOED02' from '/home/oracle/Current.277.941623135';

 

Starting restore at 23-APR-2017 14:41:16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=18 device type=DISK

 

channel ORA_DISK_1: copied control file copy

Finished restore at 23-APR-2017 14:41:18

 

RMAN> 

RMAN> restore controlfile to '+DATA' from '/home/oracle/Current.277.941623135';       

 

Starting restore at 23-APR-2017 14:39:02

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=256 device type=DISK

 

channel ORA_DISK_1: copied control file copy

Finished restore at 23-APR-2017 14:39:09

 

RMAN>

 

查看asm中的控制文件

[grid@localhost 12.2.0.1.0:(+ASM) ~ ] $ asmcmd

ASMCMD> ls

DATA/

RECOED02/

ASMCMD>

ASMCMD> ls -l +DATA/T12CSIA1/CONTROLFILE

Type         Redund  Striped  Time             Sys  Name

CONTROLFILE  UNPROT  FINE     APR 23 14:00:00  Y    current.283.942071945

ASMCMD> ls -l +RECOED02/T12CSIA1/CONTROLFILE

Type         Redund  Striped  Time             Sys  Name

CONTROLFILE  UNPROT  FINE     APR 23 14:00:00  Y    current.256.942072077

ASMCMD> exit

编辑临时数据库参数文件以使用新的控制文件,重启数据库

[oracle@localhost 12.2.0.1.0:(T12CSIA1) ~ ] $ cat dbpfile.ora |grep control

*.control_files='+DATA/T12CSIA1/CONTROLFILE/current.283.942071945','+RECOED02/T12CSIA1/CONTROLFILE/current.256.942072077'

[oracle@localhost 12.2.0.1.0:(T12CSIA1) ~ ] $ sqlplus  / as sysdba

 

SQL*Plus: Release 12.2.0.1.0 Production on Sun Apr 23 14:49:25 2017

 

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

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

SQL> startup mount pfile='/home/oracle/dbpfile.ora' force;

ORACLE instance started.

 

Total System Global Area 3070230528 bytes

Fixed Size     8625416 bytes

Variable Size   754975480 bytes

Database Buffers  2298478592 bytes

Redo Buffers     8151040 bytes

Database mounted.

SQL> alter database open;

 

Database altered.

 

SQL> show parameter control

 

NAME      TYPE  VALUE

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

control_file_record_keep_time      integer  7

control_files      string  +DATA/T12CSIA1/CONTROLFILE/cur

 rent.283.942071945, +RECOED02/

 T12CSIA1/CONTROLFILE/current.2

 56.942072077

control_management_pack_access      string  DIAGNOSTIC+TUNING

SQL> 

 

4.2 将参数文件移入ASM磁盘组中

编辑数据库默认启动参数文件 initSID.ora

[oracle@localhost 12.2.0.1.0:(T12CSIA1) dbs ] $ cat initT12CSIA1.ora 

spfile='+DATA/t12csia1/parameterfile/spfilet12csia1.ora'

[oracle@localhost 12.2.0.1.0:(T12CSIA1) dbs ] $ 

创建spfile

[oracle@localhost 12.2.0.1.0:(T12CSIA1) dbs ] $ sqlplus  / as sysdba

 

SQL*Plus: Release 12.2.0.1.0 Production on Sun Apr 23 14:55:26 2017

 

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

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

SQL> create spfile='+DATA' from pfile='/home/oracle/dbpfile.ora';

 

File created.

 

SQL>

在asm实例中创建参数文件中指定的spfile 别名

ASMCMD> ls -l +DATA/T12CSIA1/PARAMETERFILE/

Type           Redund  Striped  Time             Sys  Name

PARAMETERFILE  UNPROT  COARSE   APR 23 14:00:00  Y    spfile.282.942072949

ASMCMD> cd +DATA/T12CSIA1//PARAMETERFILE/

ASMCMD> mkalias ./spfile.282.942072949 spfileT12CSIA1.ora

ASMCMD> ls -l ./

Type           Redund  Striped  Time             Sys  Name

PARAMETERFILE  UNPROT  COARSE   APR 23 14:00:00  Y    spfile.282.942072949

PARAMETERFILE  UNPROT  COARSE   APR 23 14:00:00  N    spfileT12CSIA1.ora => +DATA/T12CSIA1/PARAMETERFILE/spfile.282.942072949

ASMCMD>

以默认位置参数文件重启数据库

[oracle@localhost 12.2.0.1.0:(T12CSIA1) dbs ] $ sqlplus  / as sysdba

 

SQL*Plus: Release 12.2.0.1.0 Production on Sun Apr 23 14:55:26 2017

 

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

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

SQL> create spfile='+DATA' from pfile='/home/oracle/dbpfile.ora';

 

File created.

 

SQL> 

SQL> 

SQL> startup force

ORACLE instance started.

 

Total System Global Area 3070230528 bytes

Fixed Size     8625416 bytes

Variable Size   754975480 bytes

Database Buffers  2298478592 bytes

Redo Buffers     8151040 bytes

Database mounted.

Database opened.

SQL> 

 

 

个人总结

用的命令是rman restore controlfile和 asm的 mkalias . 

资料参考引用

https://blogs.oracle.com/Database4CN/entry/%E5%A6%82%E4%BD%95%E5%9C%A8asm%E7%A3%81%E7%9B%98%E7%BB%84%E4%B8%AD%E5%A4%8D%E5%88%B6%E6%96%B0%E7%9A%84%E6%8E%A7%E5%88%B6%E6%96%87%E4%BB%B6

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11780477/viewspace-2137820/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/11780477/viewspace-2137820/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值