1. Separate backup
1. Classic full-database backup: backup as compressed backupset database include current controlfile plus archivelog delete all input;
2. tablespace: name of the backup tablespace;
3. Data File: backup datafile n; (n: Data File No. select file_name, file_id, tablespace_name from dba_data_files ;)
4. Control File: backup current controlfile; or backup database include current controlfile;
5. Log File: backup archivelog all; or database plus archivelog;
6. parameter file: backup spfile;
7. Full-database backup script:
Copy codeThe Code is as follows:
Run {
Allocate channel c1 type disk;
Backup full tag 'dbfull' format'/backup/full % u _ % s _ % P' database
Include current controlfile;
SQL 'alter system archive log current'; # After the database is fully backed up, you need to execute this command to archive the current log. The last generated archive should be included in the backup and archiving logs.
Backup filesperset 3 format'/backup/arch % u _ % s _ % P' # filesperset 3 sets no more than three files in each backup set
Archivelog all delete input; # backup archiving is optional and can be backed up regularly separately
Release channel c1;
}
Ii. Incremental Backup
1. Level 0 Incremental Backup
Copy codeThe Code is as follows:
Run {
Allocate channel c1 type disk;
Backup incremental level 0 tag 'db0' format'/backup/db0 % u _ % s _ % P' database
Include current controlfile ;;
SQL 'alter system archive log current'; # After the database is fully backed up, you need to execute this command to archive the current log. The last generated archive should be included in the backup and archiving logs.
Backup filesperset 3 format'/backup/arch % u _ % s _ % P' # filesperset 3 sets no more than three files in each backup set
Archivelog all delete input; # backup archiving is optional and can be backed up regularly separately
Release channel c1;
}
2. Level 1 backup script
Copy codeThe Code is as follows:
Run {
Allocate channel c1 type disk;
Backup incremental level 1 tag 'db1' format'/backup/db1 % u _ % s _ % P'
Database skip readonly include current controlfile;
Backup filesperset 3 format'/backup/arch % u _ % s _ % P' # filesperset sets no more than three files in each backup set
Archivelog all delete input; # backup archiving is optional and can be backed up regularly separately
Release channel c1;
}