Check Database Running Parameter
[oratest@oracle ~]$ export ORACLE_SID=test [oratest@oracle ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 8 21:25:19 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/spfiletest.ora
Connect RMAN and Backup the Spfile:
[oratest@oracle ~]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Wed Sep 8 21:26:38 2021 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: TEST (DBID=2378581000)
RMAN> backup spfile; Starting backup at 08-SEP-21 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=66 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 08-SEP-21 channel ORA_DISK_1: finished piece 1 at 08-SEP-21 piece handle=/u01/app/oracle/oradata/TEST/backup/1208j2hb_1_1 tag=TAG20210908T212707
comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 08-SEP-21 Starting Control File and SPFILE Autobackup at 08-SEP-21 piece handle=/u01/app/oracle/oradata/TEST/backup/c-2378581000-20210908-00 comment=NONE Finished Control File and SPFILE Autobackup at 08-SEP-21
sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 8 21:28:32 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> shut immediate Database closed. Database dismounted. ORACLE instance shut down.
Move the Spfile to Backup File
[oracle@oracle ~]$ cd $ORACLE_HOME/dbs [oracle@oracle dbs]$ ls Spfiletest.ora inittest.ora [oracle@oracle dbs]$ mv spfiletest.ora spfiletest.ora_bkp [oracle@oracle dbs]$ ls initorcl.ora Spfiletest.ora_bkp
[oratest@oracle dbs]$ rman target/ Recovery Manager: Release 19.0.0.0.0 - Production on Wed Sep 8 21:33:14 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)
RMAN> set dbid 2378581000 executing command: SET DBID start the database in force option with nomount stage RMAN> startup force nomount; Oracle instance started Total System Global Area 1543500144 bytes Fixed Size 8896880 bytes Variable Size 905969664 bytes Database Buffers 620756992 bytes Redo Buffers 7876608 bytes
Restore the spfile from Auto backup Location
RMAN> restore spfile from autobackup; Starting restore at 08-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: TEST channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/fast_recovery_area/TEST/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/TEST/autobackup/2021_09_05/o1_mf_s_1082499783_jm9xhjjd_.bkp channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete Finished restore at 08-SEP-21 Recovery Manager complete.
[oracle@oracle ~]$ 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 --------- -------------------- TEST MOUNTED Using alter command open the database SQL> alter database open; Database altered. SQL> select name,open_mode from v$database; NAME OPEN_MODE --------- -------------------- TEST READ WRITE
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Ramkumar’s LinkedIn: https://www.linkedin.com/in/ramkumardba/
LinkedIn Group: https://www.linkedin.com/in/ramkumar-m-0061a0204/
Facebook Page: https://www.facebook.com/Oracleagent-344577549964301
Ramkumar’s Twitter: https://twitter.com/ramkuma02877110
Ramkumar’s Telegram: https://t.me/oracleageant
Ramkumar’s Facebook: https://www.facebook.com/ramkumarram8
One thought on “RESTORE SPFILE USING RMAN”