问题:想要backup数据库!
[db2inst2@cognoswithdb2 backupfordb2]$ db2 backup db sample to /backupfordb2/
SQL1035N The operation failed because the specified database cannot be
connected to in the mode requested. SQLSTATE=57019
看官当
SQL1035N
操作失败,这是因为无法以请求的方式来连接指定的数据库。
说明
当用户连接至数据库时,缺省情况下,该连接处于共享方式。如果另一个用户已经以互斥方式连接至同一数据库,那么共享连接尝试将失败并返回此消息。类似地,如果用户尝试以互斥方式访问数据库,但是已经以共享方式访问该数据库,那么连接尝试将失败并返回此消息。
在下列类型的情况下也会返回此消息:
- 已达到数据库的最大连接数。
- 请求了独占使用数据库,但另一个用户已经在以互斥方式使用该数据库。
- 已显式激活数据库(共享访问),这会阻止该操作建立与该数据库的互斥连接。
在 pureScale 环境中,当发生以下事件系列时,可能会返回此消息:
- 对数据库启动了脱机操作(例如,备份、复原或前滚),并且该操作获得了与数据库的互斥连接。
- 未释放启动该脱机操作失败(例如,由于发生了硬件或软件故障)的成员和该脱机操作所拥有的互斥连接。
- 启动该脱机操作的成员未能自动重新启动。
用户响应
请执行下列故障诊断步骤:
- 通过使用带有 SHOW DETAIL 参数和 GLOBAL 参数的 LIST APPLICATIONS 命令,确定哪些用户应用程序或系统应用程序已打开与数据库的连接。
- 等待那些已打开与数据库的连接的应用程序关闭其连接。
- 通过使用下列命令或语句来终止任何剩余的与数据库的连接:
- QUIESCE DATABASE 命令
- CONNECT RESET 语句
- FORCE APPLICATION ALL 命令
- DEACTIVATE DATABASE 命令
- 在 DB2 pureScale 环境中,重新启动在执行脱机操作时关闭的任何成员。
- 再次连接。
sqlcode:-1035
sqlstate:57019
解决问题
根据文档
[db2inst2@cognoswithdb2 backupfordb2]$ db2 force application all
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.[db2inst2@cognoswithdb2 backupfordb2]$ db2 backup db sample to /backupfordb2/
SQL1035N The operation failed because the specified database cannot be
connected to in the mode requested. SQLSTATE=57019
不行
connect reset--------不行
呵呵
重启数据库,OK!
然后
我想查看下备份情况
[db2inst2@cognoswithdb2 backupfordb2]$ db2 list history backup all for sample
SQL1224N The database manager is not able to accept new requests, has
terminated all requests in progress, or has terminated the specified request
because of an error or a forced interrupt. SQLSTATE=55032
失败
[db2inst2@cognoswithdb2 backupfordb2]$ db2 connect to sampleDatabase Connection InformationDatabase server = DB2/LINUXX8664 10.5.1SQL authorization ID = DB2INST2Local database alias = SAMPLE[db2inst2@cognoswithdb2 backupfordb2]$ db2 list history backup all for sampleList History File for sampleNumber of matching file entries = 2Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID-- --- ------------------ ---- --- ------------ ------------ --------------B D 20140419191405000 F S0000000.LOG S0000000.LOG ----------------------------------------------------------------------------Contains 5 tablespace(s):00001 SYSCATSPACE00002 USERSPACE100003 IBMDB2SAMPLEREL00004 IBMDB2SAMPLEXML00005 SYSTOOLSPACE----------------------------------------------------------------------------Comment: DB2 BACKUP SAMPLE OFFLINEStart Time: 20140419191405End Time: 20140419191406Status: A----------------------------------------------------------------------------EID: 4 Location: SQLCA Informationsqlcaid : SQLCA sqlcabc: 136 sqlcode: -2061 sqlerrml: 14sqlerrmc: /backupfordb2/sqlerrp : sqlubMWRsqlerrd : (1) 0 (2) 0 (3) 0(4) 0 (5) 0 (6) 0sqlwarn : (1) (2) (3) (4) (5) (6)(7) (8) (9) (10) (11)sqlstate:Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID-- --- ------------------ ---- --- ------------ ------------ --------------B D 20140419191436001 F D S0000000.LOG S0000000.LOG ----------------------------------------------------------------------------Contains 5 tablespace(s):00001 SYSCATSPACE00002 USERSPACE100003 IBMDB2SAMPLEREL00004 IBMDB2SAMPLEXML00005 SYSTOOLSPACE----------------------------------------------------------------------------Comment: DB2 BACKUP SAMPLE OFFLINEStart Time: 20140419191436End Time: 20140419191457Status: A----------------------------------------------------------------------------EID: 5 Location: /backupfordb2[db2inst2@cognoswithdb2 backupfordb2]$