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 DBA

anuj blog Archive