473,385 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Moving home directory on DB2 instance?


Folks,

I need to move HOME directory of an instance to another directory.
What is the best way of doing it?
Is changing password file enough? or dies DB2 store this info in it's own
config?

I am running UDB 8.2 on Linux and AIX.

Thanks.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Nov 12 '05 #1
6 8831
Hemant Shah schrieb:
Folks,

I need to move HOME directory of an instance to another directory.
What is the best way of doing it?
Is changing password file enough? or dies DB2 store this info in it's own
config?


It does, so changing the password-file is not enough.
Search the Infocenter at

http://publib.boulder.ibm.com/infoce...help/index.jsp

for "db2relocatedb".

Think this is what you are looking for.

regards,

Norbert
Nov 12 '05 #2
You didn't state that you need to change the instance name so I suspect
that you discovered that the /home filesystem isn't large enough to hold
your database, forcing you to "move the HOME directory".

A simple approach is to offline backup the database(s) and do a
redirected restore to another location. Don't forget to change the
location of the log files. This will, however keep the existing home
directory and all of its references to the DB2 ececutables.
If you really need to move the entire home directory then you could try
the following:
1. Make an offline backup of the database(s).
2. Shut down the instance.
3. Double check that the instance is down.
4. Mount your new disk drive/partition on a temporary directory
5. Copy the home directory and all subdirectories to the temporary
directory. This must be done keeping existing ownership and permissions
for all files. All hidden files (starting with a ".") must also be
copied. Two piped copies of the tar utility should do this.
6. Unmount the temporary directory.
7. Mount the new disk drive/partition at the home directory of the
instance. browse through it and make sure that all links and files
appear present. Use the "df" command to verify the mount worked.
8. Start the instance in maintenance mode. verify that your tables are
accessable using only select statements. Shutdown the instance.
9. Unmount the disk/partition mounted on the home directory. Verify that
the unmount worked properly.
10. Delete all of the files and subdirectories of the home directory.
11. Remount the new disk drive/partition at the home directory.
12. Modify fstab to automount this at boot time.

The final step is to reboot the system and verify that the new
drive/partition is correctly mounted, allowing instance startup.

Phil Sherman


Hemant Shah wrote:
Folks,

I need to move HOME directory of an instance to another directory.
What is the best way of doing it?
Is changing password file enough? or dies DB2 store this info in it's own
config?

I am running UDB 8.2 on Linux and AIX.

Thanks.

Nov 12 '05 #3
While stranded on information super highway Norbert Munkel wrote:
Hemant Shah schrieb:
Folks,

I need to move HOME directory of an instance to another directory.
What is the best way of doing it?
Is changing password file enough? or dies DB2 store this info in it's own
config?
It does, so changing the password-file is not enough.
Search the Infocenter at

http://publib.boulder.ibm.com/infoce...help/index.jsp

for "db2relocatedb".

Think this is what you are looking for.


Thanks, that is exactly what I am looking for.
regards,

Norbert


--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Nov 12 '05 #4

Thanks for the info, but that is not what I was trying to to.

I am adding a new file system and want to move the db2instance to the new
file system. There are other users on the current filesystem and I want to
keep them there.

Norbert suggested db2relocatedb command in his post, that is exactly what I
was looking for.
While stranded on information super highway Phil Sherman wrote:
You didn't state that you need to change the instance name so I suspect
that you discovered that the /home filesystem isn't large enough to hold
your database, forcing you to "move the HOME directory".

A simple approach is to offline backup the database(s) and do a
redirected restore to another location. Don't forget to change the
location of the log files. This will, however keep the existing home
directory and all of its references to the DB2 ececutables.
If you really need to move the entire home directory then you could try
the following:
1. Make an offline backup of the database(s).
2. Shut down the instance.
3. Double check that the instance is down.
4. Mount your new disk drive/partition on a temporary directory
5. Copy the home directory and all subdirectories to the temporary
directory. This must be done keeping existing ownership and permissions
for all files. All hidden files (starting with a ".") must also be
copied. Two piped copies of the tar utility should do this.
6. Unmount the temporary directory.
7. Mount the new disk drive/partition at the home directory of the
instance. browse through it and make sure that all links and files
appear present. Use the "df" command to verify the mount worked.
8. Start the instance in maintenance mode. verify that your tables are
accessable using only select statements. Shutdown the instance.
9. Unmount the disk/partition mounted on the home directory. Verify that
the unmount worked properly.
10. Delete all of the files and subdirectories of the home directory.
11. Remount the new disk drive/partition at the home directory.
12. Modify fstab to automount this at boot time.

The final step is to reboot the system and verify that the new
drive/partition is correctly mounted, allowing instance startup.

Phil Sherman


Hemant Shah wrote:
Folks,

I need to move HOME directory of an instance to another directory.
What is the best way of doing it?
Is changing password file enough? or dies DB2 store this info in it's own
config?

I am running UDB 8.2 on Linux and AIX.

Thanks.


--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Nov 12 '05 #5
db2relocatedb will NOT move the instance. It allows you to move a
database to a different instance or move it to a new location within the
same instance. The instance "location" is determined by the operating
system when the userid is established. For both Linux and AIX, userids
are, by default, defined in the /home directory. To move a single userid
to another filesystem; you would usually define a different home
directory, ie. /home1/db2inst1 where the new file system is mounted at
/home1.

If you are moving a single userid (instance), the technique I documented
will move everything; the database(s) instance configuration files,
references to the installation libraries (do an ls -l on
/home/db2inst1.sqllib) and anything else you've put in the instance
owner's home directory or subdirectories. It has the advantage of
avoiding changes to any references to the instance, such as a user
executing the instance's db2profile before connecting. Mounting the new
filesystem on the instance owner directory avoids impacting any other
userids and guarantees that all files associated with the instance end
up on the new filesystem. It can also be done with the system up and
running without impact to other users.

If all you need to do is to relocate a database; then db2relocatedb will
do that. My experience tells me that one should always take an offline
backup (if possible) before attempting a change this significant. It
should give you an excellent recovery mechanism if anything goes wrong
when moving the database. Once you have the backup; then a redirected
restore will also move the database.

There's always more than one way to accomplish most tasks. Choose the
one you like best.

Phil Sherman

Hemant Shah wrote:
Thanks for the info, but that is not what I was trying to to.

I am adding a new file system and want to move the db2instance to the new
file system. There are other users on the current filesystem and I want to
keep them there.

Norbert suggested db2relocatedb command in his post, that is exactly what I
was looking for.
While stranded on information super highway Phil Sherman wrote:
You didn't state that you need to change the instance name so I suspect
that you discovered that the /home filesystem isn't large enough to hold
your database, forcing you to "move the HOME directory".

A simple approach is to offline backup the database(s) and do a
redirected restore to another location. Don't forget to change the
location of the log files. This will, however keep the existing home
directory and all of its references to the DB2 ececutables.
If you really need to move the entire home directory then you could try
the following:
1. Make an offline backup of the database(s).
2. Shut down the instance.
3. Double check that the instance is down.
4. Mount your new disk drive/partition on a temporary directory
5. Copy the home directory and all subdirectories to the temporary
directory. This must be done keeping existing ownership and permissions
for all files. All hidden files (starting with a ".") must also be
copied. Two piped copies of the tar utility should do this.
6. Unmount the temporary directory.
7. Mount the new disk drive/partition at the home directory of the
instance. browse through it and make sure that all links and files
appear present. Use the "df" command to verify the mount worked.
8. Start the instance in maintenance mode. verify that your tables are
accessable using only select statements. Shutdown the instance.
9. Unmount the disk/partition mounted on the home directory. Verify that
the unmount worked properly.
10. Delete all of the files and subdirectories of the home directory.
11. Remount the new disk drive/partition at the home directory.
12. Modify fstab to automount this at boot time.

The final step is to reboot the system and verify that the new
drive/partition is correctly mounted, allowing instance startup.

Phil Sherman

Nov 12 '05 #6

Let me see if I understand your method correctly.

Let's say I have a /home filesystem containing db2 instance which does not
have enough diskspace.

I move everything to a new filesystem and re-mount it as /home.
It that is correct, then it is not what I am trying to do.

In my case, I have other users in /home (including another database instance),
and I want to move one instance from /home to /home1.

While stranded on information super highway Phil Sherman wrote:
db2relocatedb will NOT move the instance. It allows you to move a
database to a different instance or move it to a new location within the
same instance. The instance "location" is determined by the operating
system when the userid is established. For both Linux and AIX, userids
are, by default, defined in the /home directory. To move a single userid
to another filesystem; you would usually define a different home
directory, ie. /home1/db2inst1 where the new file system is mounted at
/home1.

If you are moving a single userid (instance), the technique I documented
will move everything; the database(s) instance configuration files,
references to the installation libraries (do an ls -l on
/home/db2inst1.sqllib) and anything else you've put in the instance
owner's home directory or subdirectories. It has the advantage of
avoiding changes to any references to the instance, such as a user
executing the instance's db2profile before connecting. Mounting the new
filesystem on the instance owner directory avoids impacting any other
userids and guarantees that all files associated with the instance end
up on the new filesystem. It can also be done with the system up and
running without impact to other users.

If all you need to do is to relocate a database; then db2relocatedb will
do that. My experience tells me that one should always take an offline
backup (if possible) before attempting a change this significant. It
should give you an excellent recovery mechanism if anything goes wrong
when moving the database. Once you have the backup; then a redirected
restore will also move the database.

There's always more than one way to accomplish most tasks. Choose the
one you like best.

Phil Sherman

Hemant Shah wrote:
Thanks for the info, but that is not what I was trying to to.

I am adding a new file system and want to move the db2instance to the new
file system. There are other users on the current filesystem and I want to
keep them there.

Norbert suggested db2relocatedb command in his post, that is exactly what I
was looking for.
While stranded on information super highway Phil Sherman wrote:
You didn't state that you need to change the instance name so I suspect
that you discovered that the /home filesystem isn't large enough to hold
your database, forcing you to "move the HOME directory".

A simple approach is to offline backup the database(s) and do a
redirected restore to another location. Don't forget to change the
location of the log files. This will, however keep the existing home
directory and all of its references to the DB2 ececutables.
If you really need to move the entire home directory then you could try
the following:
1. Make an offline backup of the database(s).
2. Shut down the instance.
3. Double check that the instance is down.
4. Mount your new disk drive/partition on a temporary directory
5. Copy the home directory and all subdirectories to the temporary
directory. This must be done keeping existing ownership and permissions
for all files. All hidden files (starting with a ".") must also be
copied. Two piped copies of the tar utility should do this.
6. Unmount the temporary directory.
7. Mount the new disk drive/partition at the home directory of the
instance. browse through it and make sure that all links and files
appear present. Use the "df" command to verify the mount worked.
8. Start the instance in maintenance mode. verify that your tables are
accessable using only select statements. Shutdown the instance.
9. Unmount the disk/partition mounted on the home directory. Verify that
the unmount worked properly.
10. Delete all of the files and subdirectories of the home directory.
11. Remount the new disk drive/partition at the home directory.
12. Modify fstab to automount this at boot time.

The final step is to reboot the system and verify that the new
drive/partition is correctly mounted, allowing instance startup.

Phil Sherman


--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: James Jiao | last post by:
Hi all I am having a little trouble uploading files (html form with post) with php... I am trying to copy the file from its temporary upload directory to the destination directory, however,...
4
by: Luca T. | last post by:
Hello, i need a way to find the home folder of the current user no matter if i am in Linux or Windows for instance: * Linux: /home/username * Windows: C:\Documents and Settings\username Is...
0
by: Don Rozenberg | last post by:
Hello, I'm successfully running MySql under Debian with the data files in /var/lib/mysql. I would like to move the data base files to my home directory and have mysql use them from there. How...
1
by: Kenjis Kaan | last post by:
I had to run DB2 on Win2k. After installation it puts a directory under c:\DB2 and c:\DB2Log and C:\Program Files\SQLLIB Now am all confused which is instance home, db2 home etc. I had to...
4
by: esmith2112 | last post by:
Having a bear of a time trying to implement replication under 8.2 environment. I've created all of the control structures on both source and target database and can actually see data being staged...
1
by: db2udbgirl | last post by:
When I installed DB2 UDB 8.2 on AIX 5.3 it got installed in /home/db2inst1 (and I didn't care about it much then but now I would like to move the same instance of DB2 to a dedicated filesystem. May...
0
by: linkswanted | last post by:
We are your trusted source. World Moving & Storage is bonded and licensed by the U.S. Department of Transportation and is one of the largest residential moving and corporate relocation company in...
0
by: linkswanted | last post by:
We are your trusted source. World Moving & Storage is bonded and licensed by the U.S. Department of Transportation and is one of the largest residential moving and corporate relocation company in...
2
by: ogo796 | last post by:
hi friends i am having a problem with creating folder within a directory. $Tdate = date('dFY'); // first directory. $_POST)) { mkdir($Tdir."/".$Tdate."/".$_POST); ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.