1. Switch the server archive mode. skip this step if the archive mode is already used:
% Sqlplus/nolog (start sqlplus)
SQL> conn/as sysdba (connect to the database as DBA)
SQL> shutdown immediate; (close the database immediately)
SQL> startup mount (start the instance and load the database, but do not open it)
SQL> alter database archivelog; (change the database to archive Mode)
SQL> alter database open; (open the database)
SQL> alter system archive log start; (enable automatic archiving)
SQL> exit (exit)
2. Connection:
% Rman target = rman/rman @ mydb (start recovery Manager)
3. Basic settings:
RMAN> configure default device type to disk; (set the default backup device to disk)
RMAN> configure device type disk parallelism 2; (sets the parallel backup level and number of channels)
RMAN> configure channel 1 device type disk fromat '/backup1/backup _ % U'; (sets the backup file format, only applicable to disk devices)
RMAN> configure channel 2 device type disk fromat '/backup2/backup _ % U'; (sets the backup file format, only applicable to disk devices)
RMAN> configure controlfile autobackup on; (enable automatic backup of control file and server parameter file)
RMAN> configure controlfile autobackup format for device type disk to '/backup1/ctl _ % F'; (sets the file format for automatic backup of control files and server parameter files)
4. view all settings:
5. view the database solution report:
6. Full backup:
RMAN> backup database plus archivelog delete input; (back up full-database and control files, server parameter files, and all archived redo logs, and delete old archive logs)
7. Backup tablespace:
RMAN> backup tablespace system plus archivelog delete input; (backup the specified tablespace and archived redo logs, and delete the old archived logs)
8. Back up archived logs:
RMAN> backup archivelog all delete input; |
9. Copy data files:
RMAN> copy datafile 1 to '/oracle/dbs/system.copy'; |
10. View backups and duplicate files:
11. Verify backup:
RMAN> validate backupset 3; |