DM8重做日志管理与归档打开与关闭管理

折月煮酒 提交于 2020-03-03 08:21:47

日志操作

查看日志局域
SQL> select file_id,path,rlog_size/1024/1024 as "Size" from V$RLOGFILE;

LINEID     FILE_ID     PATH                                Size                
---------- ----------- ----------------------------------- --------------------
1          0           /dm/dmdbms/data/DAMENG/DAMENG01.log 256
2          1           /dm/dmdbms/data/DAMENG/DAMENG02.log 256

used time: 2.093(ms). Execute id is 9.
查看当前使用日志
SQL> select cur_file from V$RLOG;

LINEID     CUR_FILE   
---------- -----------
1          0

used time: 0.502(ms). Execute id is 10.

添加日志语句
SQL> alter database add logfile '/dm/dmdbms/data/DAMENG/DAMENG03.log' size 128;
executed successfully
used time: 24.975(ms). Execute id is 11.
SQL> select file_id,path,rlog_size/1024/1024 as "Size" from V$RLOGFILE;

LINEID     FILE_ID     PATH                                Size                
---------- ----------- ----------------------------------- --------------------
1          0           /dm/dmdbms/data/DAMENG/DAMENG01.log 256
2          1           /dm/dmdbms/data/DAMENG/DAMENG02.log 256
3          2           /dm/dmdbms/data/DAMENG/DAMENG03.log 128

used time: 0.273(ms). Execute id is 12.

对日志文件进行resize
SQL>  alter database resize logfile '/dm/dmdbms/data/DAMENG/DAMENG03.log' to 256;
executed successfully
used time: 3.970(ms). Execute id is 13.
SQL> select file_id,path,rlog_size/1024/1024 as "Size" from V$RLOGFILE;

LINEID     FILE_ID     PATH                                Size                
---------- ----------- ----------------------------------- --------------------
1          0           /dm/dmdbms/data/DAMENG/DAMENG01.log 256
2          1           /dm/dmdbms/data/DAMENG/DAMENG02.log 256
3          2           /dm/dmdbms/data/DAMENG/DAMENG03.log 256

used time: 0.243(ms). Execute id is 14.

采用命令行进行开启归档

alter database mount;
alter database add archivelog 'DEST=/dm/dmarch,TYPE=local,FILE_SIZE=256,space_limit=0';
alter database archivelog;
alter database open;

SQL> alter database mount;
executed successfully
used time: 00:00:01.744. Execute id is 0.
SQL> alter database add archivelog 'DEST=/dm/dmarch,TYPE=local,FILE_SIZE=256,space_limit=0';
executed successfully
used time: 1.925(ms). Execute id is 0.
SQL> alter database archivelog;
executed successfully
used time: 11.557(ms). Execute id is 0.
SQL> alter database open;
executed successfully
used time: 00:00:01.732. Execute id is 0.
SQL> select arch_mode from v$database;

LINEID     ARCH_MODE
---------- ---------
1          Y

used time: 1.970(ms). Execute id is 4.

 采用配置文件配置归档模式

[dmdba@dm1 DAMENG]$ cat dm.ini |grep ARCH_INI
                ARCH_INI                        = 1                     #dmarch.ini
[dmdba@dm1 DAMENG]$ cat dmarch.ini 
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY      = 1        

[ARCHIVE_LOCAL1]
        ARCH_TYPE            = LOCAL        
        ARCH_DEST            = /dm/dmarch        
        ARCH_FILE_SIZE       = 256        
        ARCH_SPACE_LIMIT     = 0        

 关闭归档:

alter database mount;
alter database noarchivelog;
alter database open;

SQL> alter database mount;
executed successfully
used time: 00:00:01.751. Execute id is 0.
SQL> alter database noarchivelog;
executed successfully
used time: 33.369(ms). Execute id is 0.
SQL> alter database open;
executed successfully
used time: 00:00:01.724. Execute id is 0.

SQL> select arch_mode from v$database;

LINEID     ARCH_MODE
---------- ---------
1          N

 

[dmdba@dm1 DAMENG]$ cat dm.ini |grep ARCH_INI
                ARCH_INI                        = 0                     #dmarch.ini

图形化开关归档

 

 

 几个关键视图

V$RLOG 、V$RLOGFILE、V$ARCHIVED_LOG

SQL> desc V$RLOG

LINEID     NAME           TYPE$   NULLABLE
---------- -------------- ------- --------
1          CKPT_LSN       BIGINT  Y
2          FILE_LSN       BIGINT  Y
3          FLUSH_LSN      BIGINT  Y
4          CUR_LSN        BIGINT  Y
5          NEXT_SEQ       BIGINT  Y
6          N_MAGIC        INTEGER Y
7          DB_MAGIC       BIGINT  Y
8          FLUSH_PAGES    INTEGER Y
9          FLUSHING_PAGES INTEGER Y
10         CUR_FILE       INTEGER Y
11         CUR_OFFSET     BIGINT  Y
12         CKPT_FILE              INTEGER     Y
13         CKPT_OFFSET            BIGINT      Y
14         FREE_SPACE             BIGINT      Y
15         TOTAL_SPACE            BIGINT      Y
16         SUSPEND_TIME           DATETIME(6) Y
17         UPD_CTL_LSN            BIGINT      Y
18         N_RESERVE_WAIT         INTEGER     Y
19         TOTAL_FLUSH_PAGES      BIGINT      Y
20         TOTAL_FLUSH_TIMES      BIGINT      Y
21         TOTAL_ECPR_FLUSH_PAGES BIGINT      Y
22         GLOBAL_NEXT_SEQ        BIGINT      Y

LINEID     NAME                  TYPE$       NULLABLE
---------- --------------------- ----------- --------
23         N_PRIMAY_EP           INTEGER     Y
24         PRIMARY_DB_MAGIC      BIGINT      Y
25         CKPT_N_PRIMAY_EP      INTEGER     Y
26         CKPT_PRIMARY_DB_MAGIC BIGINT      Y
27         MIN_EXEC_VER          VARCHAR(64) Y
28         MIN_DCT_VER           INTEGER     Y

28 rows got


SQL> desc V$RLOGFILE

LINEID     NAME         TYPE$        NULLABLE
---------- ------------ ------------ --------
1          GROUP_ID     INTEGER      Y
2          FILE_ID      INTEGER      Y
3          PATH         VARCHAR(256) Y
4          CLIENT_PATH  VARCHAR(256) Y
5          CREATE_TIME  DATETIME(6)  Y
6          RLOG_SIZE    BIGINT       Y
7          MIN_EXEC_VER VARCHAR(64)  Y
8          MIN_DCT_VER  INTEGER      Y

8 rows got

used time: 6.346(ms). Execute id is 7.
SQL> desc V$ARCHIVED_LOG

LINEID     NAME              TYPE$        NULLABLE
---------- ----------------- ------------ --------
1          RECID             INTEGER      Y
2          STAMP             INTEGER      Y
3          NAME              VARCHAR(513) Y
4          DEST_ID           INTEGER      Y
5          THREAD#           BIGINT       Y
6          SEQUENCE#         INTEGER      Y
7          RESETLOGS_CHANGE# INTEGER      Y
8          RESETLOGS_TIME    DATETIME(6)  Y
9          RESETLOGS_ID      INTEGER      Y
10         FIRST_CHANGE#     BIGINT       Y
11         FIRST_TIME        DATETIME(6)  Y
12         NEXT_CHANGE# BIGINT      Y
13         NEXT_TIME    DATETIME(6) Y
14         BLOCKS       INTEGER     Y
15         BLOCK_SIZE   INTEGER     Y
16         CREATOR      VARCHAR(7)  Y
17         REGISTRAR    VARCHAR(7)  Y
18         STANDBY_DEST VARCHAR(3)  Y
19         ARCHIVED     VARCHAR(3)  Y
20         APPLIED      VARCHAR(9)  Y
21         DELETED      VARCHAR(3)  Y
22         STATUS       VARCHAR(1)  Y

LINEID     NAME                  TYPE$       NULLABLE
---------- --------------------- ----------- --------
23         COMPLETION_TIME       DATETIME(6) Y
24         DICTIONARY_BEGIN      VARCHAR(3)  Y
25         DICTIONARY_END        VARCHAR(3)  Y
26         END_OF_REDO           VARCHAR(3)  Y
27         BACKUP_COUNT          INTEGER     Y
28         ARCHIVAL_THREAD#      INTEGER     Y
29         ACTIVATION#           INTEGER     Y
30         IS_RECOVERY_DEST_FILE VARCHAR(3)  Y
31         COMPRESSED            VARCHAR(3)  Y
32         FAL                   VARCHAR(3)  Y
33         END_OF_REDO_TYPE      VARCHAR(10) Y
34         BACKED_BY_VSS VARCHAR(3)   Y
35         ARCH_TYPE     VARCHAR(128) Y
36         EP_SEQNO      INTEGER      Y
37         ARCH_SEQ      BIGINT       Y
38         NEXT_SEQ      BIGINT       Y
39         VERSION       BIGINT       Y

39 rows got

used time: 8.665(ms). Execute id is 8.

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!