1. Create an empty table eygle2. Create the user eygle, which belongs to the eygle tablespace; grant the user DBA permission 3. log on to the DB as the egyle user, and create the table test_egyle4 and rman backup eg.
1. Create a table named empty eygle. 2. Create a user named eygle, which belongs to the eygle tablespace. Grant the user DBA permissions. 3. log on to the database as the egyle user and create the table test_egyle. 4. rman backup eg.
1. Create a table with an empty eygle
2. Create a user's eygle, which belongs to the eygle tablespace; grant the user the DBA permission
3. log on to the database as an egyle user and create the table test_egyle.
4. rman backup the egyle tablespace
RMAN> backup tablespace eygle tag = "ey_first ";
Starting backup at 15-FEB-14
Using target database control file instead of recovery catalog ---- use the target database control file instead of the recovery directory
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 317 device type = DISK
Channel ORA_DISK_1: starting full datafile backup set ---- start the full data file backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set ---- specifies the data file in the backup set
Input datafile file number = 00029 name =/home/Oracle/oradata/temp/eygle. f ---- input data file
Channel ORA_DISK_1: starting piece 1 at 15-FEB-14
Channel ORA_DISK_1: finished piece 1 at 15-FEB-14
Piece handle =/home/oracle/app/flash_recovery_area/ORA11G/backupset/2014_02_15/o1_mf_nnndf_EY_FIRST_9hxyglp2 _. bkp tag = EY_FIRST comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-FEB-14
Starting Control File and SPFILE Autobackup at 15-FEB-14 ---- when the library structure changes, controlfile and spfile will be automatically backed up
Piece handle =/home/oracle/app/flash_recovery_area/ORA11G/autobackup/2014_02_15/o1_mf_s_839597011_9hxygn23 _. bkp comment = NONE
Finished Control File and SPFILE Autobackup at 15-FEB-14
6. log on to the DB as a sys user and modify the table space egyle Status offline.
SQL> alter tablespace eygle offline;
7. Destroy the data file corresponding to the tablespace egyle, such as deleting or renaming
Oracle @ linux :~ /Oradata/temp> mv eygle. f eygle_bak.f
8. Modify the table space egyle Status online. An error is returned.
SQL> alter tablespace eygle online;
Alter tablespace eygle online
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 29-see DBWR trace file
ORA-01110: data file 29: '/home/oracle/oradata/temp/eygle. F'
9. rman recovery
RMAN> restore tablespace eygle; restore the backup file to its original location
Starting restore at 15-FEB-14
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 261 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 00029 to/home/oracle/oradata/temp/eygle. f
Channel ORA_DISK_1: reading from backup piece/home/oracle/app/flash_recovery_area/ORA11G/backupset/2014_02_15/o1_mf_nnndf_EY_FIRST_9hxyglp2 _. bkp
Channel ORA_DISK_1: piece handle =/home/oracle/app/flash_recovery_area/ORA11G/backupset/2014_02_15/o1_mf_nnndf_EY_FIRST_9hxyglp2 _. bkp tag = EY_FIRST
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 15-FEB-14
RMAN> recover tablespace eygle; restore
Starting recover at 15-FEB-14
Using channel ORA_DISK_1
Starting media recovery
Media recovery complete, elapsed time: 00:00:00
Finished recover at 15-FEB-14
10. Test recovery results
SQL> alter tablespace eygle online;
Tablespace altered.
Recommended reading:
RMAN: Configure an archive log deletion policy
Basic Oracle tutorial-copying a database through RMAN
Reference for RMAN backup policy formulation
RMAN backup learning notes
Oracle Database Backup encryption RMAN Encryption