RMAN delete noprompt obsoleteパラメータ研究
29822 ワード
RMAN delete noprompt obsoleteパラメータ研究
テストの結果、delete noprompt obsolete;RMANの保存ポリシーのみを参照して、T 0時点で複数のアーカイブログが存在する場合、T 1時点でRMANの完全な準備が完了した場合、report obsolete;T 0時点のアーカイブ・ログはいずれも期限切れとマークされ、保存ポリシーRMANに従ってアーカイブ・ログがクリーンアップされます.
備考: 0 、1 , 1 , 0 、 ,0 1
具体的なテストは以下の通りです.
1、複数回ログを切るSQL>alter system switch logfile;
SQL>alter system switch logfile;
SQL>alter system switch logfile;
SQL>alter system switch logfile;
2、アーカイブログファイルの表示[root@ora19c arch]# ll
total 30236
-rw-r----- 1 ora11g oinstall 30945792 May 16 10:10 1_400_1002014785.dbf
-rw-r----- 1 ora11g oinstall 1024 May 16 10:10 1_401_1002014785.dbf
-rw-r----- 1 ora11g oinstall 1024 May 16 10:10 1_402_1002014785.dbf
-rw-r----- 1 ora11g oinstall 1024 May 16 10:10 1_403_1002014785.dbf
3、RMAN完備RMAN> backup database format '/u02/rman/full_db_%U_%T.bak' tag=full_db;
Starting backup at 2019-05-16 10:10:56
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u02/app/oracle/oradata/orcl/ADMIN_5.dbf
input datafile file number=00001 name=/u02/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u02/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u02/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/u02/app/oracle/oradata/orcl/users01.dbf
input datafile file number=00006 name=/u02/app/oracle/oradata/orcl/TBS_6.dbf
input datafile file number=00007 name=/u02/app/oracle/oradata/orcl/TBS_INDEX_7.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-16 10:10:56
channel ORA_DISK_1: finished piece 1 at 2019-05-16 10:13:03
piece handle=/u02/rman/full_db_12u1m8dg_1_1_20190516.bak tag=FULL_DB comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2019-05-16 10:13:04
channel ORA_DISK_1: finished piece 1 at 2019-05-16 10:13:05
piece handle=/u02/rman/full_db_13u1m8hf_1_1_20190516.bak tag=FULL_DB comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2019-05-16 10:13:05
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
28 Full 4.19G DISK 00:02:02 2019-05-16 10:12:58
BP Key: 28 Status: AVAILABLE Compressed: NO Tag: FULL_DB
Piece Name: /u02/rman/full_db_12u1m8dg_1_1_20190516.bak
List of Datafiles in backup set 28
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/system01.dbf
2 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/users01.dbf
5 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/ADMIN_5.dbf
6 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/TBS_6.dbf
7 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/TBS_INDEX_7.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
29 Full 9.58M DISK 00:00:02 2019-05-16 10:13:05
BP Key: 29 Status: AVAILABLE Compressed: NO Tag: FULL_DB
Piece Name: /u02/rman/full_db_13u1m8hf_1_1_20190516.bak
SPFILE Included: Modification time: 2019-05-13 15:33:28
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 16286604902494 Ckp time: 2019-05-16 10:13:03
4、期限切れバックアップの表示RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 395 2019-05-16 10:10:02 /u02/arch/1_400_1002014785.dbf
Archive Log 396 2019-05-16 10:10:11 /u02/arch/1_401_1002014785.dbf
Archive Log 397 2019-05-16 10:10:12 /u02/arch/1_402_1002014785.dbf
Archive Log 398 2019-05-16 10:10:13 /u02/arch/1_403_1002014785.dbf
,
5、期限切れバックアップの削除RMAN> delete noprompt obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 395 2019-05-16 10:10:02 /u02/arch/1_400_1002014785.dbf
Archive Log 396 2019-05-16 10:10:11 /u02/arch/1_401_1002014785.dbf
Archive Log 397 2019-05-16 10:10:12 /u02/arch/1_402_1002014785.dbf
Archive Log 398 2019-05-16 10:10:13 /u02/arch/1_403_1002014785.dbf
deleted archived log
archived log file name=/u02/arch/1_400_1002014785.dbf RECID=395 STAMP=1008411002
deleted archived log
archived log file name=/u02/arch/1_401_1002014785.dbf RECID=396 STAMP=1008411011
deleted archived log
archived log file name=/u02/arch/1_402_1002014785.dbf RECID=397 STAMP=1008411012
deleted archived log
archived log file name=/u02/arch/1_403_1002014785.dbf RECID=398 STAMP=1008411013
Deleted 4 objects
6、アーカイブログの再表示[root@ora19c arch]# ll -hrt
total 0
RMAN> list archivelog all;
specification does not match any archived log in the repository
まとめ:T1 RMAN , T1 、 、
SQL>alter system switch logfile;
SQL>alter system switch logfile;
SQL>alter system switch logfile;
SQL>alter system switch logfile;
[root@ora19c arch]# ll
total 30236
-rw-r----- 1 ora11g oinstall 30945792 May 16 10:10 1_400_1002014785.dbf
-rw-r----- 1 ora11g oinstall 1024 May 16 10:10 1_401_1002014785.dbf
-rw-r----- 1 ora11g oinstall 1024 May 16 10:10 1_402_1002014785.dbf
-rw-r----- 1 ora11g oinstall 1024 May 16 10:10 1_403_1002014785.dbf
RMAN> backup database format '/u02/rman/full_db_%U_%T.bak' tag=full_db;
Starting backup at 2019-05-16 10:10:56
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u02/app/oracle/oradata/orcl/ADMIN_5.dbf
input datafile file number=00001 name=/u02/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u02/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u02/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/u02/app/oracle/oradata/orcl/users01.dbf
input datafile file number=00006 name=/u02/app/oracle/oradata/orcl/TBS_6.dbf
input datafile file number=00007 name=/u02/app/oracle/oradata/orcl/TBS_INDEX_7.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-16 10:10:56
channel ORA_DISK_1: finished piece 1 at 2019-05-16 10:13:03
piece handle=/u02/rman/full_db_12u1m8dg_1_1_20190516.bak tag=FULL_DB comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2019-05-16 10:13:04
channel ORA_DISK_1: finished piece 1 at 2019-05-16 10:13:05
piece handle=/u02/rman/full_db_13u1m8hf_1_1_20190516.bak tag=FULL_DB comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2019-05-16 10:13:05
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
28 Full 4.19G DISK 00:02:02 2019-05-16 10:12:58
BP Key: 28 Status: AVAILABLE Compressed: NO Tag: FULL_DB
Piece Name: /u02/rman/full_db_12u1m8dg_1_1_20190516.bak
List of Datafiles in backup set 28
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/system01.dbf
2 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/users01.dbf
5 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/ADMIN_5.dbf
6 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/TBS_6.dbf
7 Full 16286604902445 2019-05-16 10:10:56 /u02/app/oracle/oradata/orcl/TBS_INDEX_7.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
29 Full 9.58M DISK 00:00:02 2019-05-16 10:13:05
BP Key: 29 Status: AVAILABLE Compressed: NO Tag: FULL_DB
Piece Name: /u02/rman/full_db_13u1m8hf_1_1_20190516.bak
SPFILE Included: Modification time: 2019-05-13 15:33:28
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 16286604902494 Ckp time: 2019-05-16 10:13:03
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 395 2019-05-16 10:10:02 /u02/arch/1_400_1002014785.dbf
Archive Log 396 2019-05-16 10:10:11 /u02/arch/1_401_1002014785.dbf
Archive Log 397 2019-05-16 10:10:12 /u02/arch/1_402_1002014785.dbf
Archive Log 398 2019-05-16 10:10:13 /u02/arch/1_403_1002014785.dbf
,
RMAN> delete noprompt obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 395 2019-05-16 10:10:02 /u02/arch/1_400_1002014785.dbf
Archive Log 396 2019-05-16 10:10:11 /u02/arch/1_401_1002014785.dbf
Archive Log 397 2019-05-16 10:10:12 /u02/arch/1_402_1002014785.dbf
Archive Log 398 2019-05-16 10:10:13 /u02/arch/1_403_1002014785.dbf
deleted archived log
archived log file name=/u02/arch/1_400_1002014785.dbf RECID=395 STAMP=1008411002
deleted archived log
archived log file name=/u02/arch/1_401_1002014785.dbf RECID=396 STAMP=1008411011
deleted archived log
archived log file name=/u02/arch/1_402_1002014785.dbf RECID=397 STAMP=1008411012
deleted archived log
archived log file name=/u02/arch/1_403_1002014785.dbf RECID=398 STAMP=1008411013
Deleted 4 objects
[root@ora19c arch]# ll -hrt
total 0
RMAN> list archivelog all;
specification does not match any archived log in the repository