Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1029120
  • 博文数量: 239
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 3618
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-12 13:17
文章分类

全部博文(239)

文章存档

2021年(1)

2016年(1)

2015年(30)

2014年(91)

2013年(116)

分类: LINUX

2013-09-25 17:58:29


 .1 编写目的

用于DB2异机环境下DB2数据库的恢复。

  

2. 操作步骤

2.1. 启动数据库

#su – db2inst1

#db2start

2.2. 恢复数据库

#mkdir –p /db2data/backup/cmsdb

将要恢复的数据库文件传到/db2data/backup/cmsdb

#chown –R db2inst1:db2grp1 /db2data

#db2 "restore db cmsdb from /db2data/backup/cmsdb"

[db2inst1@app SQLOGDIR]$ db2 connect to cmsdb

SQL1117N  A connection to or activation of database "CMSDB" cannot be made

because of ROLL-FORWARD PENDING.  SQLSTATE=57019

连接的时候报错

2.3. 解决方法

2.3.1. 查看Logs日志目录

在原环境执行# db2 "get db cfg for cmsdb",找到表红的位置,将标红位置下的所有文件拷贝到需要恢复的文件目录。

[db2inst1@app ~]$ db2 "get db cfg for cmsdb"

 

       Database Configuration for Database cmsdb

 

 Database configuration release level                    = 0x0b00

 Database release level                                  = 0x0b00

 

 Database territory                                      = CN

 Database code page                                      = 1386

 Database code set                                       = GBK

 Database country/region code                            = 86

 Database collating sequence                             = UNIQUE

 Alternate collating sequence              (ALT_COLLATE) =

 Database page size                                      = 4096

 

 Dynamic SQL Query management           (DYN_QUERY_MGMT) = DISABLE

 

 Discovery support for this database       (DISCOVER_DB) = ENABLE

 

 Restrict access                                         = NO

 Default query optimization class         (DFT_QUERYOPT) = 5

 Degree of parallelism                      (DFT_DEGREE) = 1

 Continue upon arithmetic exceptions   (DFT_SQLMATHWARN) = NO

 Default refresh age                   (DFT_REFRESH_AGE) = 0

 Default maintained table types for opt (DFT_MTTB_TYPES) = SYSTEM

 Number of frequent values retained     (NUM_FREQVALUES) = 10

 Number of quantiles retained            (NUM_QUANTILES) = 20

 

 Backup pending                                          = NO

 

 Database is consistent                                  = NO

 Rollforward pending                                     = NO

 Restore pending                                         = NO

 

 Multi-page file allocation enabled                      = YES

 

 Log retain for recovery status                          = RECOVERY

 User exit for logging status                            = YES

 

 Self tuning memory                    (SELF_TUNING_MEM) = ON

 Size of database shared memory (4KB)  (DATABASE_MEMORY) = COMPUTED

 Database memory threshold               (DB_MEM_THRESH) = 10

 Max storage for lock list (4KB)              (LOCKLIST) = AUTOMATIC

 Percent. of lock lists per application       (MAXLOCKS) = AUTOMATIC

 Package cache size (4KB)                   (PCKCACHESZ) = AUTOMATIC

 Sort heap thres for shared sorts (4KB) (SHEAPTHRES_SHR) = AUTOMATIC

 Sort list heap (4KB)                         (SORTHEAP) = AUTOMATIC

 

 Database heap (4KB)                            (DBHEAP) = 2456

 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = 260

 Log buffer size (4KB)                        (LOGBUFSZ) = 98

 Utilities heap size (4KB)                (UTIL_HEAP_SZ) = 25906

 Buffer pool size (pages)                     (BUFFPAGE) = 1000

 Max size of appl. group mem set (4KB) (APPGROUP_MEM_SZ) = 30000

 Percent of mem for appl. group heap   (GROUPHEAP_RATIO) = 70

 Max appl. control heap size (4KB)     (APP_CTL_HEAP_SZ) = 128

 

 SQL statement heap (4KB)                     (STMTHEAP) = 8192

 Default application heap (4KB)             (APPLHEAPSZ) = 4096

 Statistics heap size (4KB)               (STAT_HEAP_SZ) = 4384

 

 Interval for checking deadlock (ms)         (DLCHKTIME) = 10000

 Lock timeout (sec)                        (LOCKTIMEOUT) = -1

 

 Changed pages threshold                (CHNGPGS_THRESH) = 80

 Number of asynchronous page cleaners   (NUM_IOCLEANERS) = AUTOMATIC

 Number of I/O servers                   (NUM_IOSERVERS) = AUTOMATIC

 Index sort flag                             (INDEXSORT) = YES

 Sequential detect flag                      (SEQDETECT) = YES

 Default prefetch size (pages)         (DFT_PREFETCH_SZ) = AUTOMATIC

 

 Track modified pages                         (TRACKMOD) = ON

 

 Default number of containers                            = 1

 Default tablespace extentsize (pages)   (DFT_EXTENT_SZ) = 32

 

 Max number of active applications            (MAXAPPLS) = AUTOMATIC

 Average number of active applications       (AVG_APPLS) = AUTOMATIC

 Max DB files open per application            (MAXFILOP) = 64

 

 Log file size (4KB)                         (LOGFILSIZ) = 1024

 Number of primary log files                (LOGPRIMARY) = 13

 Number of secondary log files               (LOGSECOND) = 4

 Changed path to log files                  (NEWLOGPATH) =

 Path to log files                                       = /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/

 Overflow log path                     (OVERFLOWLOGPATH) =

 Mirror log path                         (MIRRORLOGPATH) =

 First active log file                                   = S0004469.LOG

 Block log on disk full                (BLK_LOG_DSK_FUL) = NO

 Percent max primary log space by transaction  (MAX_LOG) = 0

 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

 

 Group commit count                          (MINCOMMIT) = 1

 Percent log file reclaimed before soft chckpt (SOFTMAX) = 520

 Log retain for recovery enabled             (LOGRETAIN) = RECOVERY

 User exit for logging enabled                (USEREXIT) = ON

 

 HADR database role                                      = STANDARD

 HADR local host name                  (HADR_LOCAL_HOST) =

 HADR local service name                (HADR_LOCAL_SVC) =

 HADR remote host name                (HADR_REMOTE_HOST) =

 HADR remote service name              (HADR_REMOTE_SVC) =

 HADR instance name of remote server  (HADR_REMOTE_INST) =

 HADR timeout value                       (HADR_TIMEOUT) = 120

 HADR log write synchronization mode     (HADR_SYNCMODE) = NEARSYNC

 

 First log archive method                 (LOGARCHMETH1) = USEREXIT

 Options for logarchmeth1                  (LOGARCHOPT1) =

 Second log archive method                (LOGARCHMETH2) = OFF

 Options for logarchmeth2                  (LOGARCHOPT2) =

 Failover log archive path                (FAILARCHPATH) =

 Number of log archive retries on error   (NUMARCHRETRY) = 5

 Log archive retry Delay (secs)         (ARCHRETRYDELAY) = 20

 Vendor options                              (VENDOROPT) =

 

 Auto restart enabled                      (AUTORESTART) = ON

 Index re-creation time and redo index build  (INDEXREC) = SYSTEM (RESTART)

 Log pages during index build            (LOGINDEXBUILD) = OFF

 Default number of loadrec sessions    (DFT_LOADREC_SES) = 1

 Number of database backups to retain   (NUM_DB_BACKUPS) = 12

 Recovery history retention (days)     (REC_HIS_RETENTN) = 366

 

 TSM management class                    (TSM_MGMTCLASS) =

 TSM node name                            (TSM_NODENAME) =

 TSM owner                                   (TSM_OWNER) =

 TSM password                             (TSM_PASSWORD) =

 

 Automatic maintenance                      (AUTO_MAINT) = ON

   Automatic database backup            (AUTO_DB_BACKUP) = OFF

   Automatic table maintenance          (AUTO_TBL_MAINT) = ON

     Automatic runstats                  (AUTO_RUNSTATS) = ON

     Automatic statistics profiling    (AUTO_STATS_PROF) = OFF

       Automatic profile updates         (AUTO_PROF_UPD) = OFF

     Automatic reorganization               (AUTO_REORG) = OFF

2.3.2. 执行回滚操作

[db2inst1@app SQLOGDIR]$ db2 rollforward db cmsdb to end of logs and stop

 

                                 Rollforward Status

 

 Input database alias                   = cmsdb

 Number of nodes have returned status   = 1

 

 Node number                            = 0

 Rollforward status                     = not pending

 Next log file to be read               =

 Log files processed                    = S0004384.LOG - S0004468.LOG

 Last committed transaction             = 2013-09-25-08.17.38.000000 UTC

 

DB20000I  The ROLLFORWARD command completed successfully.

 

2.3.3. 连接数据库

[db2inst1@app SQLOGDIR]$ db2 connect to cmsdb

 

   Database Connection Information

 

 Database server        = DB2/LINUX 9.1.3

 SQL authorization ID   = DB2INST1

 Local database alias   = CMSDB

 

阅读(3132) | 评论(0) | 转发(0) |
0

上一篇:db2cc报错

下一篇:linux配置vsftpd 500 OOPS错误

给主人留下些什么吧!~~