1. Backup;
1: connect to the target database:
RMAN> connect target sys/sysray @ dB or RMAN target = sys/sysray @ DB
2: query the configuration of the target database;
RMAN> show all;
Modify the configuration as follows:
Configure retention policy to redundancy 1; # default
Configure backup Optimization on;
Configure Default device type to disk; # default
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to 'f: rman_back % F'; # default
Configure device type disk parallelism 1; # default
Configure datafile backup copies for device type disk to 1; # default
Configure archivelog backup copies for device type disk to 1; # default
Configure Channel 1 device type disk format "F: rman_back % u ";
Configure maxsetsize to unlimited; # default
Configure snapshot controlfile name to 'f: rman_backsncfraydb.ora ';
3: backup control and data files
RMAN> backup database;
4. Back up log files;
RMAN> Backup archivelog all Delete input;
Ii. Recovery:
1: first, run the database in the 'mounted' mode;
SQL> shutdown immediate;
SQL> startup Mount;
SQL> select status from V $ instance;
2: RMAN> Restore database;
3: RMAN> recover database;
The database is successfully restored;
SQL> alter database open;
OK;
<2>: backup and recovery of tablespaces. The database must work in the archive log mode;
1: tablespace backup;
RMAN> Backup (tablespace users include current controlfile );
2. Back up archived logs;
RMAN> Backup (archivelog all Delete input );
3: tablespace recovery;
3.1: The tablespace is offline;
RMAN> SQL 'alter tablespace users offline immediate ';
3.2: Restore the data file to which the tablespace belongs;
RMAN> restore (tablespace users );
3.3: tablespace recovery process;
RMAN> recover tablespace users;
3.4: Table space online process;
RMAN> SQL 'alter tablespace users online ';
<3>: backup and recovery of data files; the database must work in the archive log mode;
1. Back up data files;
RMAN> Backup (datafile 'd: oracleoradatadbnameusers01.dbf ');
2. Back up all archived log files;
RMAN> Backup (archivelog all Delete input );
3: data file recovery;
3.1: remove the tablespace users to which the data file belongs;
RMAN> SQL 'alter tablespace users offline immediate ';
3.2: process of restoring data files;
RMAN> restore (datafile 'd: oracleoradatadbnameusers01.dbf ');
3.3: data file recovery process;
RMAN> recover datafile 'd: oracleoradatadbnameusers01.dbf ';
3.4 The tablespace to which the data file belongs is online;
RMAN> SQL 'alter tablespace users online ';
OK;