Tuesday, September 7, 2021

Spfile recovery using RMAN backup

 

 

Spfile recovery using RMAN backup

 

Connect database and check db is up spfile or not

 

[oracle@sample ~]$ . .orcl.env

[oracle@sample ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Sep 5 22:20:00 2021

Version 19.3.0.0.0

 

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

 

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

SQL> show parameter pfile;

 

NAME                                 TYPE        VALUE

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

spfile                               string      /u01/app/oracle/product/19.0.0

                                                 /dbhome_1/dbs/spfileorcl.ora

 

Connect rman and backup the spfile

 

[oracle@sample ~]$ rman target/

 

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Sep 5 22:22:51 2021

Version 19.3.0.0.0

 

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

 

connected to target database: ORCL (DBID=1608294549)

 

RMAN> backup spfile;

 

Starting backup at 05-SEP-21

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=83 device type=DISK

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 05-SEP-21

channel ORA_DISK_1: finished piece 1 at 05-SEP-21

piece handle=/backup/rman/full_2b08b8m6_75_1 tag=TAG20210905T222302 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 05-SEP-21

 

Starting Control File and SPFILE Autobackup at 05-SEP-21

piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2021_09_05/o1_mf_s_1082499783_jm9xhjjd_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 05-SEP-21

 

RMAN> exit

 

 

Shutdown the database

 

SQL> shut immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

 

Move the spfile to backup file

 

[oracle@sample ~]$ cd $ORACLE_HOME/dbs

[oracle@sample dbs]$ ls

Spfileorcl.ora  initorcl.ora

 

[oracle@sample dbs]$ mv spfileorcl.ora spfileorcl.ora_bkp

 

[oracle@sample dbs]$ ls

initorcl.ora   Spfileorcl.ora_bkp

 

connect rman and recover the spfile

 

[oracle@sample ~]$ rman target/

 

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Sep 5 22:29:28 2021

Version 19.3.0.0.0

 

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

 

connected to target database (not started)

 

set database id

 

RMAN> set dbid 1608294549

 

executing command: SET DBID

 

start the database in force option with nomount stage

 

RMAN>  startup force nomount;

 

Oracle instance started

 

Total System Global Area    2147481656 bytes

 

Fixed Size                     8898616 bytes

Variable Size               1677721600 bytes

Database Buffers             452984832 bytes

Redo Buffers                   7876608 bytes

 

Restore the spfile from autobackup locatiom

 

RMAN> restore spfile  from autobackup;

 

Starting restore at 05-SEP-21

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=38 device type=DISK

 

recovery area destination: /u01/app/oracle/fast_recovery_area

database name (or database unique name) used for search: ORCL

channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORCL/autobackup/2021_09_05/o1_mf_s_1082499783_jm9xhjjd_.bkp found in the recovery area

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20210905

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORCL/autobackup/2021_09_05/o1_mf_s_1082499783_jm9xhjjd_.bkp

channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 05-SEP-21

 

 

Recovery Manager complete.

 

Once RMAN recovery completed connect the database it is in mounted stage

 

 [oracle@sample ~]$ . .orcl.env

[oracle@sample ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Sep 5 22:32:18 2021

Version 19.3.0.0.0

 

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

 

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

 

SQL> select name,open_mode from v$database;

 

NAME      OPEN_MODE

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

ORCL      MOUNTED

 

Using alter command open the database

 

SQL> alter database open;

 

Database altered.

 

 

SQL>  select name,open_mode from v$database;

 

NAME      OPEN_MODE

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

ORCL      READ WRITE

No comments:

Post a Comment

Oracle OS Management Hub in OCI – A Complete Overview

  Oracle OS Management Hub in OCI – A Complete Overview In any enterprise IT landscape, managing operating systems across hundreds of compu...