1833048 Members
2396 Online
110049 Solutions
New Discussion

Reducing a l.v

 
SOLVED
Go to solution
radi_1
Frequent Advisor

Reducing a l.v

Hi,
I have mistakingly extended a l.v from 250M to 8G and I need to reduce it back to 400M and this l.v contains the Oracle software which I have a tape backup for.
The question,is there any danger of corrupting the software or the f.s and if there is,can I safely restore it from tape?
Note;I used tar command for backup.
Regards
never take simple maters for granted
15 REPLIES 15
T G Manikandan
Honored Contributor
Solution

Re: Reducing a l.v

Do you have Oracle datafiles,controlfiles or logifles in that volume?
If that is the case then you should go for a different strategy.
If you only Oracle software then the best way is to copy the entire files to another directory in another file system which has space.

Once the file system is reduced or newly created then just copy the files from the backedup dir back to this volume.
YOu are right sometimes when you reduce your LV your it might corrupt your data with using Online JFS.

check this document for reducing the file system.

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000063231654


Ravi_8
Honored Contributor

Re: Reducing a l.v

Hi,

If you reduce the filesystem, you loose data in that lv. Since your application is Oracle it's better to backup using export or archive log bcakup
never give up
U.SivaKumar_2
Honored Contributor

Re: Reducing a l.v

Hi,

First check whether the data in that filesystem has exceeded 400MB. If yes , then just lvreduce to 400MB will cause data loss. So take a backup before lvreduce.

If the data is less than 400MB , then you can lvreduce without data loss.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Ravi_8
Honored Contributor

Re: Reducing a l.v


Hi,

TGM and Siva, could u pls let me know about your's.

i am available at : rbenakan@in.ibm.com
never give up
T G Manikandan
Honored Contributor

Re: Reducing a l.v

Ravi,

Good to see you at IBM,Bangalore.
I am located at Chennai.
you can reach me at
gbmanikandan@yahoo.com


Thanks
U.SivaKumar_2
Honored Contributor

Re: Reducing a l.v

Hi Ravi,

Iam in Coimbatore.
please mail me at sivakumr@rediffmail.com

regards,

U.SivaKumar
Innovations are made when conventions are broken
donne007
Regular Advisor

Re: Reducing a l.v

Hi
Nice To see u Guys in Parts of South India, well ravi, I was in IBm some time back , can u please touchbase with me at asifayaz007@yahoo.com

wish Your a Happy & a Prosperous New Year

Good Luck
Asif
radi_1
Frequent Advisor

Re: Reducing a l.v

Hi,
Let me update the info. on the problem:
-The original f.s size was 251MB
-The space used by the oracle software is 151MB
-The f.s type is hfs
-Its current f.s size is 8GB(extended by mistake)
So I want to reduce the f.s to a new size of 400MB which is 150MB more than the original size.
i understood from your replies that I can reduce safely provided the above situation is true,but if something wrong hapens can oracle software be restored from tape backup without worrieing about files links to hp-ux files and file permissions and ownerships and what have you?THIS IS WHAT AM WORRIED ABOUT.
Mind you I have used tar for backup.
Regards.
never take simple maters for granted

Re: Reducing a l.v

Hi

Given to understand that you have taken a proper tar backup of oracle software on magnetic tape. ya, you can always restore from backup (tape) to disk and this will not have any problem.
One thing you can do is
1. remove the lv which has the oracle software.
2. re-create the lv with how much ever size you want to.
3. mount the lv as any file system of oracle
4. restore from the tape the oracle software to the newly created lv.

Hey, if you have oracle database datafiles in that directory of software then you should have taken these files a backup when the database is down (not running). Please down the database and take the datafiles backup and then restore else your database/s will not be consistent and will not come up
Ravi_8
Honored Contributor

Re: Reducing a l.v

Hi, salah

you have mentioned that
(The original f.s size was 251MB
The space used by the oracle software is 151MB) .

I have done many oracle installations, till now i haven't seen any oracle version using only just 151MB of space(even client version also uses more than this).
So the better is removing this lvol and recreate with required space and reinstall the oracle.
never give up
radi_1
Frequent Advisor

Re: Reducing a l.v

Hi,
To Sekhar:
Only the oracle s/w is on the unlucky l.v,the dbs files are all on separate l.v.
Your last reply reminds me of another matter which i want to be clear about;
The customer makes daily backup of his dbs,he has the habit of doing so before going home regardless of files bieng accessed and updated while backup is runnig(he keeps oracle up ofcours).The question is ,does that mean that the backup when it completes will not contain all up to date files?

To ravi;
You'v sugested a reinstallation of oracle after new l.v creation,does that mean you do not agree with tape restore?
never take simple maters for granted
pap
Respected Contributor

Re: Reducing a l.v

Hello.

If you reduce the size of LV , you need to take a backup of that LV first.
Then reduce the LV and restore the backup.
If you have oracle filesystems in that LV, please make sure that you take COLD backup.

Hope this Helps.

thanks,
-pap
"Winners don't do different things , they do things differently"
Ravi_8
Honored Contributor

Re: Reducing a l.v

Hi, salah

sorry, if you have the cold backup it serve the purpose
never give up
charles fitten
New Member

Re: Reducing a l.v

Hi, M. Salah
Have you tested restoring from your backups, when you use tar, it doesn't backup hidden files at the root of the filesystem in question, but it does keep ownership & permissions. I didn't use lvreduce because of the data corruption potential. I took the following steps which was safer.
1)Shutdown Oracle Databases.
2)cd to the f.s. on the l.v.
3)Backup all the files in the f.s. using tar.
Ex: tar -cvf *
4)Move tar file to another directory w/enough space.
5)Unmounted the f.s.
6)Removed the l.v
Ex: lvremove
7)Created the l.v.
Ex: lvcreate -L -r N
8)Create the f.s.
Ex: newfs -F vxfs -o largefiles -b8192

9)Mount & check new f.s. created.
Ex: mount -a & bdf
10)Copy tar file from other dir. to new one.
11)Untar the file.
Ex: tar -xvf *
Note: Hidden files won't be there from the root
of the f.s.
12)Check for space distributed back to disk.
Ex:Vgdisplay -v
13)Startup Oracle Databases.
14)Remove untared file in newly created f.s.
15)Gzip the saved tar file until sure everythings working correctly.
"Think about the future!"
Sridhar Bhaskarla
Honored Contributor

Re: Reducing a l.v

Hi,

Do you have onlineJFS?. If so, then you can give a try with fsadm followed by lvreduce. Otherwise, there is no other way except to destroy and recreate it.

But if you have some space somewhere, you can create a new logical volume and copy the data.

1. Bring down oracle. Make sure this lvol is not accessed through fuser.
2. Create a new logical volume of 400MB. Mount it as some file system.
3. You can use simple 'cp' to copy the data and change the permissions on the new mount point.

cp -Rp /old_filesystem /new_filesystem

4. Unmount the old file system and new file system. Mount the new file system on the old mount point.

5. Bring up oracle database. Make sure everything is fine. Allow a couple of days.

6. Destroy the old logical volume and get the 8GB space back.

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