美文网首页
归档模式

归档模式

作者: 个人精进成长营 | 来源:发表于2021-06-28 08:59 被阅读0次

1:归档日志文件

      在线日志 ——用于崩溃/实例恢复/介质恢复

      归档日志 ——用于介质恢复

2:确认数据库是否为归档模式

  archive log list;  --查看数据归档信息

  select log_mode from v$database;  --查看数据库是否为归档模式

3:归档模式和非归档模式的相互切换

  alter database noarchivelog;--数据库切换成非归档模式(MOUNT)

  alter database archivelog;  --数据库切换成归档模式(MOUNT)

4:归档文件的位置和名字

  standby_archive_dest

  归档文件名称log_archive_format %t_%s_%r.dbf --归档文件名称

  archive_lag_target=0 表示禁用基于时间的日志切换功能

log_archive_config  dataguard时候使用

log_archive_dest    主

log_archive_duplex_dest  从

log_archive_duplex_dest 

log_archive_dest_1='location=/opt/soft/archive_dest'

                    service

  alter system set log_archive_dest_1='location=/opt/soft/archive_dest' scope=spfile;

5:删除归档文件

  5.1)手动删除

  SQL>archive log list;

  rman target /

  RMAN>backup archivelog all;

  cd /opt/soft/archive_dest

  rm -f 1_*906824971.dbf

  rman target /

  RMAN>list archivelog all;

  RMAN>crosscheck archivelog all;

  RMAN>delete  expired archivelog all;

  RMAN>delete  noprompt expired archivelog all;

  5.2)自动删除

      RMAN>delete archivelog all completed before 'SYSDATE-2';删除两条前的归档日志,不备份

      SQL>select * from v$archived_log  where status='A'

          cd /opt/soft/archive_dest/

          ls

      RMAN>backup archivelog all delete all input;

            cd /opt/soft/archive_dest/

            ls

7:归档相关视图

    v$archived_log        -->从控制文件中获得归档的相关信息

    v$archive_dest        -->归档路径及状态

    v$log_history          -->控制文件中日志的历史信息

    v$database            -->查看数据库是否处于归档状态

    v$archive_processes    -->归档相关的后台进程信息

8:归档平率

SELECT trunc(first_time) "Date",

        to_char(first_time, 'Dy') "Day",

        count(1) "Total",

        SUM(decode(to_char(first_time, 'hh24'),'00',1,0)) "h0",

        SUM(decode(to_char(first_time, 'hh24'),'01',1,0)) "h1",

        SUM(decode(to_char(first_time, 'hh24'),'02',1,0)) "h2",

        SUM(decode(to_char(first_time, 'hh24'),'03',1,0)) "h3",

        SUM(decode(to_char(first_time, 'hh24'),'04',1,0)) "h4",

        SUM(decode(to_char(first_time, 'hh24'),'05',1,0)) "h5",

        SUM(decode(to_char(first_time, 'hh24'),'06',1,0)) "h6",

        SUM(decode(to_char(first_time, 'hh24'),'07',1,0)) "h7",

        SUM(decode(to_char(first_time, 'hh24'),'08',1,0)) "h8",

        SUM(decode(to_char(first_time, 'hh24'),'09',1,0)) "h9",

        SUM(decode(to_char(first_time, 'hh24'),'10',1,0)) "h10",

        SUM(decode(to_char(first_time, 'hh24'),'11',1,0)) "h11",

        SUM(decode(to_char(first_time, 'hh24'),'12',1,0)) "h12",

        SUM(decode(to_char(first_time, 'hh24'),'13',1,0)) "h13",

        SUM(decode(to_char(first_time, 'hh24'),'14',1,0)) "h14",

        SUM(decode(to_char(first_time, 'hh24'),'15',1,0)) "h15",

        SUM(decode(to_char(first_time, 'hh24'),'16',1,0)) "h16",

        SUM(decode(to_char(first_time, 'hh24'),'17',1,0)) "h17",

        SUM(decode(to_char(first_time, 'hh24'),'18',1,0)) "h18",

        SUM(decode(to_char(first_time, 'hh24'),'19',1,0)) "h19",

        SUM(decode(to_char(first_time, 'hh24'),'20',1,0)) "h20",

        SUM(decode(to_char(first_time, 'hh24'),'21',1,0)) "h21",

        SUM(decode(to_char(first_time, 'hh24'),'22',1,0)) "h22",

        SUM(decode(to_char(first_time, 'hh24'),'23',1,0)) "h23",

        decode(trunc(first_time),

              trunc(sysdate), round(count(1) / (24 * to_number(to_char(sysdate, 'sssss')+1) / 86400),2),

              round(count(1) / 24, 2)) "Avg"

FROM V$log_history

group by trunc(first_time), to_char(first_time, 'Dy')

Order by 1;

9 增加日志组和成员

创建新的日志组

alter database add logfile group 4 ('/opt/oracle/oradata/WEISIDB/redo04.log') size 100m;

增加日志成员

alter database add logfile member '/opt/oracle/oradata/WEISIDB/redo04_02.log' to group 4;

删除日志组

alter database drop logfile group 1;

10 切换归档模式步骤

    1:关闭数据库

          shutdown immediate;

    2:  启动到mount

          startup mount;

    3:  修改成归档模式

          alter database archivelog;

    4: 打开数据库

          alter database open ;

    5:全备数据库 

         backup database plus archivelog delete input; (备份全库及控制文件、服务器参数文件与所有归档的重做日志,并删除旧的归档日志)

相关文章

  • rman备份

    一、数据库备份与RMAN备份的概念 1.数据库完全备份:按归档模式分为归档和非归档 归档模式 ...

  • Oracle归档日志

    显示归档日志信息 1,使用ARCHIVE LOG LIST命令可以显示日志操作模式,归档位置,自动归档机器要归档的...

  • 归档模式

    1:归档日志文件 在线日志 ——用于崩溃/实例恢复/介质恢复 归档日志 ——用于介质恢复 2:确认数据...

  • 阿里云将归档文件转为标准模式 2021-09-14

    ①测试转为归档模式 阿里云将归档文件转为标准模式 ①解冻操作,执行如下命令: https://help.aliyu...

  • Oracle 数据库命令操作整理

    1、切换服务器归档模式,如果已经是归档模式可跳过此步:%sqlplus /nolog (启动sqlplus...

  • Oracle数据字典

    1.查看数据库归档模式 ARCHIVELOG:归档模式 2.查看redo日志大小 oracle的全局索引(glob...

  • oracle开启归档模式

    1:查看数据库归档模式是否开启archive log list; disabled说明数据库不是归档模式,则需要将...

  • oracle(rac 非cdb) flink cdc配置

    oracle rac开启日志归档 非CBD数据库 1、 开启归档 1.1、查看归档模式 未开启响应 1.2、设...

  • Oracle归档模式与非归档模式

    转至:http://blog.sunansheng.com/2016/04/29/archivelog-noarc...

  • Oracle归档日志操作

    查询日志的归档模式: 查询归档日志的信息: 查询正在使用的组所对应的日志文件: 查看归档信息:

网友评论

      本文标题:归档模式

      本文链接:https://www.haomeiwen.com/subject/eqtqultx.html