Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

OS commands in moving oracle binaries and datafiles while db is offline

SOLVED
Go to solution
Ricky_4
Frequent Advisor

OS commands in moving oracle binaries and datafiles while db is offline

Hi All,

Our Oracle and applications binaries and oracle datafiles are residing in old external storage. We will move those files while database is offline in a new storage that are faster and larger space. Kindly assist us of what is the appropriate command we have to use to achieve the database and application are still working fine after moving of those files.

Please also consider the following:
preserve the permission and date and time of the files
symbolic link files
Oracle datafiles is beyond 2 Gb

Thank you very much in advance for your assistance.

Regards,

Adriatico
6 REPLIES
Steven E. Protter
Exalted Contributor

Re: OS commands in moving oracle binaries and datafiles while db is offline

the mv command will preserve permissions

Not sure about the symbolic link files, you may need to redo them.

Methdology:

lets say the old logical volume is /dev/vg02/oracle mounted at /oracle

make a new filesystem for data and binaries on the new array, say /dev/vg03/oracle and mount it as /oracle_temp

cd /oracle
mv * /oracle_temp

umount /oracle_temp

change /etc/fstab to make/dev/vg03/oracle to automount as /oracle

umount /oracle

mount -a

Done.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven E. Protter
Exalted Contributor

Re: OS commands in moving oracle binaries and datafiles while db is offline

let me add the following:

1) because my fingers are all thumbs, I'd take an fbackup of everything just in case I mess up.

2) newfs -F vxfs -o largefiles will create the new filesystem to handle files bigger than 2 GB

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor
Solution

Re: OS commands in moving oracle binaries and datafiles while db is offline

Hi Adriatico,

Say if you are copying the data from /data1/db to /data2/db then I would do

#cd /data1/db;/usr/sbin/fbackup -i . -f - |(cd /data2/db; /usr/sbin/frecover -v -r -f -)

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ricky_4
Frequent Advisor

Re: OS commands in moving oracle binaries and datafiles while db is offline

Hi All,

Thank you from your replies.

How about other OS command that could help us the database and the applications are still working fine after moving to new storage.

Thanks.

Adriatico
Sridhar Bhaskarla
Honored Contributor

Re: OS commands in moving oracle binaries and datafiles while db is offline

Hi Adriatico (Again),

fbackup is native to HP-UX. It's an excellent alternative if one doesn't want to purchase any third party backup tool for day-to-day backup activities. It will take care of all the three requirements of yours. Once the copy is done using fbackup, unmount old filesystems, mount the new filesystems on the old mount points and start the database. If everything goes well, simply remove the old LVs and VGs. If not, you can always go back.

But still ensure a good tape backup prior to any work you do on the system.

Also, note SEP's second point in his second post. You must create the filesystems to support "largefiles".

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: OS commands in moving oracle binaries and datafiles while db is offline

Hi Adriatico,

Not sure if I understood your question completely. I will briefly describe what I would do with one example filesystem.

Say you have a file system /data1/db in volume group vg01 with disks c1t0d0,c1t0d1, c2t0d0 and c2t0d1. c2t0d0 and c2t0d1 are the alternate paths.

1. Reduce the alternate paths

vgreduce vg01 /dev/dsk/c2t0d0
vgreduce vg01 /dev/dsk/c2t0d1

2. Disconnect the cable corresponding to the above path. Connect the cable from the new storage.

3. Run ioscan and ioscan -fnC to find the new devices.

ioscan -f
insf
ioscan -fnC disk

Find out the new devices. For ex., say c4t0d0 and c4t0d1.

4. Create new volume groups with the new devices.

pvcreate /dev/rdsk/c4t0d0
pvcreate /dev/rdsk/c4t0d1
mkdir /dev/vg01new
mknod /dev/vg01new/group c 64 0x0?0000 (Use a unique number in place of ?. To find the next number in sequence, do 'll /dev/*/group)
vgcreate -l 255 -p 255 -s 16 vg01new /dev/dsk/c4t0d0
(Chagne the options with vgcreate as necessary)

vgextend /dev/vg01new /dev/sdk/c4t0d1

5. Create new logical volumes of exactly the same size as of the odl logical volumes.

lvcreate -n data1db -L vg01new
newfs -F vxfs -o largefiles /dev/vg01new/rdata1db

6. Mount the new logical volume on a new mount point.

#mkdir /data2/db
#mount /dev/vg01new/data1db /data2/db

7. Stop the database.

8. Use the 'fbackup' command or any other command of your choice to copy the data from old filesystem to new filesystem.

9. Unmount both old and new filesystems. Mount the new filesystem on the old mount.

#umount /data1/db
#umount /data2/db
#mount /dev/vg01new/data1db /data1/db

10. Start the database. Ensure the everything is fine.

11. Remove the old VG.

#ll /dev/vg01/group (note the minor number say 0x010000)

#vgchange -a n vg01
#vgexport vg01

cleanup: Here you will be importing the new VG as old VG and also connect the the other path for redundancy.

1. Unmount the new filesystems and export new VG.

#umount /dev/vg01new/data1db
#vgexport -p -v -s -m /tmp/vg01new.map vg01new
#vgchange -a n vg01new
#vgexport vg01new

2. Disconnect the primary path corresponding to the OLD storage and connect the path of new storage.

ioscan -f
insf
ioscan -fnC disk

Make sure you see the disks on the new storage from both the paths.

3. Import the fresh created VG as vg01.

#mkdir /dev/vg01
#mknod /dev/vg01/group c 64 0x010000
(minor number from step 11)
#vgimport -v -s -m /tmp/vg01new.map vg01
#vgchange -a y vg01
#mount -a

4. Start the database.

I gave the commands for one filesystem and one VG and two PVs.. You will need to repeat the above steps for all the filesystems, VGs and PVs. If you are using 'raw' devices for the database, then you cannot use 'fbackup' command. You will need to use 'dd'.

-Sri



You may be disappointed if you fail, but you are doomed if you don't try