RMANバックアップ
4990 ワード
RMANバックアップの概要
[oracle@XAG128 ~]$ rman target c##backup_admin/xag123;
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name MPCDB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 1 G MAXOPENFILES 8 RATE 100 M;
CONFIGURE CHANNEL 1 DEVICE TYPE DISK MAXPIECESIZE 2 G MAXOPENFILES 16 RATE 200 M;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 6 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.2.0/db_1/dbs/snapcf_MPCDB.f'; # default
#
RMAN> backup device type disk database;
# tag='bak_2'
RMAN>
backup device type disk tag 'bak_1' as compressed backupset database;
or
backup device type disk tag='bak_1' as compressed backupset database;
#
RMAN> backup device type disk tag='bak_3' as compressed backupset database skip readonly;
# , (delete input configure archivelog deletion policy to backed up 2 times to device type disk )
RMAN> backup archivelog all not backed up 2 times delete input;
RMAN> backup tag='arc_1' archivelog all not backed up 2 times delete input;
# ,delete input (delete input configure archivelog deletion policy to backed up 2 times to device type disk )
RMAN> backup device type disk tag='bak5' as compressed backupset database skip readonly plus archivelog not backed up 2 times delete input;
RMAN> backup device type disk tag='bak7' as compressed backupset database include current controlfile skip readonly plus archivelog not backed up 2 times delete input;
or
backup device type disk tag='bak7' as compressed backupset database include current controlfile skip readonly;
backup device type disk tag='arc7' archivelog from time 'sysdate - 1';
RMAN> delete noprompt obsolete redundancy = 2 device type disk;
# 2
delete noprompt archivelog all completed before 'trunc(sysdate)-2';
#
RMAN> list backup of spfile;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
...
362 Full 18.03M DISK 00:00:00 2018:12:1518:39:31
BP Key: 362 Status: AVAILABLE Compressed: NO Tag: TAG20181215T183931
Piece Name: /u03/fra/MPCDB/autobackup/2018_12_15/o1_mf_s_994963171_g19ph3bf_.bkp
SPFILE Included: Modification time: 2018:12:1518:37:12
SPFILE db_unique_name: MPCDB
#
RMAN> list backup of controlfile;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
...
362 Full 18.03M DISK 00:00:00 2018:12:1518:39:31
BP Key: 362 Status: AVAILABLE Compressed: NO Tag: TAG20181215T183931
Piece Name: /u03/fra/MPCDB/autobackup/2018_12_15/o1_mf_s_994963171_g19ph3bf_.bkp
Control File Included: Ckp SCN: 1948014 Ckp time: 2018:12:1518:39:31
[oracle@XAG128 ~]$ mkdir rman_log/
[oracle@XAG128 ~]$ cat backup1.cmd
backup device type disk tag=&1 archivelog from time 'sysdate - 1';
quit
[oracle@XAG128 ~]$ cat backup1.sh
#!/bin/bash
baktime=`date "+%Y%m%d_%H%M"`
logfile=/home/oracle/rman_log/$baktime.log
tag=arc_$baktime
rman target c##backup_admin/xag123 @backup1.cmd using $tag log=$logfile
[oracle@XAG128 ~]$ chmod +x backup1.sh
[oracle@XAG128 ~]$ ls
backup1.cmd backup1.sh rman_log
[oracle@XAG128 ~]$ ./backup1.sh
RMAN> 2>
[oracle@XAG128 ~]$ ls /home/oracle/rman_log/
20181216_1310.log