设置DB2归档模式
设置归档模式:$ db2 update db cfg for sample using logretain recovery
DB20000IThe UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363WOne 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的状态:
$ con sample
SQL1116NA connection to or activation of database "SAMPLE" cannot be made
because of BACKUP PENDING.SQLSTATE=57019
$ db2 backup db sample to /tmp
Backup successful. The timestamp for this backup image is : 20101117125927
--检查相关设置:
$ con sample
Database Connection Information
Database server = DB2/LINUX 9.5.2
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
$ 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
--再设置归档的路径:
$ db2 update db cfg for sample using LOGARCHMETH1 "DISK:/arch/"
DB20000IThe UPDATE DATABASE CONFIGURATION command completed successfully.
$ db2 get db cfg |grep LOGARCHMETH1
First log archive method (LOGARCHMETH1) = DISK:/arch/
--手动归档一下:
$ db2 ARCHIVE LOG FOR DATABASE sample
DB20000IThe ARCHIVE LOG command completed successfully.
--看看归档情况
# ll
total 16
-rw-r----- 1 db2inst1 db2iadm1 12288 Nov 17 13:09 S0000000.LOG
$ db2 LIST HISTORYARCHIVE LOG all for sample
List History File for sample
Number of matching file entries = 2
Op Obj Timestamp+Sequence Type Dev Earliest Log Current LogBackup ID
-- --- ------------------ ---- --- ------------ ------------ --------------
XD20101117130935 1 DS0000000.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 LogBackup ID
-- --- ------------------ ---- --- ------------ ------------ --------------
XD20101117130935 N S0000000.LOG
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Comment: ARCHIVE LOG
Start Time: 20101117130935
End Time: 20101117130935
Status: A
----------------------------------------------------------------------------
EID: 24
页:
[1]