"Noncritical Data file loss (can be lost offline data file)-recovery-1"

Source: Internet
Author: User

Non-critical data files are missing (can be lost offline data files):
run{
SQL ' ALTER DATABASE datafile <> offline ';
Restore DataFile <>;
Recover DataFile <>;
SLQ ' ALTER DATABASE datafile <> online ';
}
In addition to the system, the Undo_tablespace parameter after the value of the table space can be recovered using the above method.
[Email protected] ~]$ ls/u01/oracle/oradata/jadl10g/
Control01.ctl control03.ctl redo01.log redo03.log system01.dbf undotbs01.dbf
Control02.ctl example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
[Email protected] ~]$ RM/U01/ORACLE/ORADATA/JADL10G/EXAMPLE01.DBF
[Email protected] ~]$ Sqlplus/as SYSDBA
Sql*plus:release 10.2.0.5.0-production on Thu Nov 6 15:23:57 2014
Copyright (c) 1982, Oracle. All rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0-64bit Production
With the partitioning, Oracle Label Security, OLAP, Data Mining scoring Engine
and Real Application Testing options


Sql> select * from Hr.employees;
SELECT * FROM Hr.employees
*
ERROR at line 1:
Ora-01116:error in opening database file 5
Ora-01110:data file 5: '/U01/ORACLE/ORADATA/JADL10G/EXAMPLE01.DBF '
Ora-27041:unable to open File
linux-x86_64 error:2: No such file or directory
Additional Information:3
[Email protected] ~]$ Vi/tmp/1.rman
To create a recovery script:
[Email protected] ~]$ Cat/tmp/1.rman
run{
SQL ' ALTER DATABASE datafile 5 offline ';
Restore DataFile 5;
Recover DataFile 5;
SQL ' ALTER DATABASE datafile 5 online ';
}
Rman uses the established script to recover data from the database:
[Email protected] ~]$ Rman Target/cmdfile=/tmp/1.rman
Recovery manager:release 10.2.0.5.0-production on Thu Nov 6 15:29:28 2014
Copyright (c) 1982, Oracle. All rights reserved.
Connected to target database:jadl10g (dbid=2011530396)


Rman> run{
2> SQL ' ALTER DATABASE datafile 5 offline ';
3> restore DataFile 5;
4> recover datafile 5;
5> SQL ' ALTER DATABASE datafile 5 online ';
6>}
7>
Using target database control file instead of recovery catalog
SQL Statement:alter database datafile 5 offline

Starting restore at 06-nov-14
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=159 Devtype=disk

Channel ora_disk_1:starting datafile backupset restore
Channel ora_disk_1:specifying DataFile (s) to the restore from backup set
restoring DataFile 00005 to/u01/oracle/oradata/jadl10g/example01.dbf
Channel ora_disk_1:reading from backup piece/u01/oracle/flash_recovery_area/jadl10g/backupset/2014_11_06/o1_mf_ Nnndf_tag20141106t135107_b5p32dhf_.bkp
Channel ora_disk_1:restored backup Piece 1
Piece handle=/u01/oracle/flash_recovery_area/jadl10g/backupset/2014_11_06/o1_mf_nnndf_tag20141106t135107_ B5P32DHF_.BKP tag=tag20141106t135107
Channel Ora_disk_1:restore complete, elapsed time:00:00:07
Finished restore at 06-nov-14

Starting recover at 06-nov-14
Using channel Ora_disk_1

Starting Media recovery
Media recovery complete, elapsed time:00:00:00

Finished recover at 06-nov-14

SQL Statement:alter database datafile 5 Online

Recovery Manager complete.

There is no error executing the query at this time.

System/example are missing what to do with it?
SHUTDOWM Abort
Restore DataFile 1, 5;
Recover database;
ALTER DATABASE open;
After doing so, you do not need to back up the database, and the previous backup is valid.

Recovering a copy of an image
rman> Backup as copy datafile 5;

Starting backup at 06-nov-14
Using target database control file instead of recovery catalog
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=159 Devtype=disk
Channel ora_disk_1:starting datafile Copy
Input datafile fno=00005 name=/u01/oracle/oradata/jadl10g/example01.dbf
Output FILENAME=/U01/ORACLE/FLASH_RECOVERY_AREA/JADL10G/DATAFILE/O1_MF_EXAMPLE_B5PBO2PC_.DBF tag= tag20141106t160034 recid=10 stamp=862934437
Channel ora_disk_1:datafile copy complete, elapsed time:00:00:03
Finished backup at 06-nov-14

rman> Recover copy of datafile 5; ---Change the command is to make incremental changes to the above data file,
Starting recover at 06-nov-14
Using channel Ora_disk_1
No copy of DataFile 5 found to recover
Finished recover at 06-nov-14

Migrating data files from one path to a new path
Data files from file system to ASM
Data files from ASM to file system
Implementation of the above requirements:
Set newname for datafile ' ... ' to ' ... ';
Restore ...
Switch datafile all;
Recover ....
To migrate a data file to ASM:
Sql> select name from V$asm_diskgroup;
VI A.rman
run{
SQL ' alter tablespace A1 offline immediate ';
Set newname for datafile 7 to ' +db ';
Restore DataFile 7;
Switch datafile all; ---swap files
Recover DataFile 7;
SLQ ' alter tablespace A1 online ';
}
Execute the script in Rman;

12c is quite special:
ALTER DATABASE datafile move '/u01/... ';----moved to a new path

"Noncritical Data file loss (can be lost offline data file)-recovery-1"

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.