Home » RDBMS Server » Performance Tuning » what are the steps to follow to coalesce
|
|
|
Re: what are the steps to follow to coalesce [message #160811 is a reply to message #160809] |
Tue, 28 February 2006 07:55   |
 |
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
>>then i will see some change in the freespace report ?
Try it!. Test it. Then do it in your production database.
this only for one table and constraints / indexes are not dealt. So you need to rebuild the constraints/indexes.
You need to do this for all tables ( a simple scripting would do).
Probably for you, export/import is the easiest way.
[Updated on: Tue, 28 February 2006 07:55] Report message to a moderator
|
|
|
|
Re: what are the steps to follow to coalesce [message #160826 is a reply to message #160822] |
Tue, 28 February 2006 09:40   |
 |
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
>> Also what are the steps for export/import stuff ? How that helps in deleting old data and reclaiming space?
http://www.orafaq.com/faq/import_export
More information in Oracle documentation.
Long story short, with export/import ,You are rebuilding your database/concerned schema.
>>create index
>>create anoter_table as select * from my_table
>>drop my_table
>>rename my_table to another_table
>>drop index
>>in a script then this table will retain the relationship with other tables in the DB as before ?
You need to understand more.
Above has nothing to do with relationships.
When you drop the table, all the related indexes/constraints are dropped.
When you create another_table with CTAS ( Create table as select) indexes/constraints are not recreated. You can see here another_emp table as not been recreated with indexes/constraints by default. You need to recreate them manually.
scott@9i > select table_name,index_name from user_indexes;
TABLE_NAME INDEX_NAME
------------------------------ ------------------------------
DEPT SYS_C001862
EMP SYS_C001863
scott@9i > select table_name,constraint_name,constraint_type,r_constraint_name from user_constraints;
TABLE_NAME CONSTRAINT_NAME C R_CONSTRAINT_NAME
------------------------------ ------------------------------ - ------------------------------
DEPT SYS_C001862 P
EMP SYS_C001863 P
EMP SYS_C001864 R SYS_C001862
scott@9i > create table another_emp as select * from emp;
Table created.
scott@9i > select table_name,index_name from user_indexes;
TABLE_NAME INDEX_NAME
------------------------------ ------------------------------
DEPT SYS_C001862
EMP SYS_C001863
scott@9i > select table_name,constraint_name,constraint_type,r_constraint_name from user_constraints;
TABLE_NAME CONSTRAINT_NAME C R_CONSTRAINT_NAME
------------------------------ ------------------------------ - ------------------------------
DEPT SYS_C001862 P
EMP SYS_C001863 P
EMP SYS_C001864 R SYS_C001862
Other option is to just re-insert the data back ( without dropping the original table)
scott@9i > drop table another_emp;
Table dropped.
scott@9i > create table anothe_emp as select * from emp;
Table created.
scott@9i > truncate table emp;
Table truncated.
scott@9i > insert into emp /*+ APPEND */ select * from anothe_emp;
14 rows created.
scott@9i > commit;
Commit complete.
Drop drop the duplicate / dummy table.
You have to do this for every table.
Instead do an export/import.
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri May 02 15:51:06 CDT 2025
|