What would be the best approach?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat What would be the best approach?
# 1  
Old 06-03-2014
What would be the best approach?

I have a table in one of my DB. The DB is about 300 gig - of that 249 gig is in this table. The data is somewhat important but even if we delete half of it won't affect anybody.

I would like to reclaim some space back so my question is what would be the best approach to accomplish this task. Delete half of the data? Shrink the table?

Someone suggested to enable row movement followed by the shrink space?

Any suggestion?
# 2  
Old 06-03-2014
How about compressing the table?
Code:
alter table aradmin.t253 move compress;

# 3  
Old 06-03-2014
What technology: Oracle, MySQL, PostgreSQL, ... other?
# 4  
Old 06-03-2014
Oracle

---------- Post updated at 01:27 PM ---------- Previous update was at 01:26 PM ----------

Quote:
Originally Posted by SriniShoo
How about compressing the table?
Code:
alter table aradmin.t253 move compress;

Compressing should be good. It is not as shrinking the table right?
# 5  
Old 06-04-2014
You may be into an export/truncate/import to remove the data because otherwise you will generate vast amounts of redo. Either the transaction will fail and rollback (so you don't delete anything) or you may hang your database. I suppose you could do it as an un-logged transaction, but then a failure is unrecoverable.

The problem with export/truncate/import might be with the fill ratio. When adding data organically, it will probably fill pages/chunks/blocks (depending on your DB terminology) before allocating the next. With an import, it will likely leave a portion for inserting to later, just in case you add something that would better sit on the same page.

It's all a bit obscure, but the thing you have to bear in mind is that if you export your data with a query that only gives you 50% of it, you might only retrieve 25% of the space allocated.

At towards 300G, any mass manipulation is going to be difficult.


The space you have in your redo log filesystem is going to be critical.




Robin
# 6  
Old 06-04-2014
Quote:
Originally Posted by rbatte1
You may be into an export/truncate/import to remove the data because otherwise you will generate vast amounts of redo. Either the transaction will fail and rollback (so you don't delete anything) or you may hang your database. I suppose you could do it as an un-logged transaction, but then a failure is unrecoverable.

The problem with export/truncate/import might be with the fill ratio. When adding data organically, it will probably fill pages/chunks/blocks (depending on your DB terminology) before allocating the next. With an import, it will likely leave a portion for inserting to later, just in case you add something that would better sit on the same page.

It's all a bit obscure, but the thing you have to bear in mind is that if you export your data with a query that only gives you 50% of it, you might only retrieve 25% of the space allocated.

At towards 300G, any mass manipulation is going to be difficult.


The space you have in your redo log filesystem is going to be critical.




Robin
Thanks for the explanation. I am not an Oracle DBA and didn't realize that deleting multiple gigs of data at the same time will impact the redolog unless we delete 1000 rows and commit and repeat this process (We won't do that). I think compressing or shrinking would be an option to consider for now or go with what you already have suggested.

Thanks again
# 7  
Old 06-04-2014
Quote:
Originally Posted by newborndba
Thanks for the explanation. I am not an Oracle DBA and didn't realize that deleting multiple gigs of data at the same time will impact the redolog unless we delete 1000 rows and commit and repeat this process (We won't do that). I think compressing or shrinking would be an option to consider for now or go with what you already have suggested.

Thanks again
Deleting data always creates redo. you can truncate the table, but then you would not have any data and truncate is an unrecoverable operation. It can't be rolled back. If there are columns that you don't need, dropping columns will eventually cause the table to shrink. You want to first drop columns that aren't needed, then do a alter table move compress and you should end up with a smaller table. CHAR's can take up the most space, because they use the stated amount even if they are empty. If the table has blobs, you can store them in a different table space, which might help as well.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What is the right approach to take?

Hello every one, I will love to know what is the best approach to take in obtaining books online. I find it disturbing just googling a book online and downloading it without actually paying for it. I strongly believe that this is wrong and that i may not be able to unlock the key contents and... (2 Replies)
Discussion started by: despiragado
2 Replies

2. Shell Programming and Scripting

Help with approach and developing script

Hi- I need to develop a script for following scenario in AIX and K shell environment.I am from windows server background for most my career ,so please bear with me and advise suitable approach and technical assistance.Having said that I am aware of unix shell commands but never pput together at... (1 Reply)
Discussion started by: nirasm
1 Replies

3. Shell Programming and Scripting

Best Approach To Encrypt The Passwords

Hello All, I am using the red hat Linux OS and bash shell scripting. Below is my requirement. I need to store encrypted the passwords of database accounts, ftp acccounts into a file1. Encrypt that file1 or make it secure with password to open & read it. Later in shell scripts I need to... (12 Replies)
Discussion started by: Ariean
12 Replies

4. Programming

Oracle Procedure approach

HI All , I am new to oracle procedures. Please help me for the approach to satify the requirement. I need to create procedures. with parameters passed ( say report,type,identities,country ) It should also call sql query within the procedures and passed parameters should be used in where clause... (2 Replies)
Discussion started by: Perlbaby
2 Replies

5. Shell Programming and Scripting

Approach on Header record

All, I currently have a requirement to fetch a Date value from a table. And then insert a Header record into a file along with that date value. ex: echo "HDR"" "`date +%Y%j` `date +%Y%m%d` In the above example I used julian date and standard date using Current Date. But the requirement... (0 Replies)
Discussion started by: cmaroju
0 Replies

6. Shell Programming and Scripting

Need advice on approach for script

Greetings all. I have a repository server which receives, without exhaggeration, several million files a week. The majority of these files are in .csv format, which means they're highly compressable. They are spread throughout numerous directories where there are configured monitoring utilities... (4 Replies)
Discussion started by: msarro
4 Replies

7. Homework & Coursework Questions

How to approach Julian date?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This function is given the day, month and year and returns the Julian date. The Julian date is the... (1 Reply)
Discussion started by: mgyeah
1 Replies

8. Programming

How to evaluate which coding approach is best?

Let's say for example that we have two different ways was can code the exact same program to achieve the same result. What is the best way to determine which of the two methods is the best solution? Is it as simple as basing it on how long the program takes to run or is there a more... (4 Replies)
Discussion started by: jmvbxx
4 Replies

9. Shell Programming and Scripting

Approach to writting a script

Hello all, I've just joined. I did a google search and your site came up, I had a look and thought I'd like to become a member. I'm from Ireland. I've written a few scripts before, but this new task has me foxed. I would like to figure out the best approach to achieving the following ... (15 Replies)
Discussion started by: Bloke
15 Replies
Login or Register to Ask a Question