Non-critical data file loss (offline data files can be lost): run {sqlalterdatabasedatafileoffline; restoredatafile; recoverdatafile; slqalterdatabasedatafileonline ;} in addition to the system and undo_tablespace parameters, the tablespace corresponding to the values can be restored using the preceding methods. [Limit L
Non-critical data file loss (offline data files can be lost): run {SQL alter database datafile offline; restore datafile; recover datafile; slq alter database datafile online ;} in addition to the system and undo_tablespace parameters, the tablespace corresponding to the values can be restored using the preceding methods. [Limit L
Non-critical data file loss (loss of offline data files ):
run{sql 'alter database datafile <> offline';restore datafile <>;recover datafile <>;slq 'alter database datafile <> online';}
In addition to the system and undo_tablespace parameters, the tablespace corresponding to the values can be restored using the preceding methods.
[oracle@oracle ~]$ ls /u01/oracle/oradata/jadl10g/control01.ctl control03.ctl redo01.log redo03.log system01.dbf undotbs01.dbfcontrol02.ctl example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf[oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/example01.dbf[oracle@oracle ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 15:23:57 2014Copyright (c) 1982, 2010, Oracle. All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engineand Real Application Testing optionsSQL> select * from hr.employees;select * from hr.employees*ERROR at line 1:ORA-01116: error in opening database file 5ORA-01110: data file 5: '/u01/oracle/oradata/jadl10g/example01.dbf'ORA-27041: unable to open fileLinux-x86_64 Error: 2: No such file or directoryAdditional information: 3[oracle@oracle ~]$ vi /tmp/1.rman
Create a recovery script:
[oracle@oracle ~]$ cat /tmp/1.rmanrun{sql 'alter database datafile 5 offline';restore datafile 5;recover datafile 5;sql 'alter database datafile 5 online';}
Rman uses the script to restore the database data:
[Oracle @ oracle ~] $ Rman target/destination file =/tmp/1. rmanRecovery Manager: Release 10.2.0.5.0-Production on Thu Nov 6 15:29:28 2014 Copyright (c) 1982,200 7, 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 f [this article is from the Internet of Hong Kong ( http://www.68idc.cn )] Ile instead of recovery catalogsql statement: alter database datafile 5 offlineStarting restore at specified channel: Required ORA_DISK_1: sid = 159 devtype = DISKchannel ORA_DISK_1: starting datafile backupset restorechannel ORA_DISK_1: specifying datafile (s) to restore from backup setrestoring datafile 00005 to/u01/oracle/oradata/jadl10g/example01.dbfchannel ORA_DISK_1: reading from backup piece/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_tag20141106t1351__b5p32dhf _. bkpchannel 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 = MAID: restore complete, elapsed time: 00: 00: 07 Finished restore at 06-NOV-14Starting recover at large channel ORA_DISK_1starting media recoverymedia recovery complete, elapsed time: 00: 00: 00 Finished recover at 06-NOV-14sql statement: alter database datafile 5 onlineRecovery Manager complete.
At this time, no error will occur when you execute the query.
System/example are lost. What should I do?
Shutdowm abort
Restore datafile 1, 5;
Recover database;
Alter database open;
After this operation, you do not need to back up the database again. The previous backup is valid.
Restore image copies
RMAN> backup as copy datafile 5; Starting backup at 06-NOV-14using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid = 159 devtype = DISKchannel ORA_DISK_1: starting datafile copyinput datafile fno = 00005 name =/u01/oracle/oradata/jadl10g/example01.dbfoutput 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-14RMAN> recover copy of datafile 5; --- the modification command is to incrementally modify the above data file. Starting recover at 06-NOV-14using channel ORA_DISK_1no copy of datafile 5 found to recoverFinished recover at 06-NOV-14
Migrate data files from a path to a new path
Data files from the file system to ASM
Data files from ASM to the file system
Implementation of the above requirements:
Set newname for datafile '...' '...';
Restore...
Switch datafile all;
Recover ....
Migrate data files to ASM:
SQL> select name from v $ asm_diskgroup; vi. rmanrun {SQL 'alter tablespace a1 offline immediate'; set newname for datafile 7 to '+ db'; restore datafile 7; switch datafile all; --- switch file recover datafile 7; slq 'alter tablespace a1 online ';}
Execute the script in rman;
12c is special:
Alter database datafile 13 move '/u01/...'; ---- move to the new path