Restore spfile
Test su Oracle11g (11.2.0.1.0)
Supponiamo di aver perso il file spfile e di non aver impostato l'autobackup del control file.
Se si utilizza Rman con il solo control file non si riesce a a recuperare l'spfile.
rman target /
RMAN> set DBID 4247218851;
executing command: SET DBID
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initTEST11.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 158662656 bytes
Fixed Size 2211448 bytes
Variable Size 92275080 bytes
Database Buffers 58720256 bytes
Redo Buffers 5455872 bytes
RMAN> restore spfile from autobackup;
Starting restore at 16-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20190116
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20190115
channel ORA_DISK_1: no AUTOBACKUP in 2 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/16/2019 12:25:23
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece
RMAN> list backup of spfile;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 01/16/2019 12:25:51
ORA-01507: database not mounted
Se invece ci si utilizza il recovery catalog, si può effettuare il restore in una directory temporanea.
[oracle@coslab03 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jan 17 10:28:44 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DUMMY (not mounted)
RMAN> set DBID 4247218851;
executing command: SET DBID
RMAN> connect catalog rman/rman@RECAT.world
connected to recovery catalog database
RMAN> list backup of spfile;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
713090 Full 9.75M SBT_TAPE 00:00:08 17-JAN-19
BP Key: 713092 Status: AVAILABLE Compressed: NO Tag: TAG20190117T095934
Handle: c-4247218851-20190117-00 Media: avtar007
SPFILE Included: Modification time: 17-JAN-19
SPFILE db_unique_name: TEST1
RMAN>
run {
allocate channel c0 type sbt PARMS="SBT_LIBRARY=/usr/local/avamar/lib/libobk_avamar64.so" format '%d_%U' trace 2;
send channel 'c0' ' "--ctlusessl=true" "--cacheprefix=TEST1_c0" "--sysdir=/usr/local/avamar/etc" "--bindir=/usr/local/avamar/bin" "--vardir=/usr/local/avamar/var/clientlogs" "--logfile=/u01/app/oracle/admin/TEST1/scripts/rman/log/backup_L0_c0.log" "--flagfile=/usr/local/avamar/lib/TEST1-flags.txt" ';
restore spfile to '/tmp/spfileS11TEST1.ora';
release channel c0;
}
Copiare sotto /u01/app/oracle/product/11.2.0/dbhome_1/dbs il file restorato
sotto /tmp/spfileS11TEST1.ora.
Stoppare e riavviare il db.
SQL> shutodown immediate;
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1536602112 bytes
Fixed Size 2213616 bytes
Variable Size 1056966928 bytes
Database Buffers 469762048 bytes
Redo Buffers 7659520 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
Supponiamo di aver perso il file spfile e di non aver impostato l'autobackup del control file.
Se si utilizza Rman con il solo control file non si riesce a a recuperare l'spfile.
rman target /
RMAN> set DBID 4247218851;
executing command: SET DBID
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initTEST11.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 158662656 bytes
Fixed Size 2211448 bytes
Variable Size 92275080 bytes
Database Buffers 58720256 bytes
Redo Buffers 5455872 bytes
RMAN> restore spfile from autobackup;
Starting restore at 16-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20190116
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20190115
channel ORA_DISK_1: no AUTOBACKUP in 2 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/16/2019 12:25:23
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece
RMAN> list backup of spfile;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 01/16/2019 12:25:51
ORA-01507: database not mounted
Se invece ci si utilizza il recovery catalog, si può effettuare il restore in una directory temporanea.
[oracle@coslab03 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jan 17 10:28:44 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DUMMY (not mounted)
RMAN> set DBID 4247218851;
executing command: SET DBID
RMAN> connect catalog rman/rman@RECAT.world
connected to recovery catalog database
RMAN> list backup of spfile;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
713090 Full 9.75M SBT_TAPE 00:00:08 17-JAN-19
BP Key: 713092 Status: AVAILABLE Compressed: NO Tag: TAG20190117T095934
Handle: c-4247218851-20190117-00 Media: avtar007
SPFILE Included: Modification time: 17-JAN-19
SPFILE db_unique_name: TEST1
RMAN>
run {
allocate channel c0 type sbt PARMS="SBT_LIBRARY=/usr/local/avamar/lib/libobk_avamar64.so" format '%d_%U' trace 2;
send channel 'c0' ' "--ctlusessl=true" "--cacheprefix=TEST1_c0" "--sysdir=/usr/local/avamar/etc" "--bindir=/usr/local/avamar/bin" "--vardir=/usr/local/avamar/var/clientlogs" "--logfile=/u01/app/oracle/admin/TEST1/scripts/rman/log/backup_L0_c0.log" "--flagfile=/usr/local/avamar/lib/TEST1-flags.txt" ';
restore spfile to '/tmp/spfileS11TEST1.ora';
release channel c0;
}
Copiare sotto /u01/app/oracle/product/11.2.0/dbhome_1/dbs il file restorato
sotto /tmp/spfileS11TEST1.ora.
Stoppare e riavviare il db.
SQL> shutodown immediate;
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1536602112 bytes
Fixed Size 2213616 bytes
Variable Size 1056966928 bytes
Database Buffers 469762048 bytes
Redo Buffers 7659520 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.