DB2 changes to the database directory change operation

Source: Internet
Author: User
Tags db2 connect db2 connect to server port

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.