Following up on my previous post (which had the datafiles as non-OMF), here is a case with OMF files.
I have removed the datafiles for a tablespace. Note that the datafiles are all OMF. I then attempt to restore the tablespace.
Once again, the database has crashed in the midst of the RESTORE. Let's check the datafile names.
[To understand why I queried both V$DATAFILE and V$DATAFILE_HEADER, see my previous post "Datafiles not Restored -- using V$DATAFILE and V$DATAFILE_HEADER".]
So, datafiles 7 and 9 have been restored. We can see that in the RESTORE log as well -- "backup piece 1" in the RESTORE had datafiles 7 and 9 and was the only one to complete. Let's check the datafile names. Datafiles 7 and 9 are differently named from what they were earlier. Earlier, they were "%bst85%", now they are "%bst90%".
So, if we want to re-run the restore, we can use SET NEWNAME for datafiles 7 and 9 to allow Oracle to check that they are already restored.
YES ! Datafiles 7 and 9 were identified as "already restored".
Let's re-check the datafiles and then RECOVER them.
Yes, I have been able to verify that all the datafiles have been restored. I have been able to bring the tablespace online and query the data in it.
And, yes the datafile names (%bst90%) are different from what they were earlier (%bst84% and %bst85%).
(Reference : See Oracle Support Note Doc ID 1621319.1)
.
.
.
SQL> select file_name from dba_data_files 2 where tablespace_name = 'HEMANT'; FILE_NAME -------------------------------------------------------------------------------- /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst84r1w_.dbf /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst850ts_.dbf /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst85312_.dbf /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst85njw_.dbf /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst85qsq_.dbf SQL> SQL> !rm /home/oracle/app/oracle/oradata/HEMANTDB/datafile/*hemant*dbf SQL> shutdown immediate; ORA-01116: error in opening database file 6 ORA-01110: data file 6: '/home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst84r1w_.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 SQL> shutdown abort; ORACLE instance shut down. SQL>
I have removed the datafiles for a tablespace. Note that the datafiles are all OMF. I then attempt to restore the tablespace.
SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ sqlplus SQL*Plus: Release 11.2.0.2.0 Production on Wed Jul 8 21:15:21 2015 Copyright (c) 1982, 2010, Oracle. All rights reserved. Enter user-name: / as sysdba Connected to an idle instance. SQL> startup mount; ORACLE instance started. Total System Global Area 456146944 bytes Fixed Size 1344840 bytes Variable Size 390073016 bytes Database Buffers 58720256 bytes Redo Buffers 6008832 bytes Database mounted. SQL> select file# from v$datafile 2 where ts# = (select ts# from v$tablespace where name = 'HEMANT') 3 order by 1; FILE# ---------- 6 7 8 9 11 SQL> SQL> alter database datafile 6 offline; Database altered. SQL> alter database datafile 7 offline; Database altered. SQL> alter database datafile 8 offline; Database altered. SQL> alter database datafile 9 offline; Database altered. SQL> alter database datafile 11 offline; Database altered. SQL> alter database open; Database altered. SQL> SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ rman target / Recovery Manager: Release 11.2.0.2.0 - Production on Wed Jul 8 21:22:02 2015 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1229390655) RMAN> RMAN> restore tablespace HEMANT; Starting restore at 08-JUL-15 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=36 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00007 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szss_.dbf channel ORA_DISK_1: restoring datafile 00009 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szxb_.dbf channel ORA_DISK_1: reading from backup piece /NEW_FS/oracle/FRA/HEMANTDB/backupset/2015_07_08/o1_mf_nnndf_TAG20150708T211100_bst8c58p_.bkp channel ORA_DISK_1: piece handle=/NEW_FS/oracle/FRA/HEMANTDB/backupset/2015_07_08/o1_mf_nnndf_TAG20150708T211100_bst8c58p_.bkp tag=TAG20150708T211100 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00006 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szv5_.dbf channel ORA_DISK_1: restoring datafile 00008 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szwh_.dbf channel ORA_DISK_1: restoring datafile 00011 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8t089_.dbf channel ORA_DISK_1: reading from backup piece /NEW_FS/oracle/FRA/HEMANTDB/backupset/2015_07_08/o1_mf_nnndf_TAG20150708T211100_bst8c58n_.bkp RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-00601: fatal error in recovery manager RMAN-03004: fatal error during execution of command ORA-01092: ORACLE instance terminated. Disconnection forced ORACLE error from target database: ORA-03135: connection lost contact Process ID: 3615 Session ID: 29 Serial number: 21 [oracle@localhost ~]$
Once again, the database has crashed in the midst of the RESTORE. Let's check the datafile names.
[oracle@localhost ~]$ sqlplus '/ as sysdba' SQL*Plus: Release 11.2.0.2.0 Production on Wed Jul 8 21:25:12 2015 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to an idle instance. SQL> startup mount; ORACLE instance started. Total System Global Area 456146944 bytes Fixed Size 1344840 bytes Variable Size 394267320 bytes Database Buffers 54525952 bytes Redo Buffers 6008832 bytes Database mounted. SQL> set pages60 SQL> select file#, name from v$datafile where file# in (6,7,8,9,11) order by 1; FILE# ---------- NAME -------------------------------------------------------------------------------- 6 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szv5_.dbf 7 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jct_.dbf 8 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szwh_.dbf 9 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jf1_.dbf 11 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8t089_.dbf SQL> SQL> select file#, name from v$datafile_header where file# in (6,7,8,9,11) order by 1; FILE# ---------- NAME -------------------------------------------------------------------------------- 6 7 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jct_.dbf 8 9 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jf1_.dbf 11 SQL>
[To understand why I queried both V$DATAFILE and V$DATAFILE_HEADER, see my previous post "Datafiles not Restored -- using V$DATAFILE and V$DATAFILE_HEADER".]
So, datafiles 7 and 9 have been restored. We can see that in the RESTORE log as well -- "backup piece 1" in the RESTORE had datafiles 7 and 9 and was the only one to complete. Let's check the datafile names. Datafiles 7 and 9 are differently named from what they were earlier. Earlier, they were "%bst85%", now they are "%bst90%".
So, if we want to re-run the restore, we can use SET NEWNAME for datafiles 7 and 9 to allow Oracle to check that they are already restored.
SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ rman target / Recovery Manager: Release 11.2.0.2.0 - Production on Wed Jul 8 21:32:12 2015 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1229390655, not open) RMAN> run 2> {set newname for datafile 7 to '/home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jct_.dbf'; 3> set newname for datafile 9 to '/home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jf1_.dbf'; 4> restore tablespace HEMANT;} executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 08-JUL-15 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=18 device type=DISK skipping datafile 7; already restored to file /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jct_.dbf skipping datafile 9; already restored to file /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jf1_.dbf channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00006 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szv5_.dbf channel ORA_DISK_1: restoring datafile 00008 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8szwh_.dbf channel ORA_DISK_1: restoring datafile 00011 to /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst8t089_.dbf channel ORA_DISK_1: reading from backup piece /NEW_FS/oracle/FRA/HEMANTDB/backupset/2015_07_08/o1_mf_nnndf_TAG20150708T211100_bst8c58n_.bkp channel ORA_DISK_1: piece handle=/NEW_FS/oracle/FRA/HEMANTDB/backupset/2015_07_08/o1_mf_nnndf_TAG20150708T211100_bst8c58n_.bkp tag=TAG20150708T211100 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 Finished restore at 08-JUL-15 RMAN>
YES ! Datafiles 7 and 9 were identified as "already restored".
Let's re-check the datafiles and then RECOVER them.
RMAN> exit Recovery Manager complete. [oracle@localhost ~]$ sqlplus '/ as sysdba' SQL*Plus: Release 11.2.0.2.0 Production on Wed Jul 8 21:37:29 2015 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> SQL> select name from v$datafile 2 where ts#=(select ts# from v$tablespace where name = 'HEMANT') 3 minus 4 select name from v$datafile_header 5 where ts#=(select ts# from v$tablespace where name = 'HEMANT') 6 / no rows selected SQL> SQL> select * from v$datafile_header where name is null; no rows selected SQL> SQL> recover datafile 6; Media recovery complete. SQL> recover datafile 7; Media recovery complete. SQL> recover datafile 8; Media recovery complete. SQL> recover datafile 9; Media recovery complete. SQL> recover datafile 11; Media recovery complete. SQL> alter tablespace HEMANT online; alter tablespace HEMANT online * ERROR at line 1: ORA-01109: database not open SQL> alter database open; Database altered. SQL> alter tablespace HEMANT online; Tablespace altered. SQL> SQL> select owner, segment_name, bytes/1048576 from dba_segments where tablespace_name = 'HEMANT'; OWNER ------------------------------ SEGMENT_NAME -------------------------------------------------------------------------------- BYTES/1048576 ------------- HEMANT LARGE_TABLE 272 SQL> select count(*) from hemant.large_table; COUNT(*) ---------- 2404256 SQL>
Yes, I have been able to verify that all the datafiles have been restored. I have been able to bring the tablespace online and query the data in it.
SQL> set pages60 SQL> select file_id, file_name from dba_data_files where tablespace_name = 'HEMANT'; FILE_ID ---------- FILE_NAME -------------------------------------------------------------------------------- 6 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst9o4vt_.dbf 7 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jct_.dbf 8 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst9o4x0_.dbf 9 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst90jf1_.dbf 11 /home/oracle/app/oracle/oradata/HEMANTDB/datafile/o1_mf_hemant_bst9o4x5_.dbf SQL>
And, yes the datafile names (%bst90%) are different from what they were earlier (%bst84% and %bst85%).
(Reference : See Oracle Support Note Doc ID 1621319.1)
.
.
.
No comments:
Post a Comment