Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

Search This Blog

Friday, September 4, 2015

Duplicate controlfile to different location

Duplicate controlfile to different location

SHAIKDB>show parameter control_files

NAME                    TYPE    VALUE
------------------------------------ ----------- ------------------------------
control_files                string   

/u01/app/oracle/SHAIKDB/control01.ctl,/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl


SHAIKDB> SELECT NAME FROM V$CONTROLFILE;

NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/SHAIKDB/control01.ctl
/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl

SHAIKDB>create pfile from spfile;

File created.

SHAIKDB>shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SHAIKDB>!cp /u01/app/oracle/SHAIKDB/control01.ctl /u01/app/oracle/SHAIKDB/control03.ctl

SHAIKDB>!vi $ORACLE_HOME/dbs/initSHAIKDB.ora

Add the new controlfile to the parameter file:
from
*.control_files='/u01/app/oracle/SHAIKDB/control01.ctl','/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl'
to:
*.control_files='/u01/app/oracle/SHAIKDB/control01.ctl','/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl'
*.control_files='/u01/app/oracle/SHAIKDB/control03.ctl'


SHAIKDB>startup pfile='$ORACLE_HOME/dbs/initSHAIKDB.ora';
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size            2214936 bytes
Variable Size         482345960 bytes
Database Buffers      33554432 bytes
Redo Buffers            3821568 bytes
Database mounted.
Database opened.
SHAIKDB>show parameter control_files

NAME                    TYPE    VALUE
------------------------------------ ----------- ------------------------------
control_files                string    /u01/app/oracle/SHAIKDB/contro
                        l01.ctl, /u01/app/oracle/flash
                        _recovery_area/SHAIKDB/control
                        02.ctl, /u01/app/oracle/SHAIKD
                        B/control03.ctl
SHAIKDB>create spfile from pfile;

File created.

SHAIKDB>shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SHAIKDB>startup
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size            2214936 bytes
Variable Size         482345960 bytes
Database Buffers      33554432 bytes
Redo Buffers            3821568 bytes
Database mounted.
Database opened.
SHAIKDB>



SHAIKDB> SELECT NAME FROM V$CONTROLFILE;

NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/SHAIKDB/control01.ctl
/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl
/u01/app/oracle/SHAIKDB/control03.ctl



Using RMAN:


SHAIKDB>shut immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SHAIKDB>!vi $ORACLE_HOME/dbs/initSHAIKDB.ora

From:
*.control_files='/u01/app/oracle/SHAIKDB/control01.ctl','/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl'
*.control_files='/u01/app/oracle/SHAIKDB/control03.ctl'

to:
*.control_files='/u01/app/oracle/SHAIKDB/control01.ctl','/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl'
*.control_files='/u01/app/oracle/SHAIKDB/control03.ctl'
*.control_files='/u01/app/oracle/SHAIKDB/control_rman.ctl'


SHAIKDB>startup nomount pfile='$ORACLE_HOME/dbs/initSHAIKDB.ora';
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size           2214936 bytes
Variable Size         482345960 bytes
Database Buffers       33554432 bytes
Redo Buffers           3821568 bytes


[oracle@collabn1 SHAIKDB]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Sep 5 01:12:41 2015

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

RMAN> connect target /

connected to target database: SHAIKDB (DBID=1683917583)

RMAN>  restore controlfile from '/u01/app/oracle/SHAIKDB/control01.ctl' ;

Starting restore at 05-SEP-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=26 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=/u01/app/oracle/SHAIKDB/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl
output file name=/u01/app/oracle/SHAIKDB/control03.ctl
output file name=/u01/app/oracle/SHAIKDB/control_rman.ctl
Finished restore at 05-SEP-15

RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN> sql 'alter database open';

sql statement: alter database open

SHAIKDB>select name from v$controlfile;

NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/u01/app/oracle/SHAIKDB/control01.ctl
/u01/app/oracle/flash_recovery_area/SHAIKDB/control02.ctl
/u01/app/oracle/SHAIKDB/control03.ctl
/u01/app/oracle/SHAIKDB/control_rman.ctl

SHAIKDB>create spfile from pfile;

File created.

SHAIKDB>shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SHAIKDB>startup
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size           2214936 bytes
Variable Size         482345960 bytes
Database Buffers       33554432 bytes
Redo Buffers           3821568 bytes
Database mounted.
Database opened.

No comments: