如何移动DB2的数据库建库目录

由于目录变化,需要将数据库从目录/home/db2inst1移动到目录/public/home/guanghong.yu/db2inst1

重新编目数据库

$db2 uncatalog db oracle
$db2 catalog db oracle

编目成功后会即可看到:
$db2 list db directory
 Database alias                       = ORACLE
 Database name                        = ORACLE
 Local database directory             = /public/home/guanghong.yu/db2inst1
 Database release level               = d.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

如上操作做了后仍然不能连接数据库,需要对表空间做如下操作:
编辑mvdb.cfg
DB_NAME=ORACLE
DB_PATH=/home/db2inst1,/public/home/guanghong.yu/db2inst1
INSTANCE=db2inst1
NODENUM=0
CONT_PATH=/home/db2inst1/db2inst1/NODE0000/ORACLE/T0000000/C0000000.CAT,/public/home/guanghong.yu/db2inst1/db2inst1/NODE0000/ORACLE/T0000000/C0000000.CAT
STORAGE_PATH=/home/db2inst1/,/public/home/guanghong.yu/db2inst1
运行如下命令:
$db2relocatedb -f mvdb.cfg
[db2inst1@hpserver2 db2]$ db2relocatedb -f mvdb.cfg
Files and control structures were changed successfully.
Database was catalogued successfully.
DBT1000I  The tool completed successfully.
运行成功,数据库可以成功连接激活啦
[db2inst1@hpserver2 db2]$ db2 connect to oracle

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.5
 SQL authorization ID   = DB2INST1
 Local database alias   = ORACLE
OK,移动后的数据库可以被使用啦。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值