Search This Blog

Total Pageviews

Sunday, 12 May 2024

How to Migrate Control File From File System to ASM ?

 
 select * from v$controlfile;

STATUS
-------
NAME
--------------------------------------------------------------------------------
IS_ BLOCK_SIZE FILE_SIZE_BLKS     CON_ID
--- ---------- -------------- ----------

/u01/app/control01-1205.ctl
NO       16384           1142          0


 
shutdown immediate;
startup nomount;

restore controlfile to '+DATADISK' from '/u01/app/control01-1205.ctl';


RMAN> restore controlfile to '+DATADISK' from '/u01/app/control01-1205.ctl';

Starting restore at 12-MAY-2024 16:04:35
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=237 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 12-MAY-2024 16:04:36

RMAN>

from Grid find control file 

find the control file !!!

ASMCMD> find -t controlfile . *

ASMCMD [+] > find --type controlfile . *
+DATADISK/ORADB/CONTROLFILE/current.272.1168790677

ASMCMD [+] > ls -s +DATADISK/ORADB/CONTROLFILE/current.272.1168790677
Block_Size  Blocks     Bytes     Space  Name
     16384    1143  18726912  33554432  current.272.1168790677
	 
ASMCMD [+] > ls -l +DATADISK/ORADB/CONTROLFILE/current.272.1168790677
Type         Redund  Striped  Time             Sys  Name
CONTROLFILE  UNPROT  FINE     MAY 12 16:00:00  Y    current.272.1168790677
ASMCMD [+] >



[oracle@srv1 dbs]$ srvctl start database -d oradb -o nomount

[oracle@srv1 dbs]$ sqlplus / as sysdba


create spfile 

SQL> create spfile='+DATADISK/spfileoradb.ora' from pfile='initoradb.ora';

File created.

ASMCMD [+] > ls -lt +DATADISK/spfileoradb.ora

Type           Redund  Striped  Time             Sys  Name
PARAMETERFILE  UNPROT  COARSE   MAY 12 16:00:00  N    spfileoradb.ora => +DATADISK/ORADB/PARAMETERFILE/spfile.273.1168791713
ASMCMD [+] >



srvctl modify database -d oradb -spfile +DATADISK/ORADB/PARAMETERFILE/spfile.273.1168791713

srvctl start database -d oradb -o nomount

alter the spfile for control file 

[oracle@srv1 dbs]$

alter system set control_files='+DATADISK/ORADB/CONTROLFILE/current.272.1168790677' scope=spfile;





srvctl stop database -d oradb 

srvctl start database -d oradb

[oracle@srv1 dbs]$ !sql
sqlplus / as sysdba


SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATADISK/ORADB/PARAMETERFILE/
                                                 spfile.273.1168791713

												 
SQL> show parameter control;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DATADISK/ORADB/CONTROLFILE/cu
                                                 rrent.272.1168790677
control_management_pack_access       string      DIAGNOSTIC+TUNING
SQL>





[oracle@srv1 dbs]$ srvctl config database -d oradb
Database unique name: oradb
Database name: oradb
Oracle home: /u01/app/oracle/product/19.0.0/db_1
Oracle user: oracle
Spfile: +DATADISK/ORADB/PARAMETERFILE/spfile.273.1168791713
Password file:
Domain: localdomain
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATADISK
Services:
OSDBA group: oinstall
OSOPER group:
Database instance: oradb




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


[oracle@ora26 dbs]$ sqlplus / as sysdba SQL*Plus: Release 23.26.3.0.0 - Production on Fri Aug 14 13:34:11 2026 Version 23.26.3.0.0 Copyright (c) 1982, 2026, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount ; ORACLE instance started. Total System Global Area 1792274208 bytes Fixed Size 5033760 bytes Variable Size 503316480 bytes Database Buffers 1275068416 bytes Redo Buffers 8855552 bytes SQL> Disconnected from Oracle AI Database 26ai Enterprise Edition Release 23.26.3.0.0 - Production Version 23.26.3.0.0 [oracle@ora26 dbs]$ rman target / Recovery Manager: Release 23.26.3.0.0 - Production on Fri Aug 14 13:34:33 2026 Version 23.26.3.0.0 Copyright (c) 1982, 2026, Oracle and/or its affiliates. All rights reserved. connected to target database: CDB26 (not mounted) RMAN> restore controlfile to '+DATA' from '/u01/app/oracle/ora26/CDB26/control01.ctl' ; restore controlfile to '+DATA' from '/u01/app/oracle/ora26/CDB26/control01.ctl' ; Starting restore at 14-AUG-26 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=382 device type=DISK channel ORA_DISK_1: copied control file copy Finished restore at 14-AUG-26 RMAN> [grid@ora26 ~]$ asmcmd -p ASMCMD [+] > find --type CONTROLFILE +data * +data/CDB26/CONTROLFILE/current.275.1241271299 ASMCMD [+] > ls -s +data/CDB26/CONTROLFILE/current.275.1241271299 Block_Size Blocks Bytes Space Name 16384 1151 18857984 33554432 current.275.1241271299 ASMCMD [+] > ls -l +data/CDB26/CONTROLFILE/current.275.1241271299 Type Redund Striped Time Sys Name CONTROLFILE UNPROT FINE AUG 14 13:00:00 Y current.275.1241271299 ASMCMD [+] > ls -ls +data/CDB26/CONTROLFILE/current.275.1241271299 Type Redund Striped Time Sys Block_Size Blocks Bytes Space Name CONTROLFILE UNPROT FINE AUG 14 13:00:00 Y 16384 1151 18857984 33554432 current.275.1241271299 ASMCMD [+] > alter system set control_files='+data/CDB26/CONTROLFILE/current.275.1241271299' scope=spfile; SQL> startup ; ORACLE instance started. Total System Global Area 1792274208 bytes Fixed Size 5033760 bytes Variable Size 503316480 bytes Database Buffers 1275068416 bytes Redo Buffers 8855552 bytes Database mounted. Database opened. SQL> show parameter control; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time integer 7 control_files string +DATA/CDB26/CONTROLFILE/curren t.275.1241271299 control_management_pack_access string DIAGNOSTIC+TUNING diagnostics_control string IGNORE SQL>

No comments:

Oracle DBA

anuj blog Archive