如何移动DB2的数据库建库目录
2012-03-14 18:34
197 查看
由于目录变化,需要将数据库从目录/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,移动后的数据库可以被使用啦。
重新编目数据库
$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,移动后的数据库可以被使用啦。
相关文章推荐
- 如何将AD数据库移动到其他目录下
- 如何将AD数据库移动到其他目录下
- 如何处理创建DB2工具目录数据库的时候遇到的SQL1005N错误?
- 如何移动SQL SERVER的系统数据库
- 在客户化目录如何更新数据库架构
- 如何将DB2的数据库转换到mySQL中?
- DB2如何创建表空间 如何创建数据库 如何创建缓冲池
- 数据库开发-如何移动SQL SERVER2005中mater和temp数据库存放的位置
- 如何解决SWAT模型数据移动目录后出现的“SWAT2005.mdb database specified in your MasterProgress table does not exists. Please correct and try again”的问题
- SQL 教程数据库包括:Oracle, Sybase, SQL Server, DB2, Access 等等,您将学到如何使用 SQL 访问和处理数据系统中的数据
- 如何将DHCP 数据库移动到Windows 2003
- 如何打开resaw目录中的数据库文件?
- Windows Server 2008 R2之管理活动目录数据库(压缩/移动)
- db2如何手动建库
- 如何DB2 数据库的快照和视图获取方法
- SQL Anywhere教程(一):如何将ASA数据库部署至移动设备
- 如何知道PostgreSQL数据库下每个数据库所对应的目录
- db2如何获取当前连接的数据库信息
- 如何将virtualbox的虚拟机目录移动位置
- 有没有知道如何连接DB2的数据库?