网站首页
本站精华
免费下载
游客:
注册
|
登录
|
会员
|
搜索
|
帮助
LoveUnix
»
DB2 & Informix
» backup and restore
‹‹ 上一主题
|
下一主题 ››
投票
交易
悬赏
活动
打印
|
推荐
|
订阅
|
收藏
标题: backup and restore
eagle
LU小天使
UID 39336
精华 0
积分 320
帖子 484
活跃指数 26
LU金币 412 个
LU金条 0 个
阅读权限 20
注册 2006-1-10
#1
大
中
小
使用道具
发表于 2007-5-23 17:06
资料
个人空间
短消息
加为好友
backup and restore
看书上写
During a backup of a database, a record is kept of all the table space containers in use by the table spaces being backed up. During a restore, all containers listed in the backup are checked to see if they currently exist and are accessible. If one or more of the containers is inaccessible for any other reason, the restore will fail.
sample数据库
1,先备份
2,drop table staff
3,mv SQLT0002.0 SQLT0002.0.bk
4,查看状态
Tablespace ID = 2
Name = USERSPACE1
Type = System managed space
Contents = Any data
State = 0x4000
5,restore
成功
怎么与上面的描述不一致,并没有失败啊,而是重建了这个container
不知道什么原因,请教各位,谢谢
beginner-bj
版主
UID 9471
精华
15
积分 1369
帖子 2357
活跃指数 186
LU金币 4352 个
LU金条 0 个
阅读权限 210
注册 2004-1-16
#2
大
中
小
使用道具
发表于 2007-5-24 10:50
资料
个人空间
短消息
加为好友
Tablespace ID = 0,1,2的可能特殊一点吧
我的博客:http://blog.chinaunix.net/index.php?blogId=739欢迎访问,并请多多批评指正。
eagle
LU小天使
UID 39336
精华 0
积分 320
帖子 484
活跃指数 26
LU金币 412 个
LU金条 0 个
阅读权限 20
注册 2006-1-10
#3
大
中
小
使用道具
发表于 2007-5-24 11:33
资料
个人空间
短消息
加为好友
哦,那我再建几个tablespace试试看
谢谢
darkbug
超级版主
UID 187
精华
12
积分 2224
帖子 4133
活跃指数 247
LU金币 3382 个
LU金条 161170 个
阅读权限 251
注册 2003-9-28
#4
大
中
小
使用道具
发表于 2007-5-28 12:51
资料
个人空间
短消息
加为好友
QUOTE:
原帖由
eagle
于 2007-5-24 11:33 发表
哦,那我再建几个tablespace试试看
谢谢
有测试结果了吗
踏踏实实学习,认认真真干活
eagle
LU小天使
UID 39336
精华 0
积分 320
帖子 484
活跃指数 26
LU金币 412 个
LU金条 0 个
阅读权限 20
注册 2006-1-10
#5
大
中
小
使用道具
发表于 2007-5-28 17:05
资料
个人空间
短消息
加为好友
测试了一下,对于使用目录的还是可以恢复的,不会失败;
使用device的,则会失败,失败的错误是:SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009,不知道是不是测试的步骤有问题,要是错误提示one or more of the containers is inaccessible,则比较符合上文的描述。
$ db2level
DB21085I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08020"
with level identifier "03010106".
Informational tokens are "DB2 v8.1.1.64", "s040812", "U498350", and FixPak "7".
Product is installed at "/usr/opt/db2_08_01".
测试的过程
$ db2 list tablespace containers for 4 show detail
Tablespace Containers for Tablespace 4
Container ID = 0
Name = /db2_db/bill
Type = Path
Total pages = 1
Useable pages = 1
Accessible = Yes
$ cd /db2_db
$ rm -r bill
$ db2 list tablespace containers for 4 show detail
Tablespace Containers for Tablespace 4
Container ID = 0
Name = /db2_db/bill
Type = Path
Total pages = 1
Useable pages = 1
Accessible = No
$ cd /db2_db
$ ls
SAMPLE.0.db2inst1.NODE0000.CATN0000.20070528171046.001
db2inst1
lost+found
$ db2 restore db sample from /db2_db
SQL2539W Warning! Restoring to an existing database that is the same as the ba
ckup image database. The database files will be deleted.
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
$ pwd
/db2_db
$ ls -l
total 106096
-rw-r----- 1 db2inst1 db2grp1 54308864 May 28 17:11 SAMPLE.0.db2inst1.NODE0
000.CATN0000.20070528171046.001
drwxr-x--- 2 db2inst1 db2grp1 512 May 28 17:42 bill
drwxrwxr-x 3 db2inst1 db2grp1 512 May 28 17:29 db2inst1
drwxrwx--- 2 db2inst1 db2grp1 512 Apr 16 15:32 lost+found
$ db2 list tablespace containers for 4 show detail
Tablespace Containers for Tablespace 4
Container ID = 0
Name = /db2_db/bill
Type = Path
Total pages = 1
Useable pages = 1
Accessible = Yes
以下使用裸设备情况
$ db2 list tablespace containers for 5 show detail
Tablespace Containers for Tablespace 5
Container ID = 0
Name = /dev/rdb2lv03
Type = Disk
Total pages = 16384
Useable pages = 16352
Accessible = Yes
$ exit
# cd /dev
# mv rdb2lv03 rdb2lv03bk
$ db2 list tablespace containers for 5 show detail
Tablespace Containers for Tablespace 5
Container ID = 0
Name = /dev/rdb2lv03
Type = Disk
Total pages = 16384
Useable pages = 16352
Accessible = No
$ db2 restore db sample from /db2_db
SQL2539W Warning! Restoring to an existing database that is the same as the ba
ckup image database. The database files will be deleted.
Do you want to continue ? (y/n) y
SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009
beginner-bj
版主
UID 9471
精华
15
积分 1369
帖子 2357
活跃指数 186
LU金币 4352 个
LU金条 0 个
阅读权限 210
注册 2004-1-16
#6
大
中
小
使用道具
发表于 2007-5-28 17:44
资料
个人空间
短消息
加为好友
对于使用目录的测试步骤,你的/db2_db应该是个文件系统,假如/db2_db不存在,估计RESTORE的时候也会报错。
我的博客:http://blog.chinaunix.net/index.php?blogId=739欢迎访问,并请多多批评指正。
投票
交易
悬赏
活动
LoveUnix
专项技术区
> AIX -IBM UNIX
> 其他UNIX & Linux
> i5 (AS400) & IBM大机
> PC Server & HPC
> 存储设备
> 备份软件
> 网络 & 安全
> 编程开发 & Rational
> DB2 & Informix
> ORACLE等数据库
> 中间件技术
行业综合区
> 职业咨询 前程无忧
> 培训认证 行业入门
> 行业应用 项目实施
> 产品信息 商务交流
> Free download下载
交流灌水区
> 蓝色太平洋
> 墨香雅韵
> 共建家园
> 博客专区
当前时区 GMT+8, 现在时间是 2008-7-7 05:50
乐悠LoveUnix论坛-京ICP备05005823号
Thanks to
Discuz!
© 2001-2007 Power by
LoveUnix.net
Processed in 0.134411 second(s), 8 queries , Gzip enabled
TOP
清除 Cookies
-
联系我们
-
乐悠LoveUnix
-
Archiver
-
WAP
界面风格
----------
Discuz! 5 Default
新DISCUZ风格
控制面板首页
编辑个人资料
积分交易
公众用户组
好友列表
升级个人空间
基本概况
流量统计
客户软件
发帖量记录
论坛排行
主题排行
发帖排行
积分排行
在线时间
管理团队
管理统计