Show all;
Display default rman settings
List the data files in the database that need to be backed up:
Report need backup;
1. Obsolete backup and copy reports (that is, useless backup sets are displayed based on rman redundancy)
Report obsolete;
2. display the backup set list
List backup;
Delete expired backup Sets
Delete backupset n;
If the file in the operating system has been deleted and the backup information is still in progress, perform crosscheck first, and then delete expired to clear the incorrect backup information.
Crosscheck backuppiece 8;
Then delete backuppiece 8;
Archive logs are deleted physically. When rman is used to back up archive logs, the archived logs do not exist.
Change archivelog all crosscheck;
Crosscheck archivelog all;
Delete expired archivelog all;
3. Restore spfile
Restore spfile to pfile 'e: \ rmanbk \ pfile. ora 'from autobackup;
4. Restore control file:
RMAN> restore controlfile from 'e: \ rmanbk \ cf_ora9_20_0000573229179_20051101 ';
RMAN> run {
2> restore controlfile to 'e: \ rmanbk \ controlfilebak. ora 'from autobackup; (because the control file is recovered, you must specify to recover from the backup control file)
3> replicate controlfile from 'e: \ rmanbk \ controlfilebak. ora ';
4>}
5. Command Format for rman backup:
1). Allocation channel (allocate channel c1 type disk)
2). backup and backup Types (incremental level =, 4)
3). tags can add personalized tags.
4). format backup set path and Command format
5). Backup content (database...), (tablespace tools, system...), (archivelog all delete input)
6. Make a full backup of the database:
Run {
Allocate channel c1 type disk;
Backup incremental level = 0
Format 'e: \ rmanbk \ % d _ % p _ % t'
(Database );
}
Run {
Allocate channel c1 type disk;
Backup full
Format 'e: \ rmanbk \ % d _ % p _ % t'
(Database );
}
7. Back up archived logs:
Run {
Allocate channel c1 type disk;
Backup format 'e: \ rmanbk \ archlog _ % d _ % p _ % t'
(Archivelog all );
}
7. Back up archive logs (delete archive logs after backup ):
Run {
Allocate channel c1 type disk;
Backup
Tag 'ora9 _ archivelog_2004_11_16'
Format 'e: \ rmanbk \ archlog _ % d _ % p _ % t'
(Archivelog all delete input );
}
Query database files that need to be restored (required when restoring data files)
Select * from v $ revocer_file;
Select a. name, B. error from v $ dbfile a, v $ recover_file B where a. file # = B. file #;
Restore the entire database (you can also use it to restore files in the database)
Run {
Allocate channel c1 type disk;
Restore database;
Recover database;
}
Restore a lost data file:
Run {
Allocate channel c1 type disk;
Restore datafile 10;
Recover datafile 10;
SQL "alter database datafile 10 online ";
}
Restore a lost data table space:
Run {
Allocate channel c1 type disk;
Restore tablespace test;
Recover tablespace test;
SQL "alter tablespace test online ";
}
Incomplete recovery includes restoration based on time points, SCN, and Log Sequence.
Incomplete recovery based on system change numbers
Run {
Allocate channel c1 type disk;
Set until scn 123456;
Restore database;
Recover database;
SQL "alter database open resetlogs ";
}
Time-based Incomplete recovery
Run {
Allocate channel c1 type disk;
Set until time "TO_DATE ('2017-11-22 16:10:54 ', 'yyyy-mm-dd hh24: mi: ss ')";
Restore database;
Recover database;
SQL "alter database open resetlogs ";
}
Restore Based on Time points
RMAN> run
2> {allocate channel d1 type disk;
3> restore database until time '2017-03-30 16:13:54 ';
4> recover database;
5> release channel d1;
6>}