Oracle: Only rman backup (data, parameters, logs, and control files are lost) is restored, and mongolerman

Source: Internet
Author: User

Oracle: Only rman backup (data, parameters, logs, and control files are lost) is restored, and mongolerman
Oracle: Only recovery of rman backup (data, parameters, logs, and control files are lost)
Only the backup file recovery process of rman is Created by foway in uplooking.com 2008: you are welcome to reprint it, but please keep this line of instructions. Thank you!

1. Restore the spfile through the rman backup file
2. Use the rman backup file to restore controlfile
3. Use the rman backup file to restore datafile
4. Use the recovered controlfile and datafile to generate redolog
5. test whether the transaction exists and make full backup

All my system environment files are as follows:

[Oracle @ foway dbs] $ pwd
/Opt/oracle/10g/dbs
[Oracle @ foway dbs] $ ls
Initdw. ora init. ora
[Oracle @ foway dbs] $ ls/opt/oracle/oradata
No information available
[Oracle @ foway dbs] $ ls/opt/oracle/admin
No information available
[Oracle @ foway dbs] ls/opt/oracle/flash_recovery_area/
ORCL
[Oracle @ foway dbs] ls/opt/oracle/flash_recovery_area/ORCL/backupset/
2008_07_18
[Oracle @ foway dbs] ls/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/
O1_mf_ncsnf_TAG20080718T203240_482fls2h _. bkp
O1_mf_nnndf_TAG20080718T203240_482fkb0k _. bkp

On my computer, all the ORCL-related data files, parameter files, log files, and control files in the system are gone, and no other backup files are available, only the files backed up by rman are available. What should I do?

There is no way to recover it. How can this problem be solved?

Want to restore the data file using rman backup? Yes? Of course not, because the restore must be in the mount or open state.
Parameter files and control files are not mounted. How can this problem be solved?

To mount a file, you must have a parameter file and a control file. Therefore, we must solve these two problems.
Prepare the required ORCL directory before solving the problem:
[Oracle @ foway dbs] mkdir/opt/oracle/oradata/orcl
[Oracle @ foway dbs] mkdir/opt/oracle/admin/orcl/adump-p
[Oracle @ foway dbs] mkdir/opt/oracle/admin/orcl/cdump
[Oracle @ foway dbs] mkdir/opt/oracle/admin/orcl/bdump
[Oracle @ foway dbs] mkdir/opt/oracle/admin/orcl/udump
[Oracle @ foway dbs] mkdir/opt/oracle/admin/orcl/dpdump
[Oracle @ foway dbs] mkdir/opt/oracle/admin/orcl/pfile


Problem 1: spfile
Some people say that it is feasible to create a new pfile without a parameter file, but in 10 Gb, The rman backup automatically backs up the spfile, so we can use rman to restore the spfile.
[Oracle @ foway dbs] rman target/nocatalog
Recovery Manager: Release 10.2.0.4.0-Production on Fri Jul 18 21:21:47 2008

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Connected to target database (not started)

RMAN> list backup;

RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of list command at 07/18/2008 21:24:37
RMAN-06403: cocould not obtain a fully authorized session
A ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directorylist copy;

RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of list command at 07/18/2008 21:24:51
RMAN-06403: cocould not obtain a fully authorized session
A ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

The above is normal, because the database is not started.
So we started the database to nomout first.
RMAN> startup nomount

Startup failure: ORA-01078: failure in processing system parameters
LRM-00109: cocould not open parameter file '/opt/oracle/10g/dbs/initorcl. ora'

Starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes

RMAN> list backup;
RMAN> list copy;
As shown in the previous execution, it is also normal and you don't have to worry about it. Here we use rman to back up the file to Solve the Problem 1.
RMAN> restore spfile
From '/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_ncsnf_TAG20080718T203240_482fls2h _. bkp ';
Starting restore at 18-JUL-08
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 36 devtype = DISK

Channel ORA_DISK_1: autobackup found:/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_ncsnf_TAG20080718T203240_482fls2h _. bkp
Channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 18-JUL-08

The following shows how to verify whether the spfileorcl. ora file already exists:
[Oracle @ foway dbs] $ pwd
/Opt/oracle/10g/dbs
[Oracle @ foway dbs] $ ls
Initdw. ora init. ora spfileorcl. ora
Congratulations! spfile has been restored.
With the parameter file, the control file must be restored.

Problem 2. control file recovery
How can this be restored? Is rman backup of the automatic backup control file of rman used? Yes. Only the controlfile extracted from the rman backup file can use the rman backup file to restore the datafile.

There is a way to extract controlfie from the rman backup file.
Method 1.
RMAN> restore controlfile from '/... Backup file ..';
The recovered control file will be stored in $ ORACLE_HOME/dbs/cncontrl. dbf. However, this method sometimes records the dbname In the recovered control file as inconsistent with the actual one.

Method 2: extract controlfile using dbms_backup_restore
Steps:
[Oracle @ foway dbs] $ sqlplus/nolog
SQL * Plus: Release 10.2.0.4.0-Production on Fri Jul 18 21:38:21 2008

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL> conn/as sysdba
Connected.
Since startup nomount was executed when rman was used just now, this is connected. Next we will go to the nomount status.
SQL> startup force nomount
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
SQL> DECLARE
2 devtype varchar2 (256 );
3 done boolean;
4 BEGIN
5 devtype: = sys. dbms_backup_restore.deviceAllocate (type => '', ident => 't1 ');
6sys. dbms_backup_restore.restoreSetDatafile;
7sys. dbms_backup_restore.restoreControlfileTo (cfname => '/opt/oracle/oradata/orcl/control01.ctl ');
8sys. Compute (done => done, handle => '/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/partition _. bkp', params => null );
9 sys. dbms_backup_restore.deviceDeallocate;
10 end;
11/

PL/SQL procedure successfully completed.

Verify that control01.ctl is restored:
[Oracle @ foway dbs] $ ls/opt/oracle/oradata/orcl/
Control01.ctl
[Oracle @ foway dbs] $
You have seen control01.ctl. Congratulations: Problem 2 has been solved.
So we can start the database to the mount state.
[Oracle @ foway dbs] $ sqlplus/nolog

SQL * Plus: Release 10.2.0.4-Production on Fri Jul 18 21:45:32 2008

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL> conn/as sysdba
Connected.
SQL> startup force mount
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info

We have recovered the control file. Why is there an error? In fact, don't worry. Look at the records in spfile first.
SQL> show parameter control_files

NAME TYPE VALUE
-----------------------------------------------------------------------------
Control_files string/opt/oracle/oradata/orcl/contr
Ol01.ctl,/opt/oracle/oradata/
Orcl/control02.ctl,/opt/oracl
E/oradata/orcl/control03.ctl
SQL>
In this case, we can synchronize the control file.
SQL> ho cp/opt/oracle/oradata/orcl/control01.ctl/opt/oracle/oradata/orcl/control02.ctl
SQL> ho cp/opt/oracle/oradata/orcl/control01.ctl/opt/oracle/oradata/orcl/control03.ctl
SQL> alter database mount;

Database altered.

SQL> ho ls/opt/oracle/oradata/orcl/
Control01.ctl control02.ctl control03.ctl

Now we have successfully solved problem 2.

With the recovered control file, we can use rman to view and use the previous rman backup.

Steps for restoring datafile:
Rman target/nocatalog

Recovery Manager: Release 10.2.0.4-Production on Fri Jul 18 21:49:10 2008

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Connected to target database: ORCL (DBID = 1188209463, not open)
Using target database control file instead of recovery catalog

RMAN>
Have you seen the red part? That's good. I finally saw the normal rman login information.
List copy | backup.
O1_mf_ncsnf_TAG20080718T203240_482fls2h _. bkp
O1_mf_nnndf_TAG20080718T203240_482fkb0k _. bkp
File.
RMAN> list copy;

Specification does not match any archive log in the recovery catalog

RMAN> list backup;


List of Backup Sets
==============================

BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
1 Full 495.41 m disk 00:00:41 18-JUL-08
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20080718T203240
Piece Name:/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_nnndf_TAG20080718T203240_482fkb0k _. bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---------------------------------
1 Full 453304 18-JUL-08/opt/oracle/oradata/orcl/system01.dbf
2 Full 453304 18-JUL-08/opt/oracle/oradata/orcl/undotbs01.dbf
3 Full 453304 18-JUL-08/opt/oracle/oradata/orcl/sysaux01.dbf
4 Full 453304 18-JUL-08/opt/oracle/oradata/orcl/users01.dbf

RMAN>
Great. You can always use restore and recover to restore datafile.
RMAN> restore database;

Starting restore at 18-JUL-08
Starting implicit crosscheck backup at 18-JUL-08
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 156 devtype = DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 18-JUL-08

Starting implicit crosscheck copy at 18-JUL-08
Using channel ORA_DISK_1
Finished implicit crosscheck copy at 18-JUL-08

Searching for all files in the recovery area
Cataloging files...
Cataloging done

List of Cataloged Files
======================================
File Name:/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_ncsnf_TAG20080718T203240_482fls2h _. bkp

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile backupset restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Restoring datafile 00001 to/opt/oracle/oradata/orcl/system01.dbf
Restoring datafile 00002 to/opt/oracle/oradata/orcl/undotbs01.dbf
Restoring datafile 00003 to/opt/oracle/oradata/orcl/sysaux01.dbf
Restoring datafile 00004 to/opt/oracle/oradata/orcl/users01.dbf
Channel ORA_DISK_1: reading from backup piece/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_nnndf_TAG20080718T203240_482fkb0k _. bkp
Channel ORA_DISK_1: restored backup piece 1
Piece handle =/opt/oracle/flash_recovery_area/ORCL/backupset/2008_07_18/o1_mf_nnndf_TAG20080718T203240_482fkb0k _. bkp tag = TAG20080718T203240
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:56
Finished restore at 18-JUL-08

RMAN>
You can see the expected datafile under $ ORACLE_BASE/oradata/orcl.
[Oracle @ foway dbs] ls/opt/oracle/oradata/orcl/
Control01.ctl control02.ctl control03.ctl sysaux01.dbf system01.dbf undotbs01.dbf users01.dbf
[Oracle @ foway dbs]
However, at this time it is not complete yet. You need to continue to work.

Because there is no redo log file, we do not apply log recovery:
RMAN> recover database noredo;

Starting recover at 18-JUL-08
Using channel ORA_DISK_1
Finished recover at 18-JUL-08

RMAN>

So far, we already have parameter files, control files, and data files:
[Oracle @ foway dbs] ls/opt/oracle/oradata/orcl/
Ls/opt/oracle/oradata/orcl/
Control01.ctl control02.ctl control03.ctl sysaux01.dbf system01.dbf
Undotbs01.dbf users01.dbf
[Oracle @ foway dbs] ls/opt/oracle/10g/dbs/
Alert_orcl.log hc_orcl.dat initdw. ora init. ora lkORCL spfileorcl. ora
A password file and related log files are missing.
Solve the password file first:
[Oracle @ foway dbs] orapwd file =/opt/oracle/10g/dbs/orapworcl password = uplooking entries = 5
[Oracle @ foway dbs] ls/opt/oracle/10g/dbs/
Ls/opt/oracle/10g/dbs/
Alert_orcl.log initdw. ora lkORCL spfileorcl. ora
Hc_orcl.dat init. ora orapworcl

Next we need to persistently complete the last job.
The recovered controlfile and datafile are used to calculate the redo log file.
Steps:
[Oracle @ foway dbs] sqlplus/nolog
SQL * Plus: Release 10.2.0.4-Production on Fri Jul 18 21:58:05 2008

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL> conn/as sysdba
Connected.
SQL> startup force mount
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter system set "_ allow_resetlogs_uption" = TRUE;
Alter system set "_ allow_resetlogs_uption" = TRUE
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

SQL> alter system set "_ allow_resetlogs_uption" = TRUE scope = spfile;

System altered.

SQL> ho ls/opt/oracle/oradata/orcl/
Control01.ctl control03.ctl sysaux01.dbf undotbs01.dbf
Control02.ctl orapworcl system01.dbf users01.dbf

There is no redo log file below, and I will calculate the redo log below
SQL> startup force
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
The ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

Database altered.
SQL> ho ls/opt/oracle/oradata/orcl/
Control01.ctl orapworcl redo03.log temp01.dbf
Control02.ctl redo01.log sysaux01.dbf undotbs01.dbf
Control03.ctl redo02.log system01.dbf users01.dbf

SQL>
Now, we are very glad that you have successfully recovered the parameter files, control files, all data files, and log files from only the rman backup files.

Generally, you still need full backup databases here. Don't forget!Original article addressHttp://www.oracle.com.cn/viewthread.php? Tid = 136013

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.