oracle 归档日志清理

oracle 归档日志清理

归档日志检查

  1. 查看设置的归档日志大小

    1
    2
    3
    4
    5
    6
    SQL> show parameter db_recovery_file_dest_size;
    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    db_recovery_file_dest_size big integer 600G
  2. 查看已使用大小

    1
    2
    3
    4
    5
    SQL> select sum(a.BLOCK_SIZE*a.BLOCKS)/1024/1024 as userSize from v$archived_log a where a.DELETED='NO';
    SUM(A.BLOCK_SIZE*A.BLOCKS)/1024/1024
    ------------------------------------
    614363.783
  3. 查看归档日志保存地址

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    -- 查看 归档日志基本信息
    SQL> archive log list;
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 20931
    Next log sequence to archive 20931
    Current log sequence 20933
    -- 查看archive destination的值,查看是删除USE_
    SQL> archive log list;
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 20931
    Next log sequence to archive 20931
    Current log sequence 20933
    -- 查看位置及使用大小
    SQL> show parameter DB_RECOVERY_FILE_DEST
    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    db_recovery_file_dest string /home/oracle/app/flash_recovery_area
    db_recovery_file_dest_size big integer 600G
  4. 2

oracle 归档日志处理 已满 处理方式

扩展归档日志大小
  1. 更改归档日志大小

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    -- 切换到oracle用户
    su - oracle
    -- 登陆oracle
    sqlplus /nolog
    conn /as sysdba
    -- 设置归档日志大小
    alter system set db_recovery_file_dest_size=5G scope=spfile;
    -- 重启oracle
    -- 关闭
    shutdown immediate
    -- 打开
    startup
删除以前的归档日志
  1. 进入rman命令状态

    [oracle@localhost ~]$ rman target/

  2. 查看所有LOG文件

    RMAN> crosscheck archivelog all;

  3. 删除所有LOG文件

    RMAN> delete archivelog all; (或者删除前10天的日志 DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-10'; )

分享到 评论