由于目录变化,需要将数据库从目录/home/db2inst1移动到目录/public/home/guanghong.yu/db2inst1
由于目录变化,需要将数据库从目录/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,移动后的数据库可以被使用啦。
,