转:db2 backup 及 restore

db2 backup 及 restore  

2011-06-21 18:12:20|  分类: AIX |举报 |字号 订阅

 
 

两个问题:

db2=>list applications

db2=>db2stop force

db2=>db2start

db2=> backup db bbbank (use tsm)

如果报错的话,可以不要后边的use tsm选项

我这里出现了这种情况,舍弃掉tsm 就好了

 

1)SQL0970N  The system attempted to write to a read-only file.  SQLSTATE=55009

时间紧迫,也来不及仔细调查是哪个路径的权限不对。

直接以root用户,对dev,home,opt,usr,tmp,var

(强烈不推荐这个人说的直接修改,这种无差别的操作导致的问题,需要你重装操作系统才能解决。

在DB2的操作过程中,需要DB2来进行操作的文件传输,比如用SSH往LINUX服务器硬盘里面拖动拷贝的时候,尽量在

db2inst1的用户下来进行。

chmod 775 *

2)

db2 => RESTORE DATABASE BBBANK FROM '/home/webext/backup' TAKEN AT 20110620175219 INTO BBBANK REDIRECT WITHOUT ROLLING FORWARD
SQL2523W  Warning!  Restoring to an existing database that is different from 
the database on the backup image, but have matching names. The target database 
will be overwritten by the backup version.  The Roll-forward recovery logs 
associated with the target database will be deleted.
Do you want to continue ? (y/n) y
SQL1277W  A redirected restore operation is being performed.  Table space 
configuration can now be viewed and table spaces that do not use automatic 
storage can have their containers reconfigured.
DB20000I  The RESTORE DATABASE command completed successfully.

 

报错:SQL2538N  Unexpected End of File of Backup Image

解决:文件上传时,选择ASCII方式

不晓得他为什么要选择ASCII方式,我这里就是采取默认的方式Binary。然后也成功了,

ASCII传输貌似比较慢。


db2 => set tablespace containers for 0 using (path '/home/webext/tbs')
SQL20319N  The SET TABLESPACE CONTAINERS command is not allowed on an 
automatic storage table space.  SQLSTATE=55061
db2 => restore database bbbank continue
DB20000I  The RESTORE DATABASE command completed successfully.

参照以下:

A)如果是用原来的备份文件取创建一个新的数据库,要用direct

我并没有用direct,并且我的DB2只有用户db2inst1,并没有建立database,然而也成功了。


B)restore db AAA from /db2_backup taken at 20070617020002 into cisfedb redirect
C) set tablespace containers for 0 using (path 'your path')
...
set tablespace containers for n using (path 'your path')
这个n根据你数据库表空间的个数来定
4)restore db AAA continue

posted on 2014-10-13 20:18  扭头撞到墙  阅读(7545)  评论(0编辑  收藏  举报