首页 > 数据库 > Oracle > 12.2 数据库控制文件复制到ASM磁盘组
将控制文件移入ASM磁盘组中
使用rman复制控制文件
编辑临时数据库参数文件以使用新的控制文件,重启数据库
编辑数据库默认启动参数文件 initSID.ora
创建spfile
创建spfile asm别名
重启数据库
开启三个terminal窗口:
窗口1 T12CSIA1数据库sqlplus 操作(oracle用户)
窗口2 +ASM数据库sqlplus操作(grid用户)
窗口3 操作系统oracle用户
启动数据库到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>
编辑数据库默认启动参数文件 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>
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博客 ” ,链接:https://blog.itpub.net/11780477/viewspace-2137820/ ,如需转载,请注明出处,否则将追究法律责任。