|
设置归档模式:
[db2inst1@server1 ~]$ db2 update db cfg for sample using logretain recoveryDB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.SQL1363W One or more of the parameters submitted for immediate modification were not changed dynamically. For these configuration parameters, all applications must disconnect from this database before the changes become effective--这时候,需要手动备份数据库,否是会出现backup pending的状态:[db2inst1@server1 ~]$ con sampleSQL1116N A connection to or activation of database "SAMPLE" cannot be made because of BACKUP PENDING. SQLSTATE=57019[db2inst1@server1 ~]$ db2 backup db sample to /tmpBackup successful. The timestamp for this backup image is : 20101117125927--检查相关设置:[db2inst1@server1 ~]$ con sample Database Connection Information Database server = DB2/LINUX 9.5.2 SQL authorization ID = DB2INST1 Local database alias = SAMPLE[db2inst1@server1 ~]$ db2 get db cfg |grep -i log Log retain for recovery status = RECOVERY Log retain for recovery enabled (LOGRETAIN) = RECOVERY First log archive method (LOGARCHMETH1) = LOGRETAIN Options for logarchmeth1 (LOGARCHOPT1) = Second log archive method (LOGARCHMETH2) = OFF--再设置归档的路径:[db2inst1@server1 ~]$ db2 update db cfg for sample using LOGARCHMETH1 "DISK:/arch/"DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.[db2inst1@server1 ~]$ db2 get db cfg |grep LOGARCHMETH1 First log archive method (LOGARCHMETH1) = DISK:/arch/--手动归档一下:[db2inst1@server1 ~]$ db2 ARCHIVE LOG FOR DATABASE sampleDB20000I The ARCHIVE LOG command completed successfully.--看看归档情况[root@server1 /arch/db2inst1/SAMPLE/NODE0000/C0000000]# lltotal 16-rw-r----- 1 db2inst1 db2iadm1 12288 Nov 17 13:09 S0000000.LOG[db2inst1@server1 ~]$ db2 LIST HISTORY ARCHIVE LOG all for sample List History File for sampleNumber of matching file entries = 2 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------- X D 20101117130935 1 D S0000000.LOG C0000000 ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Comment: Start Time: 20101117130935 End Time: 20101117130935 Status: A ---------------------------------------------------------------------------- EID: 23 Location: /arch/db2inst1/SAMPLE/NODE0000/C0000000/S0000000.LOG Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID -- --- ------------------ ---- --- ------------ ------------ -------------- X D 20101117130935 N S0000000.LOG ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Comment: ARCHIVE LOG Start Time: 20101117130935 End Time: 20101117130935 Status: A ---------------------------------------------------------------------------- EID: 24 |
|