Monday, December 14, 2009

Rebuild Database

Description:
We can use the below approaches to rebuild the entire database.

Approach #1: For Smaller Database.
Step 1: Export the whole database using export utility (exp).
Step 2: Drop the whole database.
Step 3: Create the database.
Step 4: Import the whole database using import utility (imp).

Approach #2:
Step 1: Create the additional tablespace to move all the objects to this tablespace. e.g. if all the objects exists in “USERS” tablespace, we can create “USERS1” tablespace.
Step 2: Move all the objects to newly created additional tablespace using ALTER TABLESPACE command (REBUILD option).
Step 3: Again move all the objects to original tablespace.

Approach #3:
Step 1: We can use transportable tablespace to move one database to another database (only for 10g)

Approach #4:
Step 1: Take Hotbackup (Data files and control file backup) of the existing server. Rebuild the whole database using Hotbackup files.

Approach #5:
Step 1: Take Cold backup of the existing server. Rebuild the whole database using Cold backup files.

Note1: Approach #1 will avoid row chaining and fragmentation of the table and also easiest method to rebuild the whole database.
Note2: Approach #2 we need to additional space in servers. This method also avoid row chaining and fragmentation

No comments: