DB2 changes to the database directory change operation:
because the DB2 database directory changes, you need to move the database from the directory /home/db2inst1 move to /dbdata/
1.view the original database and directory:
[[email protected] ~]$ DB2 list DB directory
System database Directory
Number of entries in the directory = 2
Database 1 Entry:
Database alias = DSDB2
database name = DSDB2
Local database directory =/dbdata/dsdb2
Database release level = 10.00
comment =
directory Entry type = indirect
Directory database partition number = 0
Alternate server host name =
Standby server port number =
Database 2 Entry:
Database alias = Ycyj
database name = Ycyj
Local database directory =/home/db2inst1/ycyj
Database release level = 10.00
comment =
directory Entry type = indirect
Directory database partition number = 0
Alternate server host name =
Standby server port number =
2.Move Directory
[Email protected] ~]$ mv/home/db2inst1/ycyj//dbdata/ycyj
3.re-cataloging the database
[Email protected] dbdata]$ DB2 uncatalog DB Ycyj
db20000i uncatalog DATABASE command completed successfully.
db21056w directory changes do not take effect until the directory cache is refreshed.
[Email protected] dbdata]$ DB2 catalog db ycyj On/dbdata/ycyj
db20000i CATALOG DATABASE command completed successfully.
db21056w directory changes do not take effect until the directory cache is refreshed.
To re-display the database:
[[email protected] dbdata]$ DB2 list DB directory
System database Directory
Number of entries in the directory = 2
Database 1 Entry:
Database alias = DSDB2
database name = DSDB2
Local database directory =/dbdata/dsdb2
Database release level = 10.00
comment =
directory Entry type = indirect
Directory database partition number = 0
Alternate server host name =
Standby server port number =
Database 2 Entry:
Database alias = Ycyj
database name = Ycyj
Local database directory =/dbdata/ycyj
Database release level = 10.00
comment =
directory Entry type = indirect
Directory database partition number = 0
Alternate server host name =
Standby server port number =
4.To connect to a database:
[Email protected] dbdata]$ DB2 connect to Ycyj
sql1031n The database directory could not be found in the indicated file system.
sqlstate=58031
5.table Space Operations:
If you still cannot connect to the database after you have done the above operation, you need to do the following for the table space:
5.1 Edit mvdb.cfg file
Db_name=ycyj
Db_path=/home/db2inst1,/dbdata/ycyj
Instance=db2inst1
Nodenum=0
#CONT_PATH =/home/db2inst1/ycyj/db2inst1/node0000/ycyj/t0000000/c0000000.cat,/dbdata/ycyj/db2inst1/node0000/ Ycyj/t0000000/c0000000.cat
storage_path=/home/db2inst1/ycyj,/dbdata/ycyj/
5.2 Run the following command:
[Email protected] ~]$ db2relocatedb-f mvdb.cfg
dbt1037n cannot specify for automatic memory table space Cont_path entry.
5.3 comment out the yellow line labeled above, re-execute, execute successfully:
[Email protected] ~]$ db2relocatedb-f mvdb.cfg
The file and control structure were successfully changed.
The database was successfully cataloged.
dbt1000i The tool was successfully completed.
[Email protected] ~]$
The re-cataloging succeeds and the database can be successfully connected.
5.4 To connect to a database:
[Email protected] ~]$ DB2 connect to Ycyj
database connection Information
Database server =db2/linuxx8664 10.5.3
SQL Authorization Identification =db2inst1
Local Database alias =ycyj
[Email protected] ~]$
OK, the moved database can be used.
This article is from "Flower Asahi's Blog" blog, please be sure to keep this source http://huazhixu123.blog.51cto.com/1591874/1976459
DB2 changes to the database directory change operation