DM7联机执行SQL语句进行表备份

联机执行SQL语句进行表备份
下面将介绍使用DIsql完成表备份及实施一些备份策略,如限制备份集大小、加密备份等。主要内容包括:
1. 概述
2. 设置备份选项
3. 备份表

与备份数据库与表空间不同,备份表不需要服务器配置归档,DIsql中输入以下即可备份用户表:

SQL> backup table t1 backupset 'tab_t1_bak_01';
executed successfully
used time: 00:00:14.215. Execute id is 77.

SQL> select * from v$backupset where backup_path like '+DMDATA/data/rac/bak/tab%';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                   BACKUP_PATH                        TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ----------------------------- ---------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        -1366932633 -1          TAB_T1_20200529_144738_000092 +DMDATA/data/rac/bak/tab_t1_bak_01 2           0           3           SYSDBA.T1   -1                    2020-05-29 14:47:45.000864        0            0              0           0           33554432    50908                51025                1           0           1            0           0           49398                117507596    0

used time: 00:00:01.064. Execute id is 79.

备份集“tab_t1_bak_01”会生成到默认的备份路径下。如要设置其他备份选项需参考下文的备份表语法。
语法如下:

BACKUP TABLE < 表名>
[TO < 备份名>]
BACKUPSET ['< 备份集路径>'] [DEVICE TYPE < 介质类型> [PARMS '< 介质参数>']]
[BACKUPINFO '< 备份集描述>']
[MAXPIECESIZE < 备份片限制大小>]
[IDENTIFIED BY < 加密密码>[WITH ENCRYPTION][ENCRYPT WITH < 加密算法>]]
[COMPRESSED [LEVEL < 压缩级别>]]
[TRACE FILE ''] [TRACE LEVEL ]

TABLE:指定备份的表,只能备份用户表。

TO:指定生成备份名称。若未指定,系统随机生成,默认备份名格式为:DB_备份类型_表名_备份时间。其中,备份时间为开始备份的系统时间。

BACKUPSET:指定当前备份集生成路径,若指定为相对路径,则在默认备份路径中生成备份集。若不指定具体备份集路径,则在默认备份路径下以约定规则生成默认的表备份集目录。表备份默认备份集目录名生成规则:TAB_表名_BTREE_时间,如
TAB_T1_BTREE_20160518_143057_123456。表明该备份集为2016年5月18日14时30分57秒123456毫秒时生成的表名为T1的表备份集。若表名超长,使上述完整名称长度大于128个字节,则去掉表名字段,调整为TAB_BTREE_时间。

DEVICE TYPE:指存储备份集的介质类型,表备份暂时只支持DISK,表示存储备份集到磁盘。

PARMS:只对介质类型为TAPE时有效。

BACKUPINFO:备份的描述信息。最大不超过256个字节。

MAXPIECESIZE:最大备份片文件大小上限,以M为单位,最小128M,32位系统最大2G,64位系统最大128G。

IDENTIFIED BY:指定备份时的加密密码。密码应用双引号括起来,这样避免一些特殊字符通不过语法检测。密码的设置规则遵行ini参数pwd_policy指定的口令策略。

WITH ENCRYPTION:指定加密类型,0表示不加密,不对备份文件进行加密处理;1表示简单加密,对备份文件设置口令,但文件内容仍以明文存储;2表示完全数据加密,对备份文件进行完全的加密,备份文件以密文方式存储。

ENCRYPT WITH:加密算法。缺省情况下,算法为AES256_CFB。

加密算法包括:

DES_ECB、DES_CBC、DES_CFB、DES_OFB、DESEDE_ECB、
DESEDE_CBC、DESEDE_CFB、DESEDE_OFB、AES128_ECB、
AES128_CBC、AES128_CFB 、AES128_OFB、AES192_ECB、
AES192_CBC、AES192_CFB 、AES192_OFB、AES256_ECB、
AES256_CBC、AES256_CFB 、AES256_OFB 、RC4

COMPRESSED:取值范围0~9。0表示不压缩,1表示1级压缩,9表示9级压缩。压缩级别越高,压缩越慢,但压缩比越高。若未指定,但指定COMPRESSED,则默认1;否则,默认0。

TRACE FILE:指定生成的TRACE文件。启用TRACE,但不指定TRACE FILE时,默认在DM数据库系统的log目录下生成DM_SBTTRACE_年月.LOG文件;若使用相对路径,则生成在执行码同级目录下。若用户指定,则指定的文件不能为已经存在的文件,否则报错;也不可以为ASM文件。

TRACE LEVEL:有效值1、2,默认为1表示不启用TRACE,此时若指定了TRACE FILE,会生成TRACE文件,但不写入TRACE信息;为2启用TRACE并写入TRACE相关内容。

使用说明:
1. 支持对用户的非分区行存储表和堆表进行备份。其中,系统表、临时表、物化视图表、物化视图附属表和日志表、特定模式(DBG_PKG/INFORMATION_SCHEMA/INFO_SCHEM/SYSREP/SYSGEO/SYSJOB/SYSCPT/SYS)下的表不支持备份。表列类型为对象类型的表不支持表备份。表备份不备份表上的注释,default表达式中函数定义,所以还原时需用户自行确认。
2. 当备份数据超过限制大小时,会生成新的备份文件,新的备份文件名是初始文件名后加文件编号。
3. 表备份时,其所属表空间必须处于联机状态。
4. 目前表备份不支持备份到TAPE介质上。

2. 设置备份选项
表备份常用的备份选项有设置备份名、设置备份集路径、指定介质参数、添加备份描述等,设置方式同数据库备份相同。

3. 备份表
表备份拷贝指定表所使用的所有数据页到备份集中,并记录各个数据页之间的逻辑关系用来恢复表数据结构。表备份均为联机完全备份,不需要备份归档日志,不存在增量备份之说。当数据库中某张表比较重要而又没必要备份整个数据库或表空间时就可以选择表备份。完整的备份表步骤如下:
1) 保证数据库处于OPEN状态。
2) 创建待备份的表TAB_01:

SQL> create table tab_01(c1 int);
executed successfully
used time: 32.117(ms). Execute id is 80.

3) DIsql中输入备份表语句,简单的备份语句如下:

SQL> backup table tab_01 to tab_tab_01_backup_20200529 backupset 'table_tab_01_backup_20200529';
executed successfully
used time: 00:00:13.981. Execute id is 81.

上面的语句将在默认备份目录+DMDATA/data/rac/bak(由BAK_PATH参数所指定)中生成备份集

SQL> select * from v$backupset where backup_path='+DMDATA/data/rac/bak/table_tab_01_backup_20200529';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                BACKUP_PATH                                       TYPE        LEVEL       RANGE#      OBJECT_NAME   OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- -------------------------- ------------------------------------------------- ----------- ----------- ----------- ------------- ----------- --------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        2025284018  -1          TAB_TAB_01_BACKUP_20200529 +DMDATA/data/rac/bak/table_tab_01_backup_20200529 2           0           3           SYSDBA.TAB_01 -1                    2020-05-29 15:08:24.000485        0            0              0           0           33554432    50908                51055                1           0           1            0           0           49398                117507596    0

used time: 00:00:01.063. Execute id is 82.

DM7联机执行SQL语句进行表空间备份

联机执行SQL语句进行表空间备份
下面将描述了如何使用DIsql完成最基本的表空间备份及实施一些备份策略,如限制备份集大小、加密备份等。主要内容包括:
1. 概述
2. 设置备份选项
3. 备份表空间

1. 概述
在DIsql工具中使用BACKUP语句也可以备份单个表空间。同备份数据库一样,执行表空间备份服务器也必须运行在归档模式下,启动DIsql输入以下语句即可备份表空间:

SQL> backup tablespace main backupset 'ts_backup_main_01';
executed successfully
used time: 00:00:13.841. Execute id is 45.

默认的备份目录为+DMDATA/data/rac/bak

SQL> select * from v$dm_ini where para_name='BAK_PATH';

LINEID     PARA_NAME PARA_VALUE           MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE           FILE_VALUE           DESCRIPTION      PARA_TYPE
---------- --------- -------------------- --------- --------- ------- -------------------- -------------------- ---------------- ---------
1          BAK_PATH  +DMDATA/data/rac/bak NULL      NULL      N       +DMDATA/data/rac/bak +DMDATA/data/rac/bak backup file path READ ONLY

used time: 9.531(ms). Execute id is 48.
SQL>


SQL> select * from v$backupset where backup_path like '+DMDATA/data/rac/bak%';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                         BACKUP_PATH                            TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ----------------------------------- -------------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        2044941324  -1          TS_FULL_MAIN_20200529_091214_000914 +DMDATA/data/rac/bak/ts_backup_main_01 0           0           2           MAIN        4                     2020-05-29 09:12:22.000279        0            0              0           0           33554432    50908                50990                1           1           1            0           0           49398                117507596    0

used time: 00:00:01.041. Execute id is 50.


ASM>cd ts_backup_main_01
+DMDATA/data/rac/bak/ts_backup_main_01
Used time: 2.098(ms).
ASM>ls
        file : ts_backup_main_01.bak
        file : ts_backup_main_01.meta
total count 2.
Used time: 3.583(ms).

备份集“ts_backup_main_01”会生成到默认的备份路径下。如要设置其他备份选项需参考下文的联机备份表空间语法。

语法如下:
BACKUP TABLESPACE <表空间名> [FULL | INCREMENT [CUMULATIVE][WITH BACKUPDIR ‘<基备份搜索目录>'{,'<基备份搜索目录>’}]|
[BASE ON BACKUPSET ‘<基备份集目录>’]][TO <备份名>] BACKUPSET [‘<备份集路径>’]
[DEVICE TYPE <介质类型> [PARMS ‘<介质参数>’]]
[BACKUPINFO ‘<备份集描述>’] [MAXPIECESIZE <备份片限制大小>]
[IDENTIFIED BY <加密密码>[WITH ENCRYPTION][ENCRYPT WITH <加密算法>]] [COMPRESSED [LEVEL <压缩级别>]]
[TRACE FILE ‘<TRACE文件名>’] [TRACE LEVEL <TRACE日志级别>]
[TASK THREAD <线程数>][PARALLEL [<并行数>]];

表空间名:指定备份的表空间名称(除了temp表空间)。

FULL|INCREMENT:备份类型,FULL表示完全备份,INCREMENT表示增量备份。若不指定,默认为完全备份。

CUMULATIVE:用于增量备份中,指明为累积增量备份类型,若不指定则缺省为差异增量备份类型。

WITH BACKUPDIR:用于增量备份中,指定备份目录,最大长度为256个字节。若不指定,服务器自动在默认备份目录下搜索基备份。如果基备份不在默认的备份目录下,增量备份必须指定该参数。

BASE ON:用于增量备份中,指定基备份集目录。

TO:指定生成备份名称。若未指定,系统随机生成,默认备份名格式为:DB_备份类型_表空间名_备份时间。其中,备份时间为开始备份的系统时间。

BACKUPSET:指定当前备份集生成路径。若指定为相对路径,则在默认备份路径中生成备份集。若不指定,则在默认备份路径下以约定规则生成默认的表空间备份集目录。表空间级备份默认备份集目录名生成规则:TS_表空间名_备份类型_时间,如
TS_MAIN_INCREMENT_20160518_143057_123456。表明该备份集为2016年5月18日14时30分57秒123456毫秒时生成的表空间名为MAIN的表空间增量备份集。若表空间名称超长,使上述完整名称长度大于128个字节,则去掉表空间名字段,调整为TS_备份类型_时间。

DEVICE TYPE:指存储备份集的介质类型,支持DISK和TAPE,默认DISK。DISK表示存储备份集到磁盘,TAPE表示存储到磁带。

PARMS:只对介质类型为TAPE时有效。

BACKUPINFO:备份的描述信息。最大不超过256个字节。

MAXPIECESIZE:最大备份片文件大小上限,以M为单位,最小128M,32位系统最大2G,64位系统最大128G。

IDENTIFIED BY:指定备份时的加密密码。密码应用双引号括起来,这样避免一些特殊字符通不过语法检测。密码的设置规则遵行ini参数pwd_policy指定的口令策略。

WITH ENCRYPTION:指定加密类型,0表示不加密,不对备份文件进行加密处理;1表示简单加密,对备份文件设置口令,但文件内容仍以明文存;2表示完全数据加密,对备份文件进行完全的加密,备份文件以密文方式存储。

ENCRYPT WITH:加密算法。缺省情况下,算法为AES256_CFB。

加密算法包括:

DES_ECB、DES_CBC、DES_CFB、DES_OFB、DESEDE_ECB、
DESEDE_CBC、DESEDE_CFB、DESEDE_OFB、AES128_ECB、
AES128_CBC、AES128_CFB 、AES128_OFB、AES192_ECB、
AES192_CBC、AES192_CFB 、AES192_OFB、AES256_ECB、
AES256_CBC、AES256_CFB 、AES256_OFB 、RC4

COMPRESSED:取值范围0~9。0表示不压缩,1表示1级压缩,9表示9级压缩。压缩级别越高,压缩越慢,但压缩比越高。若未指定,但指定COMPRESSED,则默认1;否则,默认0。

TRACE FILE:指定生成的TRACE文件。启用TRACE,但不指定TRACE FILE时,默认在DM数据库系统的log目录下生成DM_SBTTRACE_年月.LOG文件;若使用相对路径,则生成在执行码同级目录下。若用户指定,则指定的文件不能为已经存在的文件,否则报错;也不可以为ASM文件。

TRACE LEVEL:有效值1、2,默认为1表示不启用TRACE,此时若指定了TRACE FILE,会生成TRACE文件,但不写入TRACE信息;为2启用TRACE并写入TRACE相关内容。

TASK THREAD:备份过程中数据处理过程线程的个数,取值范围0~64,默认为4。若指定为0,则调整为1;若指定超过当前系统主机核数,则调整为主机核数。线程数(TASK THREAD)*并行数(PARALLEL)不得超过512。

PARALLEL:指定并行备份的并行数,取值范围0~128。若不指定,则默认为4,指定0或者1均认为为非并行备份。若未指定关键PARALLEL,则认为非并行备份。并行备份不支持存在介质为TAPE的备份。线程数(TASK THREAD)*并行数(PARALLEL)不得超过512。

使用说明:
1. 当备份数据超过限制大小时,会生成新的备份文件,新的备份文件名是初始文件名后加文件编号。
2. 系统处于归档模式下时,才允许进行表空间备份。
3. MOUNT状态下,不允许进行表空间备份。
4. MPP环境不允许进行表空间备份。

2. 设置备份选项
表空间备份也可指定备份集路径、介质类型、备份名等备份选项。

增量备份指定基备份目录
BASE ON 参数用于增量备份中,用来指定基备份集的目录。如果不指定该参数,会在备份搜索目录中搜索最近一次的完全备份或增量备份作为这次增量备份的基备份。若需要在特定的备份集基础上执行增量备份就需要使用该参数。

下面以增量备份用户MAIN表空间为例,指定BASE ON参数执行增量备份:

SQL> backup tablespace main backupset '/dm7/backup/ts_main_full_bak_20200529_01';
executed successfully
used time: 00:00:01.133. Execute id is 51.

SQL> backup tablespace main increment backupset '/dm7/backup/ts_main_increment_bak_20200529_01';
executed successfully
used time: 00:00:01.126. Execute id is 52.
SQL> select sf_bakset_backup_dir_add('disk','/dm7/backup/ts_main_full_bak_20200529_01');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/ts_main_full_bak_20200529_01')
---------- ---------------------------------------------------------------------------
1          1

used time: 2.024(ms). Execute id is 53.
SQL> select sf_bakset_backup_dir_add('disk','/dm7/backup/ts_main_increment_bak_20200529_01');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/ts_main_increment_bak_20200529_01')
---------- --------------------------------------------------------------------------------
1          1

used time: 1.520(ms). Execute id is 54.


SQL> select * from v$backupset where backup_path like '/dm7/backup/ts%';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                         BACKUP_PATH                                   TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME                           BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ----------------------------------- --------------------------------------------- ----------- ----------- ----------- ----------- ----------- ----------------------------------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        1493450986  -1          TS_FULL_MAIN_20200529_111133_000175 /dm7/backup/ts_main_full_bak_20200529_01      0           0           2           MAIN        4                                               2020-05-29 11:11:34.000272        0            0              0           0           33554432    50908                50996                1           1           1            0           0           49398                117507596    0
2          DISK        1885674227  -1          TS_INCR_MAIN_20200529_111346_000167 /dm7/backup/ts_main_increment_bak_20200529_01 1           0           2           MAIN        4           TS_FULL_MAIN_20200529_111133_000175 2020-05-29 11:13:47.000258        0            0              0           0           33554432    50908                51002                1           1           1            0           0           49398                117507596    0

used time: 00:00:01.048. Execute id is 55.

SQL> backup tablespace main increment base on backupset '/dm7/backup/ts_main_full_bak_20200529_01' backupset '/dm7/backup/ts_main_increment_bak_20200529_02';
executed successfully
used time: 00:00:01.133. Execute id is 57.

SQL> select sf_bakset_backup_dir_add('disk','/dm7/backup/ts_main_increment_bak_20200529_02');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/ts_main_increment_bak_20200529_02')
---------- --------------------------------------------------------------------------------
1          1

used time: 1.748(ms). Execute id is 58.
SQL> select * from v$backupset where backup_path like '/dm7/backup/ts%';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                         BACKUP_PATH                                   TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME                           BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ----------------------------------- --------------------------------------------- ----------- ----------- ----------- ----------- ----------- ----------------------------------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        1493450986  -1          TS_FULL_MAIN_20200529_111133_000175 /dm7/backup/ts_main_full_bak_20200529_01      0           0           2           MAIN        4                                               2020-05-29 11:11:34.000272        0            0              0           0           33554432    50908                50996                1           1           1            0           0           49398                117507596    0
2          DISK        1885674227  -1          TS_INCR_MAIN_20200529_111346_000167 /dm7/backup/ts_main_increment_bak_20200529_01 1           0           2           MAIN        4           TS_FULL_MAIN_20200529_111133_000175 2020-05-29 11:13:47.000258        0            0              0           0           33554432    50908                51002                1           1           1            0           0           49398                117507596    0
3          DISK        707233150   -1          TS_INCR_MAIN_20200529_111805_000417 /dm7/backup/ts_main_increment_bak_20200529_02 1           0           2           MAIN        4           TS_FULL_MAIN_20200529_111133_000175 2020-05-29 11:18:06.000513        0            0              0           0           33554432    50908                51008                1           1           1            0           0           49398                117507596    0

used time: 00:00:01.045. Execute id is 59.

上述示例中,增量备份ts_main_increment_bak_20200529_02若不指定备份集’/dm7/backup/ts_main_full_bak_20200529_01作为基备份,那么默认会使用最近一次的备份集/dm7/backup/ts_main_increment_bak_20200529_01作为基备份。

3. 备份表空间
同数据库备份一样,表空间备份也可分为完全备份和增量备份。本节主要内容包括:
1. 完全备份
2. 增量备份

1.完全备份
执行表空间备份,数据库必须处于OPEN状态,MOUNT和SUSPEND状态下不允许执行表空间备份。表空间备份就是拷贝表空间内所有数据文件有效数据的过程。DM7仅支持表空间联机备份,完全备份一个表空间步骤如下:
1) 配置归档 。
2) 保证数据库处于OPEN状态。
3) DIsql中输入备份表空间语句,最简单的不设置其他参数的完全备份表空间语句,如下所示:

SQL> backup tablespace main full backupset '/dm7/backup/ts_main_full_bak_20200529_02';
executed successfully
used time: 00:00:01.129. Execute id is 68.

备份语句中的FULL参数可以省略,不指定备份类型服务器会默认指定备份类型为完全备份。

SQL> select sf_bakset_backup_dir_add('disk','/dm7/backup/ts_main_full_bak_20200529_02');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/ts_main_full_bak_20200529_02')
---------- ---------------------------------------------------------------------------
1          1

used time: 2.508(ms). Execute id is 69.
SQL> select * from v$backupset where backup_path='/dm7/backup/ts_main_full_bak_20200529_02';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                         BACKUP_PATH                              TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ----------------------------------- ---------------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        -1442575362 -1          TS_FULL_MAIN_20200529_112705_000332 /dm7/backup/ts_main_full_bak_20200529_02 0           0           2           MAIN        4                     2020-05-29 11:27:06.000424        0            0              0           0           33554432    50908                51014                1           1           1            0           0           49398                117507596    0

used time: 00:00:01.046. Execute id is 70.

2.增量备份
执行表空间增量备份的主要目的同数据库增量备份一样是为了快速备份数据库中的修改,减少备份时间和避免重复的备份。
增量备份表空间步骤如下:
1) 配置归档。
2) 保证数据库处于OPEN状态。
3) DIsql中输入备份表空间语句,最简单的不设置其他参数的增量备份语句如下:

SQL> backup tablespace main increment base on backupset '/dm7/backup/ts_main_full_bak_20200529_02' backupset '/dm7/backup/ts_main_increment_bak_2020052903';
executed successfully
used time: 00:00:01.134. Execute id is 71.

SQL> select sf_bakset_backup_dir_add('disk','/dm7/backup/ts_main_increment_bak_2020052903');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/ts_main_increment_bak_2020052903')
---------- -------------------------------------------------------------------------------
1          1

used time: 1.720(ms). Execute id is 72.
SQL>  select * from v$backupset where backup_path like '%/dm7/backup/ts_main_%20200529%';

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                         BACKUP_PATH                                   TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME                           BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ----------------------------------- --------------------------------------------- ----------- ----------- ----------- ----------- ----------- ----------------------------------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        1493450986  -1          TS_FULL_MAIN_20200529_111133_000175 /dm7/backup/ts_main_full_bak_20200529_01      0           0           2           MAIN        4                                               2020-05-29 11:11:34.000272        0            0              0           0           33554432    50908                50996                1           1           1            0           0           49398                117507596    0
2          DISK        1885674227  -1          TS_INCR_MAIN_20200529_111346_000167 /dm7/backup/ts_main_increment_bak_20200529_01 1           0           2           MAIN        4           TS_FULL_MAIN_20200529_111133_000175 2020-05-29 11:13:47.000258        0            0              0           0           33554432    50908                51002                1           1           1            0           0           49398                117507596    0
3          DISK        707233150   -1          TS_INCR_MAIN_20200529_111805_000417 /dm7/backup/ts_main_increment_bak_20200529_02 1           0           2           MAIN        4           TS_FULL_MAIN_20200529_111133_000175 2020-05-29 11:18:06.000513        0            0              0           0           33554432    50908                51008                1           1           1            0           0           49398                117507596    0
4          DISK        -1442575362 -1          TS_FULL_MAIN_20200529_112705_000332 /dm7/backup/ts_main_full_bak_20200529_02      0           0           2           MAIN        4                                               2020-05-29 11:27:06.000424        0            0              0           0           33554432    50908                51014                1           1           1            0           0           49398                117507596    0
5          DISK        -738478264  -1          TS_INCR_MAIN_20200529_113155_000766 /dm7/backup/ts_main_increment_bak_2020052903  1           0           2           MAIN        4           TS_FULL_MAIN_20200529_112705_000332 2020-05-29 11:31:56.000863        0            0              0           0           33554432    50908                51020                1           1           1            0           0           49398                117507596    0

used time: 00:00:01.062. Execute id is 73.

备份语句中指定的INCREMENT参数表示执行的备份类型为增量备份,不可省略。若要创建累积增量备份,还需要指定CUMULATIVE参数,否则缺省为差异增量备份。若基备份不在默认备份目录,WITH BACKUPDIR参数必须指定,用于搜索基备份集。

DM联机执行SQL语句进行数据库备份

DM支持通过联机执行SQL语句方式对数据库执行备份还原操作。联机方式支持数据库、用户表空间、用户表和归档的备份,用户表空间、用户表的还原。在进行联机库级备份、归档备份表空间备份和表空间还原时,必须保证系统处于归档模式,否则联机备份还原不能进行。联机备份之前,请设置INI参数BAK_POLICY,选用合适的备份策略。在使用的SQL语句中,若指定的备份名、加密算法名长度超过128个字节,会导致语法分析错误。需要说明的是,DM新备份还原在执行联机操作时,语句的解析执行使用的是DM服务器的编码方式,而文件操作使用操作系统的编码方式。因此,当DM建库参数的编码方式与操作系统编码方式不一致时,使用中文文件名或路径名等可能造成控制台打印信息和日志文件中的信息的中文部分显示乱码。

下面将描述了如何使用DIsql完成最基本的数据库备份及实施一些备份策略,如限制备份集大小、加密备份等。主要内容包括:
1. 概述
2. 设置备份选项
3. 备份数据库

1.概述
在DIsql工具中使用BACKUP语句你可以备份整个数据库。通常情况下,在服务器配置归档后输入以下语句即可备份数据库:

SQL>BACKUP DATABASE BACKUPSET 'db_bak_01';

语句执行完后会在默认的备份路径下生成名为“db_bak_01”的备份集目录,默认的备份路径为dm.ini中BAK_PATH配置的路径,若未配置,则使用SYSTEM_PATH下的bak目录。这是最简单的数据库备份语句,如果要设置其他的备份选项需了解联机备份数据库的语法。

语法如下:
BACKUP DATABASE [[[FULL] [DDL_CLONE]]| INCREMENT [CUMULATIVE][WITH BACKUPDIR ‘< 基备份搜索目录>‘{,’< 基备份搜索目录>‘}
|[BASE ON ‘]][TO < 备份名>]BACKUPSET [‘< 备份集路径>‘]
[DEVICE TYPE < 介质类型> [PARMS ‘< 介质参数>‘]]
[BACKUPINFO ‘< 备份描述>‘] [MAXPIECESIZE < 备份片限制大小>]
[IDENTIFIED BY < 密码>[WITH ENCRYPTION][ENCRYPT WITH < 加密算法>]]
[COMPRESSED [LEVEL < 压缩级别>]] [WITHOUT LOG]
[TRACE FILE ‘< TRACE文件名>‘] [TRACE LEVEL < TRACE日志级别>]
[TASK THREAD < 线程数>][PARALLEL [< 并行数>]];

FULL:备份类型。FULL表示完全备份,可不指定,服务器会默认为完全备份。

DDL_CLONE:数据库克隆。该参数只能用于完全备份中,表示仅拷贝所有的元数据不拷贝数据。如对于数据库中的表来说,只备份表的定义不备份表中数据。表空间和表备份不支持该参数。DDL_CLONE会克隆HUGE表的元数据信息,之后库还原时会还原HUGE表的表定义。

INCREMENT:备份类型。INCREMENT表示增量备份,若要执行增量备份必须指定该参数。

CUMULATIVE:用于增量备份中,指明为累积增量备份类型,若不指定则缺省为差异增量备份类型。

WITH BACKUPDIR:用于增量备份中,指定基备份的搜索目录,最大长度为256个字节。若不指定,服务器自动在默认备份目录下搜索基备份。如果基备份不在默认的备份目录下,增量备份必须指定该参数。

BASE ON:用于增量备份中,指定基备份集目录。

TO:指定生成备份名称。若未指定,系统随机生成,默认备份名格式为:DB_备份类型_数据库名_备份时间。其中,备份时间为开始备份时的系统时间。

BACKUPSET:指定当前备份集生成路径。若指定为相对路径,则在默认备份路径中生成备份集。若不指定,则在默认备份路径中按约定规则,生成默认备份集目录。库级备份默认备份集目录名生成规则:DB_库名_备份类型_时间,如DB_DAMENG_FULL_20160518_143057_123456。表明该备份集为2016年5月18日14时30分57秒123456毫秒时生成的库名为DAMENG的数据库完全备份集。若库名超长,使上述完整名称长度大于128个字节,则去掉库名字段,调整为DB_备份类型_时间。

DEVICE TYPE:指存储备份集的介质类型,支持DISK和TAPE,默认DISK。DISK表示存储备份集到磁盘,TAPE表示存储到磁带。

PARMS:只对介质类型为TAPE时有效。

BACKUPINFO:备份的描述信息。最大不超过256个字节。

MAXPIECESIZE:最大备份片文件大小上限,以M为单位,最小128M,32位系统最大2G,64位系统最大128G。

IDENTIFIED BY:指定备份时的加密密码。密码应用双引号括起来,这样避免一些特殊字符通不过语法检测。密码的设置规则遵行ini参数pwd_policy指定的口令策略。

WITH ENCRYPTION:指定加密类型,0表示不加密,不对备份文件进行加密处理;1表示简单加密,对备份文件设置口令,但文件内容仍以明文存;2表示完全数据加密,对备份文件进行完全的加密,备份文件以密文方式存储。

ENCRYPT WITH:加密算法。缺省情况下,算法为AES256_CFB。

加密算法包括:
DES_ECB、DES_CBC、DES_CFB、DES_OFB、DESEDE_ECB、
DESEDE_CBC、DESEDE_CFB、DESEDE_OFB、AES128_ECB、
AES128_CBC、AES128_CFB 、AES128_OFB、AES192_ECB、
AES192_CBC、AES192_CFB 、AES192_OFB、AES256_ECB、
AES256_CBC、AES256_CFB 、AES256_OFB 、RC4

COMPRESSED:取值范围0~9。0表示不压缩,1表示1级压缩,9表示9级压缩。压缩级别越高,压缩越慢,但压缩比越高。若未指定,但指定COMPRESSED,则默认1;否则,默认0。

WITHOUT LOG:联机数据库备份是否备份日志。如果使用,则表示不备份,否则表示备份。如果使用了WITHOUT LOG参数,则使用DMRMAN工具还原时,必须指定WITH ARCHIVEDIR参数。

TRACE FILE:指定生成的TRACE文件。启用TRACE,但不指定TRACE FILE时,默认在DM数据库系统的log目录下生成DM_SBTTRACE_年月.log文件;若使用相对路径,则生成在执行码同级目录下。若用户指定,则指定的文件不能为已经存在的文件,否则报错;也不可以为ASM文件。

TRACE LEVEL:有效值1、2,默认为1表示不启用TRACE,此时若指定了TRACE FILE,会生成TRACE文件,但不写入TRACE信息;为2启用TRACE并写入TRACE相关内容。

TASK THREAD:备份过程中数据处理过程线程的个数,取值范围0~64,默认为4。若指定为0,则调整为1;若指定超过当前系统主机核数,则调整为主机核数。线程数(TASK THREAD)*并行数(PARALLEL)不得超过512。

PARALLEL:指定并行备份的并行数,取值范围0~128。若不指定,则默认为4,指定0或者1均认为为非并行备份。若未指定关键PARALLEL,则认为非并行备份。并行备份不支持存在介质为TAPE的备份。线程数(TASK THREAD)*并行数(PARALLEL)不得超过512。

使用说明:
1. 备份成功后会在< 备份集路径>或者备份默认目录下生成备份集。备份集中包括一个备份元数据文件,后缀.meta,一个或多个备份片文件,后缀.bak。
2. 当备份数据超过限制大小时,会生成新的备份文件,新的备份文件名是初始文件名后加文件编号。
3. 系统处于归档模式下时,才允许进行数据库联机备份。若备份库为RAC库,且未指定WITHOUT LOG,则也需要配置REMOTE归档。
4. MOUNT状态下不允许进行数据库备份。
5. DDL_CLONE库备份集不能作为增量备份的基备份,仅能用于库级还原。
6. 在执行联机数据库备份过程中,如果报错归档不完整,则需要先执行生成检查点操作,才能正常备份。例如:select checkpoint(50);

2 设置备份选项
DIsql中备份语句如果仅指定了必选参数如“BACKUP DATABASE BACKUPSET ‘db_bak_01’;”,那么服务器会默认地指定备份介质类型、备份路径、备份片大小及备份联机日志等。用户备份时也可以指定这些参数来修改默认值,本节将介绍以下几种常用的备份选项:
1. 设置联机数据库备份集路径
2. 设置备份名
3. 指定介质类型
4. 添加备份描述
5. 限制备份片大小
6. 加密备份
7. 备份压缩

1.设置联机数据库备份集路径
备份语句中的BACKUPSET参数用于指定备份集的输出路径,例1备份数据库到指定的路径“/dm7/backup/db_backup_20200528_01”。

SQL> backup database backupset '/dm7/backup/db_backup_20200528_01';
executed successfully
used time: 00:00:01.300. Execute id is 10.

在查看之前应先使用sf_bakset_backup_dir_add添加备份集目录,否则只显示默认备份路径下的备份集信息,使用方法如下例所示:

SQL> select * from v$dm_ini where para_name like'%PATH';

LINEID     PARA_NAME         PARA_VALUE                  MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE                  FILE_VALUE               DESCRIPTION                  PARA_TYPE
---------- ----------------- --------------------------- --------- --------- ------- --------------------------- ------------------------ ---------------------------- ---------
1          CTL_PATH          +DMDATA/data/rac/dm.ctl     NULL      NULL      N       +DMDATA/data/rac/dm.ctl     +DMDATA/data/rac/dm.ctl  path of dm.ctl               READ ONLY
2          CTL_BAK_PATH      +DMDATA/data/rac/ctl_bak    NULL      NULL      N       +DMDATA/data/rac/ctl_bak    +DMDATA/data/rac/ctl_bak backup path of dm.ctl        READ ONLY
3          SYSTEM_PATH       +DMDATA/data/rac            NULL      NULL      N       +DMDATA/data/rac            +DMDATA/data/rac         system path                  READ ONLY
4          CONFIG_PATH       /dm7/data/rac0_config       NULL      NULL      N       /dm7/data/rac0_config       /dm7/data/rac0_config    config path                  READ ONLY
5          TEMP_PATH         +DMDATA/data/rac            NULL      NULL      N       +DMDATA/data/rac            +DMDATA/data/rac         temporary database file path READ ONLY
6          BAK_PATH          +DMDATA/data/rac/bak        NULL      NULL      N       +DMDATA/data/rac/bak        +DMDATA/data/rac/bak     backup file path             READ ONLY
7          AUD_PATH          NULL                        NULL      NULL      N       NULL                        NULL                     audit log path               READ ONLY
8          SSD_FILE_PATH     NULL                        NULL      NULL      N       NULL                        NULL                     SSD buffer file path         IN FILE
9          SVR_LOG_FILE_PATH ../log                      NULL      NULL      N       ../log                      ../log                   File Path for SQLs Log       SYS
10         TRACE_PATH        /dm7/data/rac0_config/trace NULL      NULL      N       /dm7/data/rac0_config/trace NULL                     System trace path name       READ ONLY
11         DCR_PATH          /dev/raw/raw1               NULL      NULL      N       /dev/raw/raw1               NULL                     Path of dcr disk             IN FILE

11 rows got

used time: 10.522(ms). Execute id is 20.

SQL> select sf_bakset_backup_dir_add('disk', '/dm7/backup/db_backup_20200528_01');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/db_backup_20200528_01')
---------- --------------------------------------------------------------------
1          1

used time: 1.716(ms). Execute id is 18.
SQL> select * from v$backupset;

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                        BACKUP_PATH                       TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ---------------------------------- --------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        22076147    -1          DB_FULL_rac_20200528_210146_000437 /dm7/backup/db_backup_20200528_01 0           0           1           rac         -1                    2020-05-28 21:01:47.000670        0            0              0           0           33554432    50908                50909                2           4           1            0           0           49398                117507596    0

used time: 00:00:01.022. Execute id is 19.

BACKUPSET为必选参数。如果该参数仅指定备份集名称即指定为相对路径,备份集会生成到默认的备份路径下。如果仅指定该关键字,不指定目标备份集目录,那么将会在默认备份路径下自动生成。

2.设置备份名
系统为每个备份指定一个备份名,它可作为识别备份的一种方式。备份时用户可以采用系统生成的备份名也可以指定属于自己的备份名。

备份名可以有效地表示备份的目的或者不同类型备份的用途。比如对于一个用于还原的数据库完全备份可设置备份名为“db_full_for_restore”。

如果不显式地指定备份名,系统会默认为备份创建一个备份名。备份名的格式为:DB_备份类型_数据库名_备份时间,DB表示备份为数据库备份,备份类型表示该备份为完全备份还是增量备份,数据库名为当前连接数据库的名称,备份时间为开始执行备份的系统时间。

若一次备份产生多个备份片,那么每个备份片的备份名是相同的。

指定的备份名不能与默认备份路径中已有的备份名相同,但可以与非默认备份路径中已有的备份名相同。备份路径指备份集名称的上一层路径,如例1中的备份路径为“/home/backup/”。

备份名最大长度为128个字节,如果超长服务器会报语法分析出错。备份名的设置不可以使用特殊的格式,如%NAME。
例2创建备份集,备份名设置为“weekly_full_bak”。

SQL> backup database to weekly_full_bak backupset '/dm7/backup/db_backup_20200528_02';
executed successfully
used time: 00:00:01.571. Execute id is 23.

SQL> select sf_bakset_backup_dir_add('disk', '/dm7/backup/db_backup_20200528_02');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/db_backup_20200528_02')
---------- --------------------------------------------------------------------
1          1

used time: 1.924(ms). Execute id is 24.
SQL> select * from v$backupset;

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                        BACKUP_PATH                       TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC# ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ---------------------------------- --------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- ----- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        22076147    -1          DB_FULL_rac_20200528_210146_000437 /dm7/backup/db_backup_20200528_01 0           0           1           rac         -1                    2020-05-28 21:01:47.000670        0            0              0           0           33554432    50908                50909                2           4           1            0           0           49398                117507596    0
2          DISK        -825903455  -1          WEEKLY_FULL_BAK                    /dm7/backup/db_backup_20200528_02 0           0           1           rac         -1                    2020-05-28 21:42:58.000425        0            0              0           0           33554432    50908                50933                2           4           1            0           0           49398                117507596    0

used time: 00:00:01.026. Execute id is 25.

3.指定介质类型
device type参数用于指定存储备份集到磁盘还是磁带。若需要备份数据到磁带可使用backup…device type tape语句。
例3指定备份数据库到磁带。

sql>backup database backupset '/HOME/DM_BAK/DB_BAK_3_03' device type tape;

若备份时不指定介质类型参数服务器会默认存储备份集到磁盘。

4.添加备份描述
联机备份可选择对执行的备份添加描述信息,相比备份名参数,描述信息可以更详细地对备份类型、用途、场景等进行说明。描述信息最大长度支持256个字节。

例4创建备份为备份集添加描述信息为“rac_full_backup”。

SQL> backup database backupset '/dm7/backup/db_backup_20200528_03' backupinfo 'rac_full_backup';
executed successfully
used time: 00:00:01.342. Execute id is 27.

SQL> select sf_bakset_backup_dir_add('disk', '/dm7/backup/db_backup_20200528_03');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/db_backup_20200528_03')
---------- --------------------------------------------------------------------
1          1

used time: 1.286(ms). Execute id is 28.
SQL> select * from v$backupset;

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                        BACKUP_PATH                       TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC#           ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ---------------------------------- --------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- --------------- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        22076147    -1          DB_FULL_rac_20200528_210146_000437 /dm7/backup/db_backup_20200528_01 0           0           1           rac         -1                    2020-05-28 21:01:47.000670                  0            0              0           0           33554432    50908                50909                2           4           1            0           0           49398                117507596    0
2          DISK        -825903455  -1          WEEKLY_FULL_BAK                    /dm7/backup/db_backup_20200528_02 0           0           1           rac         -1                    2020-05-28 21:42:58.000425                  0            0              0           0           33554432    50908                50933                2           4           1            0           0           49398                117507596    0
3          DISK        418984588   -1          DB_FULL_rac_20200528_215152_000262 /dm7/backup/db_backup_20200528_03 0           0           1           rac         -1                    2020-05-28 21:51:53.000563  rac_full_backup 0            0              0           0           33554432    50908                50948                2           4           1            0           0           49398                117507596    0

used time: 00:00:01.027. Execute id is 29.

用户如果不指定该参数,备份集对应的描述信息属性则为空。

5.限制备份片大小
MAXPIECESIZE参数用于控制单个备份片的大小,当介质管理器对单个文件的大小有限制或者需要备份的数据文件很大时就可以使用这个参数。MAXPIECESIZE不能大于磁盘剩余空间大小,否则报错磁盘空间不足。

MAXPIECESIZE指定了单个备份片文件大小的上限,单位为M,最小为128M,32位系统最大可设置为2G,64位系统最大可设置为128G。如果不设置32系统默认为2G,64位系统默认为4G。例如,要限制备份片大小不超过300M,可指定MAXPIECESIZE 300,备份时服务器会限定所有的备份片大小不超过300M。

限制备份片大小主要用于解决文件系统或介质管理器对文件最大值的限制小于备份片默认值的情况,当备份片较大时会导致无法存储。

例5创建备份限制备份片大小为300M。

SQL> backup database backupset '/dm7/backup/db_backup_20200528_04' maxpiecesize 300;
executed successfully
used time: 00:00:01.195. Execute id is 30.

SQL> select sf_bakset_backup_dir_add('disk', '/dm7/backup/db_backup_20200528_04');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/db_backup_20200528_04')
---------- --------------------------------------------------------------------
1          1

used time: 1.259(ms). Execute id is 31.
SQL> select * from v$backupset;

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                        BACKUP_PATH                       TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC#           ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ---------------------------------- --------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- --------------- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        22076147    -1          DB_FULL_rac_20200528_210146_000437 /dm7/backup/db_backup_20200528_01 0           0           1           rac         -1                    2020-05-28 21:01:47.000670                  0            0              0           0           33554432    50908                50909                2           4           1            0           0           49398                117507596    0
2          DISK        -825903455  -1          WEEKLY_FULL_BAK                    /dm7/backup/db_backup_20200528_02 0           0           1           rac         -1                    2020-05-28 21:42:58.000425                  0            0              0           0           33554432    50908                50933                2           4           1            0           0           49398                117507596    0
3          DISK        418984588   -1          DB_FULL_rac_20200528_215152_000262 /dm7/backup/db_backup_20200528_03 0           0           1           rac         -1                    2020-05-28 21:51:53.000563  rac_full_backup 0            0              0           0           33554432    50908                50948                2           4           1            0           0           49398                117507596    0
4          DISK        -556033448  -1          DB_FULL_rac_20200528_215831_000073 /dm7/backup/db_backup_20200528_04 0           0           1           rac         -1                    2020-05-28 21:58:32.000229                  0            0              0           0           33554432    50908                50954                2           4           1            0           0           49398                117507596    0

used time: 00:00:01.027. Execute id is 32.

6.备份压缩
所有的备份语句都可以设置压缩选项,指定COMPRESSED参数后备份集会先被压缩然后再写到磁盘或磁带。压缩选项有不同的压缩级别可以选择,取值范围为0~9。0表示不压缩,1表示1级压缩,9表示9级压缩。压缩级别越高,压缩越慢,但压缩比越高。若仅指定COMPRESSED,压缩级别为1。实际应用中用户可根据存储空间、数据文件大小、备份效率等确定合适的压缩级别。

例6执行备份压缩,压缩级别设置为5。

SQL> backup database backupset '/dm7/backup/db_backup_20200528_05' compressed level 5;
executed successfully
used time: 00:00:01.311. Execute id is 33.
SQL> select sf_bakset_backup_dir_add('disk', '/dm7/backup/db_backup_20200528_05');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/db_backup_20200528_05')
---------- --------------------------------------------------------------------
1          1

used time: 1.623(ms). Execute id is 34.
SQL> select * from v$backupset;

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                        BACKUP_PATH                       TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC#           ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ---------------------------------- --------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- --------------- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        22076147    -1          DB_FULL_rac_20200528_210146_000437 /dm7/backup/db_backup_20200528_01 0           0           1           rac         -1                    2020-05-28 21:01:47.000670                  0            0              0           0           33554432    50908                50909                2           4           1            0           0           49398                117507596    0
2          DISK        -825903455  -1          WEEKLY_FULL_BAK                    /dm7/backup/db_backup_20200528_02 0           0           1           rac         -1                    2020-05-28 21:42:58.000425                  0            0              0           0           33554432    50908                50933                2           4           1            0           0           49398                117507596    0
3          DISK        418984588   -1          DB_FULL_rac_20200528_215152_000262 /dm7/backup/db_backup_20200528_03 0           0           1           rac         -1                    2020-05-28 21:51:53.000563  rac_full_backup 0            0              0           0           33554432    50908                50948                2           4           1            0           0           49398                117507596    0
4          DISK        -556033448  -1          DB_FULL_rac_20200528_215831_000073 /dm7/backup/db_backup_20200528_04 0           0           1           rac         -1                    2020-05-28 21:58:32.000229                  0            0              0           0           33554432    50908                50954                2           4           1            0           0           49398                117507596    0
5          DISK        2085599548  -1          DB_FULL_rac_20200528_220043_000211 /dm7/backup/db_backup_20200528_05 0           0           1           rac         -1                    2020-05-28 22:00:44.000485                  0            5              0           0           33554432    50908                50960                2           4           1            0           0           49398                117507596    0

used time: 00:00:01.030. Execute id is 35.

7.并行备份
DM支持对库级和表空间级的并行备份,待备份数据文件很大时使用并行备份可以显著提高备份效率。用户可通过关键字PARALLEL指定是否执行并行备份,以及执行并行备份的并行数。执行备份时实际使用的并行数由用户指定的并行数和实际可使用的最大并行数决定,而实际可使用的最大并行数由数据文件的个数决定。关于并行备份的更多内容请参考2.1.1.5小节。

例7创建并行备份,指定并行数为8。

SQL> backup database backupset '/dm7/backup/db_backup_20200528_06' parallel 8;
executed successfully
used time: 00:00:04.318. Execute id is 36.
SQL> select sf_bakset_backup_dir_add('disk', '/dm7/backup/db_backup_20200528_06');

LINEID     SF_BAKSET_BACKUP_DIR_ADD('disk','/dm7/backup/db_backup_20200528_06')
---------- --------------------------------------------------------------------
1          1

used time: 2.009(ms). Execute id is 37.
SQL> select * from v$backupset;

LINEID     DEVICE_TYPE BACKUP_ID   PARENT_ID   BACKUP_NAME                          BACKUP_PATH                                               TYPE        LEVEL       RANGE#      OBJECT_NAME OBJECT_ID   BASE_NAME BACKUP_TIME                 DESC#           ENCRYPT_TYPE COMPRESS_LEVEL WITHOUT_LOG USE_PWR     PKG_SIZE    BEGIN_LSN            END_LSN              BKP_NUM     DBF_NUM     PARALLEL_NUM DDL_CLONE   MPP_FLAG    MIN_TRX_START_LSN    MIN_EXEC_VER CUMULATIVE
---------- ----------- ----------- ----------- ------------------------------------ --------------------------------------------------------- ----------- ----------- ----------- ----------- ----------- --------- --------------------------- --------------- ------------ -------------- ----------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ ----------- ----------- -------------------- ------------ -----------
1          DISK        22076147    -1          DB_FULL_rac_20200528_210146_000437   /dm7/backup/db_backup_20200528_01                         0           0           1           rac         -1                    2020-05-28 21:01:47.000670                  0            0              0           0           33554432    50908                50909                2           4           1            0           0           49398                117507596    0
2          DISK        -825903455  -1          WEEKLY_FULL_BAK                      /dm7/backup/db_backup_20200528_02                         0           0           1           rac         -1                    2020-05-28 21:42:58.000425                  0            0              0           0           33554432    50908                50933                2           4           1            0           0           49398                117507596    0
3          DISK        418984588   -1          DB_FULL_rac_20200528_215152_000262   /dm7/backup/db_backup_20200528_03                         0           0           1           rac         -1                    2020-05-28 21:51:53.000563  rac_full_backup 0            0              0           0           33554432    50908                50948                2           4           1            0           0           49398                117507596    0
4          DISK        -556033448  -1          DB_FULL_rac_20200528_215831_000073   /dm7/backup/db_backup_20200528_04                         0           0           1           rac         -1                    2020-05-28 21:58:32.000229                  0            0              0           0           33554432    50908                50954                2           4           1            0           0           49398                117507596    0
5          DISK        2085599548  -1          DB_FULL_rac_20200528_220043_000211   /dm7/backup/db_backup_20200528_05                         0           0           1           rac         -1                    2020-05-28 22:00:44.000485                  0            5              0           0           33554432    50908                50960                2           4           1            0           0           49398                117507596    0
6          DISK        2023209010  -1          DB_FULL_rac_20200528_220405_000089   /dm7/backup/db_backup_20200528_06                         0           0           1           rac         -1                    2020-05-28 22:04:09.000361                  0            0              0           0           33554432    50908                50966                4           4           3            0           0           49398                117507596    0
7          DISK        -1507864128 2023209010  DB_FULL_rac_20200528_220405_000089_1 /dm7/backup/db_backup_20200528_06/db_backup_20200528_06_1 0           0           1           rac         -1                    2020-05-28 22:04:09.000254                  0            0              0           0           33554432    50908                50907                1           1           1            0           0           49398                117507596    0
8          DISK        -1887457992 2023209010  DB_FULL_rac_20200528_220405_000089_0 /dm7/backup/db_backup_20200528_06/db_backup_20200528_06_0 0           0           1           rac         -1                    2020-05-28 22:04:09.000274                  0            0              0           0           33554432    50908                50907                1           1           1            0           0           49398                117507596    0
9          DISK        -794647678  2023209010  DB_FULL_rac_20200528_220405_000089_2 /dm7/backup/db_backup_20200528_06/db_backup_20200528_06_2 0           0           1           rac         -1                    2020-05-28 22:04:09.000300                  0            0              0           0           33554432    50908                50907                1           1           1            0           0           49398                117507596    0

9 rows got

used time: 00:00:01.034. Execute id is 38.

3.备份数据库
完全备份和增量备份是数据库备份的最常用策略,本节将详细介绍这两种类型备份。
完全备份
执行数据库备份,数据库必须处于OPEN状态,MOUNT和SUSPEND状态下不允许执行数据库备份。
数据库完全备份中包含了指定库的全部有效数据页,为了保证数据安全应该对数据库定期执行完全备份。多久执行一次完全备份才合适,一般规则是数据库经过频繁修改后最好执行一次完全备份。
完全备份数据库步骤如下:
1) 配置归档,
2) 保证数据库处于OPEN状态。
3) DIsql中输入备份数据库语句,最简单的不设置其他参数的完全备份语句如下:

SQL> backup database full backupset '/dm7/backup/db_backup_20200529_01';
executed successfully
used time: 00:00:01.218. Execute id is 39.

备份语句中的参数FULL参数可以省略,不指定备份类型服务器会默认指定备份类型为完全备份。

增量备份
增量备份指基于指定的库(或者表空间)的某个备份(完全备份或者增量备份),备份自该备份以来所有发生修改了的数据页。执行增量备份的主要目的是快速备份数据库中的修改,减少备份时间和避免重复的备份。

如何制定备份策略要根据可接受的最小恢复时间。例如,每周执行一次完全备份,每天执行一次增量备份,那么恢复时要重做的归档就不会超过一天。
增量备份数据库步骤如下:
1) 配置归档,
2) 保证数据库处于OPEN状态。
3) DIsql中输入备份数据库语句,最简单的不设置其他参数的增量备份语句如下:

SQL> backup database increment with backupdir '/dm7/backup/db_backup_20200529_01' backupset '/dm7/backup/db_increment_backup_20200529_02';
executed successfully
used time: 00:00:01.172. Execute id is 41.

备份语句中的INCREMENT参数不可省略,该参数用来指定执行的备份类型为增量备份。若要创建累积增量备份,还需要指定CUMULATIVE参数,否则缺省为差异增量备份。WITH BACKUPDIR参数用来指定基备份集的搜索目录,如果基备份集不在默认目录该参数不可省略。

Oracle DG备库发现Oracle Home目录使用空间巨增的问题处理

同事巡检查发现Oracle RAC DG备库的Oracle Home目录使用空间巨增,执行命令发现oracle目录占用了87G,这肯定不正常。

[root@dgdb1 app]# du -sh *
11G     11.2.0
8.0K    asmpfile.ora
3.1G    grid
87G     oracle
4.0M    oraInventory

进一步检查发现ORACLE_HOME目录下的dbs目录占用了61G。

[root@dgdb1 db_1]# du -sh *
177M    apex
303M    assistants
459M    bin
58M     ccr
8.0K    cdata
2.9M    cfgtoollogs
68K     clone
4.0K    config
5.9M    crs
24K     csmig
236K    css
296M    ctx
3.3M    cv
61G     dbs
12K     dc_ocm
396K    deinstall
1.1M    demo
16K     diagnostics
6.9M    dv
40K     emcli
8.0K    EMStage
1.9M    has
40K     hs
11M     ide
7.4M    install
1.5M    instantclient
215M    inventory
60M     j2ee
118M    javavm
26M     jdbc
520K    jdev
186M    jdk
43M     jlib
2.7M    ldap
768M    lib
64K     log
33M     md
96K     mesg
908K    mgw
8.3M    network
33M     nls
326M    oc4j
1.7M    odbc
13M     olap
5.5M    OPatch
528K    opmn
40M     oracore
4.0K    oraInst.loc
7.4M    ord
29M     oui
545M    owb
1.7M    owm
60M     perl
1.6M    plsql
5.1M    precomp
316K    racg
127M    rdbms
124K    relnotes
4.0K    root.sh
12K     scheduler
20K     slax
82M     sqldeveloper
4.8M    sqlj
484K    sqlplus
9.6M    srvm
21M     suptools
220M    sysman
112K    timingframework
512K    ucp
3.7M    uix
800K    usm
8.0K    utl
556K    wwg
19M     xdk

检查dbs目录发现多了很多broken*这样的文件,并且在是三月2号8:36分到9:49分之间生成的

[root@dgdb1 dbs]# ls -lrt
total 63341528
-rw-r--r-- 1 oracle oinstall       2851 May 15  2009 init.ora
-rw-rw---- 1 oracle asmadmin       1544 Nov  9  2016 hc_rlzy1.dat
-rw-r----- 1 oracle oinstall       1536 Nov 11  2016 orapwRLZY1
-rw-r--r-- 1 oracle oinstall         60 Nov 20  2016 initRLZY1.ora
-rw-r--r-- 1 oracle oinstall         60 Nov 24  2016 initRLZY1.ora.bk
-rw-r--r-- 1 oracle oinstall       1922 Nov 24  2016 initCAIWU1.ora.bk
-rw-r--r-- 1 oracle oinstall         60 Nov 24  2016 initCAIWU1.ora
-rw-r----- 1 oracle oinstall       1536 Nov 24  2016 orapwCAIWU1
-rw-rw---- 1 oracle asmadmin       1544 Nov 24  2016 hc_chdyldg.dat
-rw-r--r-- 1 oracle oinstall       1979 Nov 24  2016 initchdyl1.ora.bk
-rw-r--r-- 1 oracle oinstall         61 Nov 24  2016 initchdyl1.ora
-rw-r----- 1 oracle oinstall       1536 Nov 24  2016 orapwchdyl1
-rw-r--r-- 1 oracle oinstall       2019 Nov 28  2016 initsjjh1.ora.bk
-rw-r--r-- 1 oracle oinstall         60 Nov 28  2016 initsjjh1.ora.bak.dgdb1
-rw-r----- 1 oracle oinstall       1536 Nov 28  2016 orapwsjjh1.bk
-rw-r--r-- 1 oracle oinstall         83 Nov 29  2016 initsjjh1.ora
-rw-rw---- 1 oracle asmadmin       1544 Apr  1  2017 hc_dbdb1.dat
-rw-r--r-- 1 oracle oinstall       1783 Apr  1  2017 initdadb1.ora.bk
-rw-r--r-- 1 oracle oinstall         53 Apr  1  2017 initdadb1.ora.bak.dgdb1
-rw-r----- 1 oracle oinstall       1536 Apr  1  2017 orapwdadb1
-rw-r--r-- 1 oracle oinstall         76 Apr  5  2017 initdadb1.ora
-rw-rw---- 1 oracle asmadmin       1544 Apr 22  2019 hc_chdyl1.dat
-rw-rw---- 1 oracle asmadmin       1544 Apr 22  2019 hc_dadb1.dat
-rw-rw---- 1 oracle asmadmin       1544 Apr 22  2019 hc_CAIWU1.dat
-rw-rw---- 1 oracle asmadmin       1544 Jul 29  2019 hc_RLZY1.dat
-rw-r----- 1 oracle oinstall       1536 Aug  6  2019 orapwsjjh
-rw-rw---- 1 oracle asmadmin       1544 Aug  6  2019 hc_sjjh.dat
-rw-r----- 1 oracle asmadmin   10797056 Oct 14  2019 snapcf_sjjh1.f
-rw-r----- 1 oracle oinstall       1536 Mar  1 18:31 orapwsjjh1
-rw-r----- 1 oracle asmadmin 1262486016 Mar  2 08:36 broken0
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:36 broken1
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:36 broken2
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:36 broken3
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:36 broken4
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:36 broken5
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:37 broken6
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:37 broken7
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:37 broken8
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:37 broken9
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:37 broken10
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:37 broken11
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken12
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken13
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken14
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken15
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken16
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken17
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:38 broken18
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:39 broken19
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:39 broken20
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:39 broken21
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:39 broken22
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:39 broken23
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:39 broken24
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:40 broken25
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:40 broken26
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:40 broken27
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:40 broken28
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:40 broken29
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:48 broken59
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:48 broken33
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:48 broken35
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:48 broken34
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:48 broken36
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken37
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken39
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken38
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken40
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken41
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken42
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:49 broken43
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:50 broken44
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:50 broken45
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:50 broken46
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:50 broken47
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:50 broken48
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:50 broken49
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:51 broken51
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:51 broken50
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:51 broken52
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:51 broken53
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:51 broken54
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:51 broken55
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:52 broken57
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:52 broken56
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 08:52 broken58
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 09:17 broken32
-rw-r----- 1 oracle asmadmin 1073742336 Mar  2 09:33 broken31
-rw-r----- 1 oracle asmadmin 1262486016 Mar  2 09:49 broken30
-rw-rw---- 1 oracle asmadmin       1544 Mar  2 10:02 hc_sjjh1.dat
-rw-r----- 1 oracle asmadmin   48316416 Jul 21 03:00 snapcf_RLZY1.f

查看文件broken0发现是sjjh数据库与日志文件相关的错误

查看实例的alert.log文件的内容,果然是在写日志文件时出现了错误:

Successful mount of redo thread 1, with mount id 4246975374
Physical Standby Database mounted.
Lost write protection disabled
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken0'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken0'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken1'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken1'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken2'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken2'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken3'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken3'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 5 of thread 1
ORA-00312: online log 5 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken4'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 5 of thread 1
ORA-00312: online log 5 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken4'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 6 of thread 1
ORA-00312: online log 6 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken5'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 6 of thread 1
ORA-00312: online log 6 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken5'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 7 of thread 1
ORA-00312: online log 7 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken6'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 7 of thread 1
ORA-00312: online log 7 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken6'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 8 of thread 1
ORA-00312: online log 8 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken7'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 8 of thread 1
ORA-00312: online log 8 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken7'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 9 of thread 1
ORA-00312: online log 9 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken8'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 9 of thread 1
ORA-00312: online log 9 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken8'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 10 of thread 1
ORA-00312: online log 10 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken9'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 10 of thread 1
ORA-00312: online log 10 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken9'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 11 of thread 1
ORA-00312: online log 11 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken10'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 11 of thread 1
ORA-00312: online log 11 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken10'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 12 of thread 1
ORA-00312: online log 12 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken11'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 12 of thread 1
ORA-00312: online log 12 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken11'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 13 of thread 1
ORA-00312: online log 13 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken12'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 13 of thread 1
ORA-00312: online log 13 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken12'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 14 of thread 1
ORA-00312: online log 14 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken13'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 14 of thread 1
ORA-00312: online log 14 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken13'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 15 of thread 1
ORA-00312: online log 15 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken14'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 15 of thread 1
ORA-00312: online log 15 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken14'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 16 of thread 1
ORA-00312: online log 16 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken15'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 16 of thread 1
ORA-00312: online log 16 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken15'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 17 of thread 1
ORA-00312: online log 17 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken16'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 17 of thread 1
ORA-00312: online log 17 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken16'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 18 of thread 1
ORA-00312: online log 18 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken17'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 18 of thread 1
ORA-00312: online log 18 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken17'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 19 of thread 1
ORA-00312: online log 19 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken18'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 19 of thread 1
ORA-00312: online log 19 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken18'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 20 of thread 1
ORA-00312: online log 20 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken19'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 20 of thread 1
ORA-00312: online log 20 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken19'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 21 of thread 1
ORA-00312: online log 21 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken20'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 21 of thread 1
ORA-00312: online log 21 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken20'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 22 of thread 1
ORA-00312: online log 22 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken21'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 22 of thread 1
ORA-00312: online log 22 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken21'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 23 of thread 1
ORA-00312: online log 23 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken22'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 23 of thread 1
ORA-00312: online log 23 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken22'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 24 of thread 1
ORA-00312: online log 24 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken23'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 24 of thread 1
ORA-00312: online log 24 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken23'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 25 of thread 1
ORA-00312: online log 25 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken24'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 25 of thread 1
ORA-00312: online log 25 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken24'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 26 of thread 1
ORA-00312: online log 26 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken25'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 26 of thread 1
ORA-00312: online log 26 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken25'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 27 of thread 1
ORA-00312: online log 27 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken26'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 27 of thread 1
ORA-00312: online log 27 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken26'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 28 of thread 1
ORA-00312: online log 28 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken27'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 28 of thread 1
ORA-00312: online log 28 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken27'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 29 of thread 1
ORA-00312: online log 29 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken28'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 29 of thread 1
ORA-00312: online log 29 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken28'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 30 of thread 1
ORA-00312: online log 30 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken29'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 30 of thread 1
ORA-00312: online log 30 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken29'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 31 of thread 1
ORA-00312: online log 31 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken30'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 31 of thread 1
ORA-00312: online log 31 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken30'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 32 of thread 1
ORA-00312: online log 32 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken31'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 32 of thread 1
ORA-00312: online log 32 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken31'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 33 of thread 1
ORA-00312: online log 33 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken32'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 33 of thread 1
ORA-00312: online log 33 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken32'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 34 of thread 1
ORA-00312: online log 34 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken33'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 34 of thread 1
ORA-00312: online log 34 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken33'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 35 of thread 1
ORA-00312: online log 35 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken34'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 35 of thread 1
ORA-00312: online log 35 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken34'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 36 of thread 1
ORA-00312: online log 36 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken35'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 36 of thread 1
ORA-00312: online log 36 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken35'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 37 of thread 1
ORA-00312: online log 37 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken36'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 37 of thread 1
ORA-00312: online log 37 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken36'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 38 of thread 1
ORA-00312: online log 38 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken37'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 38 of thread 1
ORA-00312: online log 38 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken37'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 39 of thread 1
ORA-00312: online log 39 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken38'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 39 of thread 1
ORA-00312: online log 39 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken38'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 40 of thread 1
ORA-00312: online log 40 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken39'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 40 of thread 1
ORA-00312: online log 40 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken39'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 41 of thread 1
ORA-00312: online log 41 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken40'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 41 of thread 1
ORA-00312: online log 41 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken40'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 42 of thread 1
ORA-00312: online log 42 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken41'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 42 of thread 1
ORA-00312: online log 42 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken41'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 43 of thread 1
ORA-00312: online log 43 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken42'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 43 of thread 1
ORA-00312: online log 43 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken42'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 44 of thread 1
ORA-00312: online log 44 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken43'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 44 of thread 1
ORA-00312: online log 44 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken43'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 45 of thread 1
ORA-00312: online log 45 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken44'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 45 of thread 1
ORA-00312: online log 45 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken44'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 46 of thread 1
ORA-00312: online log 46 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken45'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 46 of thread 1
ORA-00312: online log 46 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken45'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 47 of thread 1
ORA-00312: online log 47 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken46'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 47 of thread 1
ORA-00312: online log 47 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken46'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 48 of thread 1
ORA-00312: online log 48 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken47'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 48 of thread 1
ORA-00312: online log 48 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken47'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 49 of thread 1
ORA-00312: online log 49 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken48'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 49 of thread 1
ORA-00312: online log 49 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken48'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 50 of thread 1
ORA-00312: online log 50 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken49'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 50 of thread 1
ORA-00312: online log 50 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken49'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 51 of thread 1
ORA-00312: online log 51 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken50'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 51 of thread 1
ORA-00312: online log 51 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken50'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 52 of thread 1
ORA-00312: online log 52 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken51'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 52 of thread 1
ORA-00312: online log 52 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken51'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 53 of thread 1
ORA-00312: online log 53 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken52'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 53 of thread 1
ORA-00312: online log 53 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken52'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 54 of thread 1
ORA-00312: online log 54 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken53'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 54 of thread 1
ORA-00312: online log 54 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken53'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 55 of thread 1
ORA-00312: online log 55 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken54'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 55 of thread 1
ORA-00312: online log 55 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken54'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 56 of thread 1
ORA-00312: online log 56 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken55'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 56 of thread 1
ORA-00312: online log 56 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken55'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 57 of thread 1
ORA-00312: online log 57 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken56'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 57 of thread 1
ORA-00312: online log 57 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken56'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 58 of thread 1
ORA-00312: online log 58 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken57'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 58 of thread 1
ORA-00312: online log 58 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken57'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 59 of thread 1
ORA-00312: online log 59 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken58'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 59 of thread 1
ORA-00312: online log 59 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken58'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 60 of thread 1
ORA-00312: online log 60 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken59'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/sjjhdg/sjjh1/trace/sjjh1_lgwr_54343.trc:
ORA-00313: open failed for members of log group 60 of thread 1
ORA-00312: online log 60 thread 1: '/u01/app/oracle/product/11.2.0/db_1/dbs/broken59'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Completed: ALTER DATABASE MOUNT
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
Mon Mar 02 08:35:50 2020
alter database open
AUDIT_TRAIL initialization parameter is changed to OS, as DB is NOT compatible for database opened with read-only access
查看主库的alert.log文件发现主库不能将日志同步到备库,原因是因为主备库之间网络故障
Mon Mar 02 01:17:22 2020
Thread 1 cannot allocate new log, sequence 3357
Private strand flush not complete
Current log# 11 seq# 3356 mem# 0: /oradata/sjjh/redo11.log
LGWR: Standby redo logfile selected for thread 1 sequence 3357 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3357 (LGWR switch)
Current log# 12 seq# 3357 mem# 0: /oradata/sjjh/redo12.log
Mon Mar 02 01:17:29 2020
Archived Log entry 6342 added for thread 1 sequence 3356 ID 0xfc687662 dest 1:
Mon Mar 02 02:00:00 2020
Closing scheduler window
Closing Resource Manager plan via scheduler window
Clearing Resource Manager plan via parameter
Mon Mar 02 02:33:30 2020
Thread 1 cannot allocate new log, sequence 3358
Private strand flush not complete
Current log# 12 seq# 3357 mem# 0: /oradata/sjjh/redo12.log
LGWR: Standby redo logfile selected for thread 1 sequence 3358 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3358 (LGWR switch)
Current log# 13 seq# 3358 mem# 0: /oradata/sjjh/redo13.log
Mon Mar 02 02:33:38 2020
Archived Log entry 6344 added for thread 1 sequence 3357 ID 0xfc687662 dest 1:
Mon Mar 02 03:45:12 2020
Thread 1 cannot allocate new log, sequence 3359
Private strand flush not complete
Current log# 13 seq# 3358 mem# 0: /oradata/sjjh/redo13.log
LGWR: Standby redo logfile selected for thread 1 sequence 3359 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3359 (LGWR switch)
Current log# 14 seq# 3359 mem# 0: /oradata/sjjh/redo14.log
Mon Mar 02 03:45:19 2020
Archived Log entry 6346 added for thread 1 sequence 3358 ID 0xfc687662 dest 1:
Mon Mar 02 08:24:54 2020
LGWR: Attempting destination LOG_ARCHIVE_DEST_2 network reconnect (3113)
LGWR: Destination LOG_ARCHIVE_DEST_2 network reconnect abandoned
Error 3113 for archive log file 14 to 'jhk_st'
LGWR: Error 1041 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'jhk_st'
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
Thread 1 cannot allocate new log, sequence 3360
Private strand flush not complete
Current log# 14 seq# 3359 mem# 0: /oradata/sjjh/redo14.log
LGWR: Failed to archive log 14 thread 1 sequence 3359 (3113)
Thread 1 advanced to log sequence 3360 (LGWR switch)
Current log# 15 seq# 3360 mem# 0: /oradata/sjjh/redo15.log
Mon Mar 02 08:25:01 2020
Archived Log entry 6347 added for thread 1 sequence 3359 ID 0xfc687662 dest 1:
Mon Mar 02 08:30:31 2020
Thread 1 cannot allocate new log, sequence 3361
Private strand flush not complete
Current log# 15 seq# 3360 mem# 0: /oradata/sjjh/redo15.log
Mon Mar 02 08:30:52 2020
LGWR: Standby redo logfile selected for thread 1 sequence 3361 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3361 (LGWR switch)
Current log# 16 seq# 3361 mem# 0: /oradata/sjjh/redo16.log
Mon Mar 02 08:30:52 2020
Archived Log entry 6349 added for thread 1 sequence 3360 ID 0xfc687662 dest 1:
Mon Mar 02 08:30:52 2020
ARC0: Standby redo logfile selected for thread 1 sequence 3360 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 08:54:23 2020
LGWR: Attempting destination LOG_ARCHIVE_DEST_2 network reconnect (272)
LGWR: Destination LOG_ARCHIVE_DEST_2 network reconnect abandoned
Error 272 for archive log file 16 to 'jhk_st'
Mon Mar 02 08:55:04 2020
Thread 1 cannot allocate new log, sequence 3362
Private strand flush not complete
Current log# 16 seq# 3361 mem# 0: /oradata/sjjh/redo16.log
LGWR: Failed to archive log 16 thread 1 sequence 3361 (272)
Thread 1 advanced to log sequence 3362 (LGWR switch)
Current log# 17 seq# 3362 mem# 0: /oradata/sjjh/redo17.log
Mon Mar 02 08:55:07 2020
Archived Log entry 6351 added for thread 1 sequence 3361 ID 0xfc687662 dest 1:
Mon Mar 02 09:00:04 2020
ARC3: Standby redo logfile selected for thread 1 sequence 3361 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:00:04 2020
Thread 1 cannot allocate new log, sequence 3363
Private strand flush not complete
Current log# 17 seq# 3362 mem# 0: /oradata/sjjh/redo17.log
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3363 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3363 (LGWR switch)
Current log# 18 seq# 3363 mem# 0: /oradata/sjjh/redo18.log
Mon Mar 02 09:00:08 2020
Archived Log entry 6353 added for thread 1 sequence 3362 ID 0xfc687662 dest 1:
ARC3: Standby redo logfile selected for thread 1 sequence 3362 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:13:31 2020
LGWR: Attempting destination LOG_ARCHIVE_DEST_2 network reconnect (3113)
LGWR: Destination LOG_ARCHIVE_DEST_2 network reconnect abandoned
Error 3113 for archive log file 18 to 'jhk_st'
LGWR: Error 1041 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'jhk_st'
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
Thread 1 cannot allocate new log, sequence 3364
Private strand flush not complete
Current log# 18 seq# 3363 mem# 0: /oradata/sjjh/redo18.log
LGWR: Failed to archive log 18 thread 1 sequence 3363 (3113)
Thread 1 advanced to log sequence 3364 (LGWR switch)
Current log# 19 seq# 3364 mem# 0: /oradata/sjjh/redo19.log
Mon Mar 02 09:13:36 2020
Archived Log entry 6355 added for thread 1 sequence 3363 ID 0xfc687662 dest 1:
Mon Mar 02 09:14:42 2020
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY SID='*';
Mon Mar 02 09:14:43 2020
ARC3: Standby redo logfile selected for thread 1 sequence 3363 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:14:45 2020
Thread 1 cannot allocate new log, sequence 3365
Private strand flush not complete
Current log# 19 seq# 3364 mem# 0: /oradata/sjjh/redo19.log
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3365 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3365 (LGWR switch)
Current log# 20 seq# 3365 mem# 0: /oradata/sjjh/redo20.log
Mon Mar 02 09:14:48 2020
Archived Log entry 6357 added for thread 1 sequence 3364 ID 0xfc687662 dest 1:
Mon Mar 02 09:16:14 2020
LGWR: Attempting destination LOG_ARCHIVE_DEST_2 network reconnect (272)
LGWR: Destination LOG_ARCHIVE_DEST_2 network reconnect abandoned
Error 272 for archive log file 20 to 'jhk_st'
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
Thread 1 cannot allocate new log, sequence 3366
Private strand flush not complete
Current log# 20 seq# 3365 mem# 0: /oradata/sjjh/redo20.log
LGWR: Failed to archive log 20 thread 1 sequence 3365 (272)
Thread 1 advanced to log sequence 3366 (LGWR switch)
Current log# 21 seq# 3366 mem# 0: /oradata/sjjh/redo21.log
Mon Mar 02 09:16:19 2020
Archived Log entry 6359 added for thread 1 sequence 3365 ID 0xfc687662 dest 1:
Mon Mar 02 09:22:07 2020
Thread 1 cannot allocate new log, sequence 3367
Private strand flush not complete
Current log# 21 seq# 3366 mem# 0: /oradata/sjjh/redo21.log
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3367 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3367 (LGWR switch)
Current log# 22 seq# 3367 mem# 0: /oradata/sjjh/redo22.log
Mon Mar 02 09:22:10 2020
Archived Log entry 6361 added for thread 1 sequence 3366 ID 0xfc687662 dest 1:
Mon Mar 02 09:29:22 2020
LGWR: Attempting destination LOG_ARCHIVE_DEST_2 network reconnect (3113)
LGWR: Destination LOG_ARCHIVE_DEST_2 network reconnect abandoned
Error 3113 for archive log file 22 to 'jhk_st'
LGWR: Error 1041 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'jhk_st'
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
Thread 1 cannot allocate new log, sequence 3368
Private strand flush not complete
Current log# 22 seq# 3367 mem# 0: /oradata/sjjh/redo22.log
LGWR: Failed to archive log 22 thread 1 sequence 3367 (3113)
Thread 1 advanced to log sequence 3368 (LGWR switch)
Current log# 23 seq# 3368 mem# 0: /oradata/sjjh/redo23.log
Mon Mar 02 09:29:26 2020
Archived Log entry 6363 added for thread 1 sequence 3367 ID 0xfc687662 dest 1:
Mon Mar 02 09:30:04 2020
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY SID='*';
Mon Mar 02 09:30:05 2020
ARC3: Standby redo logfile selected for thread 1 sequence 3367 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:30:05 2020
Thread 1 cannot allocate new log, sequence 3369
Private strand flush not complete
Current log# 23 seq# 3368 mem# 0: /oradata/sjjh/redo23.log
Suppressing further error logging of LOG_ARCHIVE_DEST_2.
FAL[server, ARC3]: FAL archive failed, see trace file.
ARCH: FAL archive failed. Archiver continuing
ORACLE Instance sjjh - Archival Error. Archiver continuing.
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3369 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3369 (LGWR switch)
Current log# 24 seq# 3369 mem# 0: /oradata/sjjh/redo24.log
Mon Mar 02 09:30:08 2020
Archived Log entry 6365 added for thread 1 sequence 3368 ID 0xfc687662 dest 1:
ARC3: Standby redo logfile selected for thread 1 sequence 3368 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:31:27 2020
Suppressing further error logging of LOG_ARCHIVE_DEST_2.
Suppressing further error logging of LOG_ARCHIVE_DEST_2.
Suppressing further error logging of LOG_ARCHIVE_DEST_2.
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
Thread 1 cannot allocate new log, sequence 3370
Private strand flush not complete
Current log# 24 seq# 3369 mem# 0: /oradata/sjjh/redo24.log
LGWR: Failed to archive log 24 thread 1 sequence 3369 (272)
Thread 1 advanced to log sequence 3370 (LGWR switch)
Current log# 25 seq# 3370 mem# 0: /oradata/sjjh/redo25.log
Mon Mar 02 09:31:33 2020
Archived Log entry 6367 added for thread 1 sequence 3369 ID 0xfc687662 dest 1:
Mon Mar 02 09:37:09 2020
Thread 1 cannot allocate new log, sequence 3371
Private strand flush not complete
Current log# 25 seq# 3370 mem# 0: /oradata/sjjh/redo25.log
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3371 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3371 (LGWR switch)
Current log# 26 seq# 3371 mem# 0: /oradata/sjjh/redo26.log
Mon Mar 02 09:37:12 2020
Archived Log entry 6369 added for thread 1 sequence 3370 ID 0xfc687662 dest 1:
Mon Mar 02 09:37:12 2020
ARC3: Standby redo logfile selected for thread 1 sequence 3370 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:42:26 2020
Destination LOG_ARCHIVE_DEST_2 is UNSYNCHRONIZED
Thread 1 cannot allocate new log, sequence 3372
Private strand flush not complete
Current log# 26 seq# 3371 mem# 0: /oradata/sjjh/redo26.log
LGWR: Failed to archive log 26 thread 1 sequence 3371 (3113)
Thread 1 advanced to log sequence 3372 (LGWR switch)
Current log# 27 seq# 3372 mem# 0: /oradata/sjjh/redo27.log
Mon Mar 02 09:42:31 2020
Archived Log entry 6371 added for thread 1 sequence 3371 ID 0xfc687662 dest 1:
Mon Mar 02 09:44:23 2020
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY SID='*';
Mon Mar 02 09:44:23 2020
ARC0: Standby redo logfile selected for thread 1 sequence 3371 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:44:25 2020
Thread 1 cannot allocate new log, sequence 3373
Private strand flush not complete
Current log# 27 seq# 3372 mem# 0: /oradata/sjjh/redo27.log
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3373 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3373 (LGWR switch)
Current log# 28 seq# 3373 mem# 0: /oradata/sjjh/redo28.log
Mon Mar 02 09:44:28 2020
Archived Log entry 6373 added for thread 1 sequence 3372 ID 0xfc687662 dest 1:
Mon Mar 02 09:44:28 2020
ARC3: Standby redo logfile selected for thread 1 sequence 3372 for destination LOG_ARCHIVE_DEST_2
Mon Mar 02 09:45:34 2020
Thread 1 cannot allocate new log, sequence 3374
Private strand flush not complete
Current log# 28 seq# 3373 mem# 0: /oradata/sjjh/redo28.log
LGWR: Standby redo logfile selected for thread 1 sequence 3374 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3374 (LGWR switch)
Current log# 29 seq# 3374 mem# 0: /oradata/sjjh/redo29.log
Mon Mar 02 09:45:35 2020
Archived Log entry 6376 added for thread 1 sequence 3373 ID 0xfc687662 dest 1:
Mon Mar 02 13:45:51 2020
LGWR: Standby redo logfile selected for thread 1 sequence 3375 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3375 (LGWR switch)
Current log# 30 seq# 3375 mem# 0: /oradata/sjjh/redo30.log
Mon Mar 02 13:45:55 2020
Archived Log entry 6378 added for thread 1 sequence 3374 ID 0xfc687662 dest 1:
Mon Mar 02 13:47:12 2020
Thread 1 cannot allocate new log, sequence 3376
Private strand flush not complete
Current log# 30 seq# 3375 mem# 0: /oradata/sjjh/redo30.log
Destination LOG_ARCHIVE_DEST_2 no longer supports SYNCHRONIZATION
Thread 1 advanced to log sequence 3376 (LGWR switch)
Current log# 1 seq# 3376 mem# 0: /oradata/sjjh/redo01.log
Mon Mar 02 13:47:19 2020
Archived Log entry 6380 added for thread 1 sequence 3375 ID 0xfc687662 dest 1:
Mon Mar 02 22:00:00 2020
Setting Resource Manager plan SCHEDULER[0x32D9]:DEFAULT_MAINTENANCE_PLAN via scheduler window
Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter
Mon Mar 02 22:00:00 2020
Starting background process VKRM
Mon Mar 02 22:00:00 2020
VKRM started with pid=47, OS id=81983
Mon Mar 02 22:00:02 2020
Begin automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK"
Mon Mar 02 22:01:00 2020
End automatic SQL Tuning Advisor run for special tuning task "SYS_AUTO_SQL_TUNING_TASK"
Tue Mar 03 00:38:04 2020
Thread 1 cannot allocate new log, sequence 3377
Private strand flush not complete
Current log# 1 seq# 3376 mem# 0: /oradata/sjjh/redo01.log
Destination LOG_ARCHIVE_DEST_2 is SYNCHRONIZED
LGWR: Standby redo logfile selected for thread 1 sequence 3377 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3377 (LGWR switch)
Current log# 2 seq# 3377 mem# 0: /oradata/sjjh/redo02.log
Tue Mar 03 00:38:12 2020
Archived Log entry 6382 added for thread 1 sequence 3376 ID 0xfc687662 dest 1:
Tue Mar 03 00:40:10 2020
LGWR: Standby redo logfile selected for thread 1 sequence 3378 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 3378 (LGWR switch)
Current log# 3 seq# 3378 mem# 0: /oradata/sjjh/redo03.log

明白原因之后现在可以删除dbs目录中的broker*文件来释放空间

使用mysqldump以文本分隔格式来dump数据

这里将介绍如何使用mysqldump来创建文本分隔格式的dump文件。在调用mysqldump时使用–tab=dir_name选项时,使用dir_name作为输出目录并且在输出目录是为每个表生成两个文件。表名是这些文件的基础名称。对表t,文件名为t.sql和t.txt。其中.sql文件包含的是表的 create table语句。.txt文件包含的是表数据,每一条记录一行。下面的命令将数据库mysql的内容dump到/mysqldata/tmp目录中

在用mysqldump备份时候遇到1290的错误

从提示看到是因为mysql服务启用了--secure-file-priv,所以才无法执行。这个选项或系统变量用被来限制通过load data和select ... into outfile语句和load_file()函数所执行导入和导出操作的数据量。

secure_file_priv有以下设置:
.如果为空,变量不生效。没有安全设置。
.如果设置为一个目录名,服务器对导入和导出操作只对这个目录中的文件生效,但目录必须存在,服务器不会创建目录。
.如果设置NULL,服务器禁止导入和导出操作。

查看数据库当前设置:

mysql> show global variables like '%secur%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| require_secure_transport | OFF   |
| secure_auth              | ON    |
| secure_file_priv         | NULL  |
+--------------------------+-------+
3 rows in set (0.01 sec)

看到secure_file_priv当前设置为NULL,说明限制导入和导出操作。

查看配置文件my.cnf发现没有设置secure_file_priv参数,那么这个参数默认应该是为NULL。

[mysql@localhost mysql]$ cat my.cnf


[mysqld]
basedir=/mysqlsoft/mysql
datadir=/mysqldata/mysql
bind-address=*
user=mysql
port=3306
log-error=/mysqldata/mysql/mysql.err
pid-file=/mysqldata/mysql/mysqld.pid
socket = /mysqlsoft/mysql/mysql.sock
character-set-server=utf8mb4
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
innodb_flush_method=O_DIRECT
binlog_format = mixed
log-bin=/mysqldata/mysql/binlog
max_binlog_size = 100m
binlog_cache_size = 4m
server-id=1

修改配置文件my.cnf参加secure_file_priv=

[mysql@localhost mysql]$ vi my.cnf
.....
secure-file-priv=

重启mysql数据库

[root@localhost ~]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL.. SUCCESS!

再次检查secure_file_priv参数设置

mysql> show global variables like '%secur%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| require_secure_transport | OFF   |
| secure_auth              | ON    |
| secure_file_priv         |       |
+--------------------------+-------+
3 rows in set (0.00 sec)

再执行导出操作成功

[mysql@localhost ~]$ mysqldump -uroot -pxxzx7817600 --tab=/mysqldata/tmp  mysql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

数据库服务器会生成包含数据内容的.txt文件,因此它是属于运行数据库服务的系统账号。服务器使用select … into outfile来写这个文件,因此你必须有file权限才能执行这个操作,如果一个特定的.txt文件已经存在的话会出错。

数据库服务器为被dump的表发送create定义语句来mysqldump,它将被写入到.sql文件中。因此这些文件属于执行mysqldump命令的用户。

–tab选项最好只在本地服务器上执行dump。如果将它用于远程服务器,–tab选项所指定的目录必须在本地服务器和远程服务器上都要存在,燕且.txt文件会被服务器写入远程目录(数据库服务器所在主机),而.sql文件将被mysqldump写入本地目录(客户端所在主机)。

对于mysqldump –tab,服务器默认情况下将表数据写入.txt文件,每行表记录一行,列值之间使用制表符,列值周围不使用引号,换行符作为行结束符。

为了能在写入数据文件时使用不同的格式,mysqldump支持以下选项:
.–fields-terminated-by=str
列值分隔符(默认为:tab制表符)

.–fields-enclosed-by=char
将列值括在其中的字符(默认为:没有)

.–fields-optionally-enclosed-by=char
用来括起非数值列值的字符(默认为:没有)

.–fields-escaped-by=char
用于转义特殊字符的字符(默认为:没有转义)
.–lines-terminated-by=str
行终止符(默认为:新行)

根据你所为这些选项指定的值,为了让命令解释器能正确处理可能需要在命令行中为这些值使用引号或转义。另外可以以十六进制格式来指定。假设你想用双引号引用列值。为了达到这个目的应该为–fields-enclosed-by选项指定双引号。但双引号通常对于命令解释器有特定含义并且必须特定对待。例如,在Unix中,可以使用引号来指定双引号:
–fields-enclosed-by='”‘

在任何平台中,可以指定十六进制值:
–fields-enclosed-by=0x22

同时使用几个数据格式化选项是很常见的。例如,为了使用通过回车/换行符对(\r\n)作为行终止符的逗号分隔值格式来dump表,可以执行以下命令:

[mysql@localhost tmp]$ mysqldump -uroot -pxxzx7817600 --tab=/mysqldata/tmp --fields-terminated-by=, --fields-enclosed-by='"'  --lines-terminated-by=0x0d0a mysql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

[mysql@localhost tmp]$ ls -lrt
总用量 3128
-rw-r--r--. 1 mysql mysql    1871 7月   9 17:54 rewrite_rules.sql
-rw-r--r--. 1 mysql mysql    1876 7月  10 15:37 columns_priv.sql
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 columns_priv.txt
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 count.txt
-rw-r--r--. 1 mysql mysql    1298 7月  10 15:37 count.sql
-rw-rw-rw-. 1 mysql mysql       7 7月  10 15:37 cs.txt
-rw-r--r--. 1 mysql mysql    1359 7月  10 15:37 cs.sql
-rw-r--r--. 1 mysql mysql    2917 7月  10 15:37 db.sql
-rw-rw-rw-. 1 mysql mysql     198 7月  10 15:37 db.txt
-rw-rw-rw-. 1 mysql mysql     114 7月  10 15:37 engine_cost.txt
-rw-r--r--. 1 mysql mysql    1630 7月  10 15:37 engine_cost.sql
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 event.txt
-rw-r--r--. 1 mysql mysql    3350 7月  10 15:37 event.sql
-rw-r--r--. 1 mysql mysql    1557 7月  10 15:37 func.sql
-rw-rw-rw-. 1 mysql mysql     398 7月  10 15:37 func.txt
-rw-r--r--. 1 mysql mysql    1578 7月  10 15:37 gtid_executed.sql
-rw-rw-rw-. 1 mysql mysql     964 7月  10 15:37 help_category.txt
-rw-r--r--. 1 mysql mysql    1563 7月  10 15:37 help_category.sql
-rw-r--r--. 1 mysql mysql    1471 7月  10 15:37 help_keyword.sql
-rw-rw-rw-. 1 mysql mysql    9748 7月  10 15:37 help_keyword.txt
-rw-r--r--. 1 mysql mysql    1486 7月  10 15:37 help_relation.sql
-rw-rw-rw-. 1 mysql mysql   10771 7月  10 15:37 help_relation.txt
-rw-r--r--. 1 mysql mysql    1592 7月  10 15:37 help_topic.sql
-rw-rw-rw-. 1 mysql mysql  712538 7月  10 15:37 help_topic.txt
-rw-rw-rw-. 1 mysql mysql      32 7月  10 15:37 imptest.txt
-rw-r--r--. 1 mysql mysql    1337 7月  10 15:37 imptest.sql
-rw-r--r--. 1 mysql mysql    1879 7月  10 15:37 innodb_index_stats.sql
-rw-rw-rw-. 1 mysql mysql    2647 7月  10 15:37 innodb_index_stats.txt
-rw-rw-rw-. 1 mysql mysql     395 7月  10 15:37 innodb_table_stats.txt
-rw-r--r--. 1 mysql mysql    1745 7月  10 15:37 innodb_table_stats.sql
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 ndb_binlog_index.txt
-rw-r--r--. 1 mysql mysql    1842 7月  10 15:37 ndb_binlog_index.sql
-rw-rw-rw-. 1 mysql mysql      76 7月  10 15:37 person.txt
-rw-r--r--. 1 mysql mysql    1571 7月  10 15:37 person.sql
-rw-r--r--. 1 mysql mysql    1420 7月  10 15:37 plugin.sql
-rw-rw-rw-. 1 mysql mysql      53 7月  10 15:37 plugin.txt
-rw-r--r--. 1 mysql mysql    3067 7月  10 15:37 proc.sql
-rw-rw-rw-. 1 mysql mysql     806 7月  10 15:37 proc.txt
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 procs_priv.txt
-rw-r--r--. 1 mysql mysql    1970 7月  10 15:37 procs_priv.sql
-rw-rw-rw-. 1 mysql mysql      60 7月  10 15:37 proxies_priv.txt
-rw-r--r--. 1 mysql mysql    1862 7月  10 15:37 proxies_priv.sql
-rw-rw-rw-. 1 mysql mysql     297 7月  10 15:37 server_cost.txt
-rw-r--r--. 1 mysql mysql    1530 7月  10 15:37 server_cost.sql
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 servers.txt
-rw-r--r--. 1 mysql mysql    1730 7月  10 15:37 servers.sql
-rw-r--r--. 1 mysql mysql    4150 7月  10 15:37 slave_master_info.sql
-rw-r--r--. 1 mysql mysql    2406 7月  10 15:37 slave_relay_log_info.sql
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 slave_worker_info.txt
-rw-r--r--. 1 mysql mysql    2221 7月  10 15:37 slave_worker_info.sql
-rw-r--r--. 1 mysql mysql    1342 7月  10 15:37 t.sql
-rw-rw-rw-. 1 mysql mysql      52 7月  10 15:37 t.txt
-rw-rw-rw-. 1 mysql mysql       3 7月  10 15:37 t1.txt
-rw-r--r--. 1 mysql mysql    1291 7月  10 15:37 t1.sql
-rw-r--r--. 1 mysql mysql    1306 7月  10 15:37 t2.sql
-rw-rw-rw-. 1 mysql mysql       4 7月  10 15:37 t2.txt
-rw-rw-rw-. 1 mysql mysql     162 7月  10 15:37 tables_priv.txt
-rw-r--r--. 1 mysql mysql    2068 7月  10 15:37 tables_priv.sql
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 test.txt
-rw-r--r--. 1 mysql mysql    1304 7月  10 15:37 test.sql
-rw-r--r--. 1 mysql mysql    1487 7月  10 15:37 time_zone.sql
-rw-rw-rw-. 1 mysql mysql   11122 7月  10 15:37 time_zone.txt
-rw-rw-rw-. 1 mysql mysql       0 7月  10 15:37 time_zone_leap_second.txt
-rw-r--r--. 1 mysql mysql    1493 7月  10 15:37 time_zone_leap_second.sql
-rw-r--r--. 1 mysql mysql    1435 7月  10 15:37 time_zone_name.sql
-rw-rw-rw-. 1 mysql mysql   41245 7月  10 15:37 time_zone_name.txt
-rw-r--r--. 1 mysql mysql    1548 7月  10 15:37 time_zone_transition.sql
-rw-rw-rw-. 1 mysql mysql 1998482 7月  10 15:37 time_zone_transition.txt
-rw-r--r--. 1 mysql mysql    1670 7月  10 15:37 time_zone_transition_type.sql
-rw-rw-rw-. 1 mysql mysql  161600 7月  10 15:37 time_zone_transition_type.txt
-rw-rw-rw-. 1 mysql mysql     878 7月  10 15:37 user.txt
-rw-r--r--. 1 mysql mysql    4390 7月  10 15:37 user.sql
-rw-r--r--. 1 mysql mysql    1576 7月  10 15:37 general_log.sql
-rw-r--r--. 1 mysql mysql    1757 7月  10 15:37 slow_log.sql


mysql> select * from t;
+----+----------+------+
| id | name     | date |
+----+----------+------+
|  1 | jingyong | NULL |
|  2 | yeyali   | NULL |
|  3 | huangyan | NULL |
|  4 | wenyao   | NULL |
+----+----------+------+
4 rows in set (0.00 sec)


[mysql@localhost tmp]$ cat t.sql
-- MySQL dump 10.13  Distrib 5.7.26, for Linux (x86_64)
--
-- Host: localhost    Database: mysql
-- ------------------------------------------------------
-- Server version       5.7.26-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `t`
--

DROP TABLE IF EXISTS `t`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t` (
  `id` int(11) NOT NULL,
  `name` varchar(20) NOT NULL,
  `date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-07-10 15:37:05

[mysql@localhost tmp]$ cat t.txt
"1","jingyong",\N
"2","yeyali",\N
"3","huangyan",\N
"4","wenyao",\N

如果使用任何数据格式化选项来转储表数据,则在稍后重新加载数据文件时需要指定相同的格式,以确保正确地解释文件内容。

重新加载文本分隔格式的备份文件
对于使用mysqldump –tab命令所生成的备份,每个表在输出目录中都有一个包含create table语句的.sql文件和一个包含表数据的.txt文件。为了重新加载表,首先进入到输出目录。然后使用msyql命令来处理.sql文件创建一个空表,再执行mysqlimport来处理.txt文件加载数据:

[mysql@localhost tmp]$ mysql -uroot -pxxzx7817600  mysql < t.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

[mysql@localhost tmp]$ mysqlimport -uroot -pxxzx7817600  --fields-terminated-by=, --fields-enclosed-by='"'  --lines-terminated-by=0x0d0a mysql /mysqldata/tmp/t.txt
mysqlimport: [Warning] Using a password on the command line interface can be insecure.
mysql.t: Records: 4  Deleted: 0  Skipped: 0  Warnings: 0


mysql> select * from t;
+----+----------+------+
| id | name     | date |
+----+----------+------+
|  1 | jingyong | NULL |
|  2 | yeyali   | NULL |
|  3 | huangyan | NULL |
|  4 | wenyao   | NULL |
+----+----------+------+
4 rows in set (0.00 sec)

另一种替mysqlimport来加载数据文件的方式是使用load data infile语句:

mysql> load data infile '/mysqldata/tmp/t.txt' into table t fields terminated by ',' enclosed by '"' lines terminated by 0x0d0a;
Query OK, 4 rows affected (0.03 sec)
Records: 4  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from t;
+----+----------+------+
| id | name     | date |
+----+----------+------+
|  1 | jingyong | NULL |
|  2 | yeyali   | NULL |
|  3 | huangyan | NULL |
|  4 | wenyao   | NULL |
+----+----------+------+
4 rows in set (0.00 sec)

使用mysqldump以SQL格式来dump数据

Using mysqldump for Backups
使用mysqldump工具可以以以下几种方式来生成dump文件:
.作为备份在数据丢失的情况下来执行数据恢复
.作为源数据用来配置复制从服务器
.作为源数据用来进行实验:
-为了复制数据库而不用改变源数据
-为了测试潜在的升级后不兼容的问题

mysqldump生成两种类型的输出,这依赖于是否使用–tab选项:
.不使用–tab选项,mysqldump将输出SQL语句到标准输出。这类输出由创建dump对象(数据库,表,存储过程等)的create语句组成,并且包含向表加载数据的insert语句。输出可以被保存大文件中并且之后可以使用mysql来重新加载来重新创建被dump的对象。有一些选项可用于修改SQL语句的格式,以及控制转储哪些对象。

.使用–tab选项,mysqldump将为每个被dump的对象生成两个输出文件。服务器以制表符分隔的文本形式写入一个文件用来存储表记录,每条记录一行。这个文件名为tbl_name.txt被保存输出目录中。服务器还会在输出目录中生成一个名为tbl_name.sql的文件用来存储create table语句。

使用mysqldump以SQL格式来dump数据
默认情况下,mysqldump以SQL语句来作为标准输出。可以将输出保存到文件中:

为了dump所有数据库,可以使用–all-databases选项来调用mysqldump

[mysql@localhost ~]$ mysqldump -uroot -pabcd1234 --all-databases > all_db_dump.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

为了dump指定的数据库,可以使用–databases选项来指定

[mysql@localhost ~]$ mysqldump -uroot -pabcd1234 --databases mysql query_rewrite > dump.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

–databases选项会让命令行中的所有名字作为数据库名字来对待。不使用这个选项,mysqldump将第一个名字作为数据库名后面的作为表名对待。

使用–all-databases或–databases选项,mysqldump在dump每个数据库之前会写入create database和use语句。这确保了当dump文件被重新加载时,如果不存在数据库时会创建数据库并使它作为默认数据库使用数据库的内容被加载到相同的数据库中。如果想让dump文件在重建数据之前强制删除每个数据库,可以使用–add-drop-database选项。在这种情况下,mysqldump会在每个create database语句之前写一个drop database语句。

为了dump单个数据库,在命令行中指定数据库名:

[mysql@localhost ~]$ mysqldump -uroot -pabcd1234 --databases mysql > dump_mysql.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

在dump单个数据库的情况下,可以忽略–databases选项:

[mysql@localhost ~]$ mysqldump -uroot -pabcd1234  mysql > dump_mysql_1.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.



[mysql@localhost ~]$ more dump_mysql.sql
-- MySQL dump 10.13  Distrib 5.7.26, for Linux (x86_64)
--
-- Host: localhost    Database: mysql
-- ------------------------------------------------------
-- Server version       5.7.26-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `mysql`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysql` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;

USE `mysql`;

--
-- Table structure for table `columns_priv`
--

[mysql@localhost ~]$ more dump_mysql_1.sql
-- MySQL dump 10.13  Distrib 5.7.26, for Linux (x86_64)
--
-- Host: localhost    Database: mysql
-- ------------------------------------------------------
-- Server version       5.7.26-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `columns_priv`
--

上面两个命令之间的差异就在于不使用–databases选项时,dump输出不会包含create database或use语句。这有几种含义:
.当重新加载dump文件时,你必须指定一个默认数据库名因此服务器就会知道那个数据库会被加载。
.为了重新加载,可以指定一个不同于原始数据库名的数据库名,这能让你加载数据到不同的数据库中。
.如果被加载的数据库不存在,你必须先创建数据库。
.因为输出将不会包含create database语句,–add-drop-database选项没有影响。如果使用它,将不会生成drop database语句。

为了dump一个数据库中的指定表,在命令行中指定数据库名后指定表名:

[mysql@localhost ~]$ mysqldump -uroot -pabcd1234  mysql t t1 t2 > dump_tables.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[mysql@localhost ~]$ cat dump_tables.sql
-- MySQL dump 10.13  Distrib 5.7.26, for Linux (x86_64)
--
-- Host: localhost    Database: mysql
-- ------------------------------------------------------
-- Server version       5.7.26-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `t`
--

DROP TABLE IF EXISTS `t`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t` (
  `id` int(11) NOT NULL,
  `name` varchar(20) NOT NULL,
  `date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t`
--

LOCK TABLES `t` WRITE;
/*!40000 ALTER TABLE `t` DISABLE KEYS */;
INSERT INTO `t` VALUES (1,'jingyong',NULL),(2,'yeyali',NULL),(3,'huangyan',NULL),(4,'wenyao',NULL);
/*!40000 ALTER TABLE `t` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `t1`
--

DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
  `c1` char(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t1`
--

LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES ('xy');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `t2`
--

DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
  `i` int(10) NOT NULL,
  PRIMARY KEY (`i`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `t2`
--

LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT INTO `t2` VALUES (0),(1);
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-07-10 17:19:42

重新加载SQL格式备份
为了重新加载由mysqldump工具生成的由SQL语句组成的dump文件,使用这个dump文件作为mysql客户端的输入。如果dump文件是由使用–all-databases或–databases选项的mysqldump命令所生成,它将包含create database和use语句并且不需要为加载的数据指定默认数据库。

[mysql@localhost ~]$ mysql -uroot -pabcd1234  mysql  < dump_tables.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

一种替代的方式是通过在mysql命令提示符下使用source命令:

mysql> source /var/lib/mysql/dump_tables.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 4 rows affected (0.02 sec)
Records: 4  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> select * from t;
+----+----------+------+
| id | name     | date |
+----+----------+------+
|  1 | jingyong | NULL |
|  2 | yeyali   | NULL |
|  3 | huangyan | NULL |
|  4 | wenyao   | NULL |
+----+----------+------+
4 rows in set (0.00 sec)

mysql> select * from t1;
+------+
| c1   |
+------+
| xy   |
+------+
1 row in set (0.00 sec)

mysql> select * from t2;
+---+
| i |
+---+
| 0 |
| 1 |
+---+
2 rows in set (0.00 sec)

如果dump文件是单数据库dump且不包含create database和use语句,那么首先需要创建数据库(必须的):

shell> mysqladmin create db1

然后在加载dump文件时指定数据库名:

shell> mysql db1 < dump.sql

另一种方式,在mysql提示符中,创建数据库,选它作为默认数据库,然后加载dump文件:

mysql> create database if not exists db1;
mysql> use db1;
mysql> source /var/lib/mysql/dump_tables.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.10 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 4 rows affected (0.02 sec)
Records: 4  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.08 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysqldump Got error 1290

在用mysqldump备份时候遇到1290的错误

[mysql@localhost ~]$ mysqldump -uroot -pxxzx7817600 --tab=/mysqldata/tmp  query_rewrite
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'

从提示看到是因为mysql服务启用了–secure-file-priv,所以才无法执行。这个选项或系统变量用被来限制通过load data和select … into outfile语句和load_file()函数所执行导入和导出操作的数据量。

secure_file_priv有以下设置:
.如果为空,变量不生效。没有安全设置。
.如果设置为一个目录名,服务器对导入和导出操作只对这个目录中的文件生效,但目录必须存在,服务器不会创建目录。
.如果设置NULL,服务器禁止导入和导出操作。

查看数据库当前设置:

mysql> show global variables like '%secur%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| require_secure_transport | OFF   |
| secure_auth              | ON    |
| secure_file_priv         | NULL  |
+--------------------------+-------+
3 rows in set (0.01 sec)

看到secure_file_priv当前设置为NULL,说明限制导入和导出操作。

查看配置文件my.cnf发现没有设置secure_file_priv参数,那么这个参数默认应该是为NULL。

[mysql@localhost mysql]$ cat my.cnf


[mysqld]
basedir=/mysqlsoft/mysql
datadir=/mysqldata/mysql
bind-address=*
user=mysql
port=3306
log-error=/mysqldata/mysql/mysql.err
pid-file=/mysqldata/mysql/mysqld.pid
socket = /mysqlsoft/mysql/mysql.sock
character-set-server=utf8mb4
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
innodb_flush_method=O_DIRECT
binlog_format = mixed
log-bin=/mysqldata/mysql/binlog
max_binlog_size = 100m
binlog_cache_size = 4m
server-id=1

修改配置文件my.cnf参加secure_file_priv=

[mysql@localhost mysql]$ vi my.cnf
.....
secure-file-priv=

重启mysql数据库

[root@localhost ~]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL.. SUCCESS!

再次检查secure_file_priv参数设置

mysql> show global variables like '%secur%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| require_secure_transport | OFF   |
| secure_auth              | ON    |
| secure_file_priv         |       |
+--------------------------+-------+
3 rows in set (0.00 sec)

再执行导出操作成功

[mysql@localhost ~]$ mysqldump -uroot -pxxzx7817600 --tab=/mysqldata/tmp  mysql
mysqldump: [Warning] Using a password on the command line interface can be insecure.

DM7 RAC数据库恢复成单机数据库

DM7 RAC数据库恢复成单机数据库
1) 启动RMAN备份数据库,保证服务器处于脱机状态。

RMAN> backup database '/dm7/data/rac0_config/dm.ini' full backupset '/dm7/backup/db_rac_full_bak_recover_dbmagic';
backup database '/dm7/data/rac0_config/dm.ini' full backupset '/dm7/backup/db_rac_full_bak_recover_dbmagic';
file dm.key not found, use default license!
checking if the RAC database under system path [+DMDATA/data/rac] is running....
EP [0] is checking....
EP [1] is checking....
EP[0] max_lsn: 76986
EP[0] adjust cur_lsn from [76986] to [77001]
BACKUP DATABASE [rac], execute......
CMD CHECK LSN......
BACKUP DATABASE [rac], collect dbf......
CMD CHECK ......
DBF BACKUP SUBS......
total 1 packages processed...
total 2 packages processed...
total 3 packages processed...
total 4 packages processed...
total 5 packages processed...
DBF BACKUP MAIN......
BACKUPSET [/dm7/backup/db_rac_full_bak_recover_dbmagic] END, CODE [0]......
META GENERATING......
total 9 packages processed...
total 9 packages processed!
CMD END.CODE:[0]
backup successfully!
time used: 3887.714(ms)

RMAN> show backupset '/dm7/backup/db_rac_full_bak_recover_dbmagic';
show backupset '/dm7/backup/db_rac_full_bak_recover_dbmagic';




system path:           +DMDATA/data/rac
db magic:              -1632052820
permanent magic:       450923536
rac node:              2
page check:            0
rlog encrypt:          0
external cipher[id/name]:  0/
external hash[id/name]:  0/
length in char:        0
use new hash:          1
page size:             8 KB
extent size:           16
case sensitive:        1
log page size:         512 B
unicode_flag/charset:  0
data version:          0x7000A
sys version:           V7.1.6.46-Build(2018.02.08-89107)ENT
enable policy:         0
archive flag:          1
blank_pad_mode:        0
crc_check:             TRUE
backupset sig:         BA
backupset version:     4009
database name:         rac
backup name:           DB_FULL_rac_20200616_154323_000689
backupset description:
backupset ID :         1145407476
parent backupset ID:     -1
META file size :       74240
compressed level:      0
encrypt type:          0
parallel num:          1
backup range:          database
mpp_timestamp:         1592293401
ddl_clone:             FALSE
mpp_flag:              FALSE
backup level:          offline
backup type:           full
without log:           FALSE
START_LSN:             76987
START_SEQ:             309
END_LSN:               77001
END_SEQ:               308
base START_LSN:        -1
base END_LSN:          -1
base name:
base backupset:
backup time:           2020-06-16 15:43:25
min trx start lsn:     76987
min exec ver:          0x0701060C
pkg size:              0x02000000



RAC EP:            0
RAC status:          OK
RAC begin lsn:       76987
RAC begin seq:       309
RAC end lsn:         77001
RAC end seq:         308
RAC base begin lsn:  -1
RAC base begin seq:  -1
RAC base end lsn:    -1
RAC base end seq:    -1

RAC EP:            1
RAC status:          OK
RAC begin lsn:       77002
RAC begin seq:       308
RAC end lsn:         77001
RAC end seq:         307
RAC base begin lsn:  -1
RAC base begin seq:  -1
RAC base end lsn:    -1
RAC base end seq:    -1


backupset directory: /dm7/backup/db_rac_full_bak_recover_dbmagic
backupset name:        db_rac_full_bak_recover_dbmagic
backup data file num:  5
backup piece num:      1


$file_seq |$size(KB) |$pos_desc                                               |$content_type
0         |26103     |db_rac_full_bak_recover_dbmagic.bak                     |DATA


$file_seq |$group_id |$group_name                      |$file_id  |$file_path                       |$mirror_path                     |$file_len
1         |0         |SYSTEM                           |0         |+DMDATA/data/rac/system.dbf      |                                 |134217728
2         |1         |ROLL                             |0         |+DMDATA/data/rac/roll.dbf        |                                 |134217728
3         |4         |MAIN                             |0         |+DMDATA/data/rac/main.dbf        |                                 |134217728
4         |5         |TS_FOR_DBF                       |0         |+DMDATA/data/rac/ts_for_dbf_01.dbf|                                 |134217728
5         |5         |TS_FOR_DBF                       |1         |+DMDATA/data/rac/ts_for_dbf_02.dbf|                                 |134217728


$file_seq |$file_path                       |$file_len           |$begin_lsn          |$begin_seqno        |$begin_rpag_off     |$end_lsn            |$end_seqno          |$create_time        |$close_time


show backupsets successfully.
time used: 10.655(ms)

2) 准备目标库,可以使用备份库,也可以重新生成库。这里是在别一台服务器上创建新库,重新生成库操作如下:

[dmdba@dmks ~]$ dminit path=/dm_home/dmdbms/data db_name=dameng_for_recover auto_overwrite=1 port_num=5336
initdb V7.1.6.46-Build(2018.02.08-89107)ENT
db version: 0x7000a
file dm.key not found, use default license!
License will expire in 14 day(s) on 2020-06-30

 log file path: /dm_home/dmdbms/data/dameng_for_recover/dameng_for_recover01.log


 log file path: /dm_home/dmdbms/data/dameng_for_recover/dameng_for_recover02.log

write to dir [/dm_home/dmdbms/data/dameng_for_recover].
create dm database success. 2020-06-16 16:03:18


[root@dmks root]# ./dm_service_installer.sh  -i /dm_home/dmdbms/data/dameng_for_recover/dm.ini -p dmrc -t dmserver
Move the service script file(/dm_home/dmdbms/bin/DmServicedmrc to /etc/rc.d/init.d/DmServicedmrc)
Finished to create the service (DmServicedmrc)

[root@dmks root]# service DmServicedmrc start
Starting DmServicedmrc: [ OK ]

[dmdba@dmks ~]$ disql SYSDBA/SYSDBA@localhost:5336

Server[localhost:5336]:mode is normal, state is open
login used time: 10.727(ms)
disql V7.1.6.46-Build(2018.02.08-89107)ENT
Connected to: DM 7.1.6.46
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          -1238913195

used time: 0.793(ms). Execute id is 809.
SQL> select db_magic from v$rlog;

LINEID     DB_MAGIC
---------- -----------
1          1319824724

used time: 0.984(ms). Execute id is 810.

3)将备份集和归档日志文件复制到目标库所在主机上

[dmdba@dmrac1 backup]$ scp -r db_rac_full_bak_recover_dbmagic dmdba@10.10.10.187:/dm_home/dmdbms/backup/
The authenticity of host ‘10.10.10.187 (10.10.10.187)’ can’t be established.
RSA key fingerprint is 34:9a:d7:67:6d:be:20:45:21:ce:96:82:23:e5:e9:11.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘10.10.10.187’ (RSA) to the list of known hosts.
dmdba@10.10.10.187’s password:
db_rac_full_bak_recover_dbmagic.meta 100% 73KB 72.5KB/s 00:00
db_rac_full_bak_recover_dbmagic.bak 100% 25MB 25.5MB/s 00:00

[dmdba@dmrac1 data]$ scp -r local_arch dmdba@10.10.10.187:/dm_home/dmdbms/backup/
dmdba@10.10.10.187’s password:
ARCHIVE_LOCAL1_20200528171255857_0.log 100% 157KB 156.5KB/s 00:00
[dmdba@dmrac1 data]$ scp -r rac0_arch dmdba@10.10.10.187:/dm_home/dmdbms/backup/
dmdba@10.10.10.187’s password:
ARCHIVE_LOCAL1_20200615164953273_0.log 100% 160KB 160.0KB/s 00:00
ARCHIVE_LOCAL1_20200615165648166_0.log 100% 157KB 157.0KB/s 00:00
ARCHIVE_LOCAL1_20200528202150715_0.log 100% 277KB 277.0KB/s 00:00
ARCHIVE_LOCAL1_20200608151836879_0.log 100% 158KB 157.5KB/s 00:00
ARCHIVE_LOCAL1_20200609150852829_0.log 100% 157KB 157.0KB/s 00:00
ARCHIVE_LOCAL1_20200608152638617_0.log 100% 159KB 158.5KB/s 00:00
ARCHIVE_LOCAL1_20200609170732487_0.log 100% 161KB 160.5KB/s 00:00
ARCHIVE_LOCAL1_20200615172117341_0.log 100% 159KB 158.5KB/s 00:00
ARCHIVE_LOCAL1_20200615171042444_0.log 100% 159KB 159.0KB/s 00:00
ARCHIVE_LOCAL1_20200605154214367_0.log 100% 157KB 157.0KB/s 00:00
[dmdba@dmrac1 data]$ scp -r rac1_arch dmdba@10.10.10.187:/dm_home/dmdbms/backup/
dmdba@10.10.10.187’s password:
ARCH_REMOTE1_20200608152641970_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200609170737070_1.log 100% 159KB 159.0KB/s 00:00
ARCH_REMOTE1_20200609150857056_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200615172121038_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200608151838201_1.log 100% 5632 5.5KB/s 00:00
ARCH_REMOTE1_20200528202146001_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200615164957743_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200605154211189_1.log 100% 159KB 159.0KB/s 00:00
ARCH_REMOTE1_20200615165652504_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200615171046600_1.log 100% 158KB 158.0KB/s 00:00
[dmdba@dmrac1 data]$

4)检验备份

RMAN> check backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic';
check backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic';
CMD END.CODE:[0]
check backupset successfully.
time used: 5.877(ms)

5)还原数据库

RMAN> restore database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' from backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic';
restore database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' from backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic';
file dm.key not found, use default license!
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[4].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[3].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[2].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[1].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[0].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running, write dmrman info.
RESTORE DATABASE  CHECK......
RESTORE DATABASE , dbf collect......
RESTORE DATABASE , dbf refresh ......
RESTORE BACKUPSET [/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic] START......
total 5 packages processed...
RESTORE DATABASE , UPDATE ctl file......
RESTORE DATABASE , REBUILD key file......
RESTORE DATABASE , CHECK db info......
RESTORE DATABASE , UPDATE db info......
total 7 packages processed!
CMD END.CODE:[0]
restore successfully.
time used: 16226.253(ms)

6)恢复数据库

RMAN> recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini'  update db_magic ;
recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' update db_magic;
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[4].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[3].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[2].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[1].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[0].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running, write dmrman info.
EP[0] max_lsn: 76986
[-8308]:forbid updating database magic, need redo log

这里使用update db_magic选项出错了,提示需要重做日志文件。下面去掉update db_magic选项,因为每次还原恢复时也是一定会更新db_magic值。

RMAN> recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' with archivedir '/dm_home/dmdbms/backup/rac0_arch','/dm_home/dmdbms/backup/rac1_arch';
recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' with archivedir '/dm_home/dmdbms/backup/rac0_arch' , '/dm_home/dmdbms/backup/rac1_arch';
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[4].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[3].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[2].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[1].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[0].
checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running, write dmrman info.
EP[0] max_lsn: 76986
min_ckpt_lsn =
The RAC recover total redo 0 ptx
EP(0) slot ctl page(1, 0, 16) trxid = 9986
EP(1) slot ctl page(1, 0, 17) trxid = 8457
EP[0] Recover LSN from 76987 to 77001.
EP[1] Recover LSN from 77002 to 77001.
Recover from archive log finished, time used:0.006s.
recover successfully!
time used: 7027.075(ms)

7)检查数据,查询表t1的数据可以验证数据恢复成功

[dmdba@dmks ~]$ disql SYSDBA/SYSDBA@localhost:5336

Server[localhost:5336]:mode is normal, state is open
login used time: 10.727(ms)
disql V7.1.6.46-Build(2018.02.08-89107)ENT
Connected to: DM 7.1.6.46
SQL> desc t1;

LINEID     NAME TYPE$       NULLABLE
---------- ---- ----------- --------
1          ID   INTEGER     Y
2          NAME VARCHAR(20) Y

used time: 20.311(ms). Execute id is 3.
SQL> select * from t1;

LINEID     ID          NAME
---------- ----------- ----
1          1           jy
2          2           hy

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

8)检查db_magic,还原恢复后db_magic从-1632052820变成了1009602608,

SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          450923536

used time: 1.042(ms). Execute id is 5.
SQL> select db_magic from v$rlog;

LINEID     DB_MAGIC
---------- -----------
1          1009602608

used time: 1.332(ms). Execute id is 6.

DM7配置远程归档

配置远程归档
与本地归档一样,远程归档也是配置在dmarch.ini文件中,远程归档相关的主要几个配置项包括:
1. ARCH_TYPE设置为REMOTE,表示是远程归档
2. ARCH_DEST设置为远程数据库实例名,表示REDO日志发送到这个节点
3. ARCH_INCOMING_PATH设置为本地存储路径,用于保存ARCH_DEST实例发送的REDO日志

一般建议DMRAC集群中的节点,在配置本地归档之外,再交叉配置集群中所有其他节点的远程归档。查询V$DM_ARCH_INI、V$ARCH_STATUS等动态视图可以获取归档配置以及归档状态等相关信息。下面以两节点DMRAC集群为例,说明如何配置远程归档,RAC0和RAC1是DMRAC集群中的两个实例,交叉进行REMOTE归档配置:

1)修改数据库为MOUNT状态。
rac0实例:

SQL> alter database mount;
executed successfully
used time: 00:00:01.852. Execute id is 0.

rac1实例:

SQL> alter database mount;
executed successfully
used time: 00:00:01.853. Execute id is 0.

2)配置本地归档。
rac0实例:

SQL> alter database add archivelog 'dest=/dm7/data/rac0_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 3.459(ms). Execute id is 0.

rac1实例:

SQL> alter database add archivelog 'dest=/dm7/data/rac1_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 3.000(ms). Execute id is 0.

3)配置远程归档。
rac0实例:

SQL> alter database add archivelog 'dest=RAC1,type=remote,file_size=256,space_limit=0,incoming_path=/dm7/data/rac1_arch';
executed successfully
used time: 2.836(ms). Execute id is 0.

rac1实例:

SQL> alter database add archivelog 'dest=RAC0,type=remote,file_size=256,space_limit=0,incoming_path=/dm7/data/rac0_arch';
executed successfully
used time: 2.865(ms). Execute id is 0.

4)开启归档模式。
rac0实例:

SQL> alter database archivelog;
executed successfully
used time: 11.553(ms). Execute id is 0.

rac1实例:

SQL> alter database archivelog;
executed successfully
used time: 10.644(ms). Execute id is 0.

5)修改数据库为OPEN状态。
rac0实例:

SQL> alter database open;
executed successfully
used time: 00:00:01.362. Execute id is 0.

rac1实例:

SQL> alter database open;
executed successfully
used time: 00:00:02.341. Execute id is 0.

6)查看归档配置文件dmarch.ini
rac0实例:

[dmdba@dmrac1 rac0_config]$ pwd
/dm7/data/rac0_config
[dmdba@dmrac1 rac0_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY                 = 1

[ARCHIVE_LOCAL1]
        ARCH_TYPE                       = LOCAL
        ARCH_DEST                       = /dm7/data/rac0_arch
        ARCH_FILE_SIZE                  = 256
        ARCH_SPACE_LIMIT                = 0

[ARCH_REMOTE1]
        ARCH_TYPE                       = REMOTE
        ARCH_DEST                       = RAC1
        ARCH_INCOMING_PATH              = /dm7/data/rac1_arch
        ARCH_FILE_SIZE                  = 256
        ARCH_SPACE_LIMIT                = 0

rac1实例:

[dmdba@dmrac2 rac1_config]$ pwd
/dm7/data/rac1_config
[dmdba@dmrac2 rac1_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY                 = 1

[ARCHIVE_LOCAL1]
        ARCH_TYPE                       = LOCAL
        ARCH_DEST                       = /dm7/data/rac1_arch
        ARCH_FILE_SIZE                  = 256
        ARCH_SPACE_LIMIT                = 0

[ARCH_REMOTE1]
        ARCH_TYPE                       = REMOTE
        ARCH_DEST                       = RAC0
        ARCH_INCOMING_PATH              = /dm7/data/rac0_arch
        ARCH_FILE_SIZE                  = 256
        ARCH_SPACE_LIMIT                = 0

7)检查ARCH_INI参数是否为1
rac0实例:

SQL> select * from v$dm_ini where para_name='ARCH_INI';

LINEID     PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1          ARCH_INI  1          0         1         N       1          1          dmarch.ini  SYS

used time: 10.267(ms). Execute id is 9.

rac1实例:

SQL> select * from v$dm_ini where para_name='ARCH_INI';

LINEID     PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1          ARCH_INI  1          0         1         N       1          1          dmarch.ini  SYS

used time: 30.225(ms). Execute id is 19.

8)检查是否生成了归档日志文件(在打开数据库时就会生成)
本地归档日志文件
rac0实例:

[dmdba@dmrac1 rac0_arch]$ pwd
/dm7/data/rac0_arch
[dmdba@dmrac1 rac0_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCHIVE_LOCAL1_20200528202150715_0.log

rac1实例:

[dmdba@dmrac2 rac1_arch]$ pwd
/dm7/data/rac1_arch
[dmdba@dmrac2 rac1_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCHIVE_LOCAL1_20200528202151877_1.log

远程归档日志文件
rac0实例:

[dmdba@dmrac1 rac1_arch]$ pwd
/dm7/data/rac1_arch
[dmdba@dmrac1 rac1_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCH_REMOTE1_20200528202146001_1.log

rac1实例:

[dmdba@dmrac2 rac0_arch]$ pwd
/dm7/data/rac0_arch
[dmdba@dmrac2 rac0_arch]$ ls -lrt
total 136
-rw-r--r-- 1 dmdba dinstall 268435456 May 28 20:21 ARCH_REMOTE1_20200528202156601_0.log

DM7配置本地归档

配置本地归档
归档配置有两种方式:一是联机归档配置,数据库服务器启动情况下,使用SQL语句完成dmarch.ini和ARCH_INI配置;二是手动配置归档,数据库服务器未启动的情况下,手动编写dmarch.ini文件和设置参数ARCH_INI。下面将分别说明这两种归档如何配置。

联机配置归档
使用SQL语句配置本地归档。语法如下:
ALTER DATABASE <ADD|MODIFY|DELETE> ARCHIVELOG <归档配置语句>;
<归档配置语句>::= ‘DEST = <归档目标>,TYPE = <归档类型>’
<归档类型>::=<local方式>|<remote方式>
<local方式>::=LOCAL [,FILE_SIZE = <文件大小>][,SPACE_LIMIT = <空间大小限制>]
<remote方式>::=REMOTE [,FILE_SIZE = <文件大小>][,SPACE_LIMIT = <空间大小限制>],INCOMING_PATH = <归档存放路径>

使用SQL语句开启和关闭归档模式。
语法如下:

ALTER DATABASE ARCHIVELOG | NOARCHIVELOG;

在归档模式下,不允许删除本地归档。
例如,RAC环境联机归档配置如下:
1)修改数据库为MOUNT状态。
节点1:

SQL> alter database mount;
executed successfully
used time: 00:00:01.852. Execute id is 0.

节点2:

SQL> alter database mount;
executed successfully
used time: 00:00:01.853. Execute id is 0.

2)配置本地归档。
节点1:

SQL> alter database add archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 3.110(ms). Execute id is 0.

节点2:

SQL> alter database add archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 3.171(ms). Execute id is 0.

3)开启归档模式。
节点1:

SQL> alter database archivelog;
executed successfully
used time: 11.986(ms). Execute id is 0.

节点2:

SQL> alter database archivelog;
executed successfully
used time: 11.780(ms). Execute id is 0.

4)修改数据库为OPEN状态。
节点1:

SQL> alter database open;
executed successfully
used time: 00:00:01.466. Execute id is 0.

节点2:

SQL> alter database open;
executed successfully
used time: 711.999(ms). Execute id is 0.

5)查看归档配置文件dmarch.ini
节点1:

[dmdba@dmrac1 rac0_config]$ pwd
/dm7/data/rac0_config
[dmdba@dmrac1 rac0_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY                 = 1    --性能模式,是否等待重演完成,取值0:高性能模式, 1:数据一致模式。本地归档取值NULL

[ARCHIVE_LOCAL1]
        ARCH_TYPE                       = LOCAL
        ARCH_DEST                       = /dm7/data/local_arch
        ARCH_FILE_SIZE                  = 256
        ARCH_SPACE_LIMIT                = 0

节点2:

[dmdba@dmrac2 rac1_config]$ pwd
/dm7/data/rac1_config
[dmdba@dmrac2 rac1_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY                 = 1       --性能模式,是否等待重演完成,取值0:高性能模式, 1:数据一致模式。本地归档取值NULL

[ARCHIVE_LOCAL1]
        ARCH_TYPE                       = LOCAL
        ARCH_DEST                       = /dm7/data/local_arch
        ARCH_FILE_SIZE                  = 256
        ARCH_SPACE_LIMIT                = 0

6)检查ARCH_INI参数是否为1
节点1:

SQL> select * from v$dm_ini where para_name='ARCH_INI';

LINEID     PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1          ARCH_INI  1          0         1         N       1          1          dmarch.ini  SYS

used time: 30.251(ms). Execute id is 5.

节点2:

SQL> select * from v$dm_ini where para_name='ARCH_INI';

LINEID     PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1          ARCH_INI  1          0         1         N       1          1          dmarch.ini  SYS

used time: 29.498(ms). Execute id is 13.

禁用归档
1修改数据库为MOUNT状态。
节点1:

SQL> alter database mount;
executed successfully
used time: 00:00:01.858. Execute id is 0.

节点2:

SQL> alter database mount;
executed successfully
used time: 00:00:01.858. Execute id is 0.

2.禁用归档
节点1:

SQL> alter database noarchivelog;
executed successfully
used time: 42.916(ms). Execute id is 0.

节点2:

SQL> alter database noarchivelog;
executed successfully
used time: 42.533(ms). Execute id is 0.

3.删除配置的本地归档设置
节点1:

SQL> alter database delete archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 0.931(ms). Execute id is 0.

节点2:

SQL> alter database delete archivelog 'dest=/dm7/data/local_arch,type=local,file_size=256,space_limit=0';
executed successfully
used time: 0.952(ms). Execute id is 0.

4.删除之前生成的归档日志文件(可选项)
节点1:

SQL> sf_archivelog_delete_before_time(sysdate+1);
DMSQL executed successfully
used time: 2.907(ms). Execute id is 7.

节点2:

SQL> sf_archivelog_delete_before_time(sysdate+1);
DMSQL executed successfully
used time: 3.542(ms). Execute id is 16.

5.打开数据库
节点1:

SQL> alter database open;
executed successfully
used time: 00:00:01.609. Execute id is 0.

节点2:

SQL> alter database open;
executed successfully
used time: 00:00:02.304. Execute id is 0.

6.检查归档配置文件dmarch.ini的内容是否已经被删除
节点1:

[dmdba@dmrac1 rac0_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY      = 1        --性能模式,是否等待重演完成,取值0:高性能模式, 1:数据一致模式。本地归档取值NULL

节点2:

[dmdba@dmrac2 rac1_config]$ cat dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments

        ARCH_WAIT_APPLY      = 1        --性能模式,是否等待重演完成,取值0:高性能模式, 1:数据一致模式。本地归档取值NULL

7.检查ARCH_INI参数是否为0
节点1:

SQL> select * from v$dm_ini where para_name='ARCH_INI';

LINEID     PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1          ARCH_INI  0          0         1         N       0          0          dmarch.ini  SYS

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

节点2:

SQL> select * from v$dm_ini where para_name='ARCH_INI';

LINEID     PARA_NAME PARA_VALUE MIN_VALUE MAX_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION PARA_TYPE
---------- --------- ---------- --------- --------- ------- ---------- ---------- ----------- ---------
1          ARCH_INI  0          0         1         N       0          0          dmarch.ini  SYS

used time: 14.366(ms). Execute id is 18.

手动配置归档示例如下:
1)手动编辑dmarch.ini文件,之后保存在dm.ini所在的目录。dmarch.ini文件内容如下:

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm7/data/local_arch
ARCH_FILE_SIZE = 256
ARCH_SPACE_LIMIT = 0

2)编辑dm.ini文件,设置参数ARCH_INI=1,保存。
3)启动服务器,服务器已运行于归档模式。

多路归档,指配置多个本地归档。配置的第一个归档,称为第一路归档,后面依次是第二路、第三路……