Database Backup   «Prev  Next»
Lesson 7Using Import to recover database objects
ObjectiveUse Import to restore database information.

Using Oracle Import to recover Database Objects

You have seen how to export database objects from your database. Now we will review the use of the Import utility to insert data objects into a database. The database that you insert objects into does not need to be the same database that was used for the extract. For example, many application providers will export a base image of their database to facilitate the installation of their customer databases.
Import modes As with exports, there are three import modes:
Mode Description
Table Will allow you to import a selected table. You must have the appropriate user privileges to import other user's table.
User Will allow you to import a database object for a specific user.
Full Will allow you to import all database objects except for those owned by SYS. Users must have IMP_FULL_DATABASE role to import a full database export.

Import commands (Legacy Examples)
The following examples use Oracle 8.0.5 on an NT platform.
To run an interactive import session, use the following command:
C:/Oracle/bin>imp80 system/manager
To import data using a parameter file, use the following command:
C:/Oracle/bin>imp80 parfile=import filename
As with Export, you can override parameters in the import file by including them on the command line.
If the user SCOTT had deleted his DEPT table, the following command would restore the DEPT table, and only the DEPT table. The rows=y parameter causes the import to load the data as well as the structure.

C:/Oracle/bin>imp80 scott/tiger tables=dept 
rows=y file=C:\exp01.dmp
Importing incremental, cumulative, and complete export files
Let us say that you have a complete export file, X.dmp; a cumulative export file, C.dmp; and an incremental export file, I.dmp. To import these into a new database properly, you would use the following command:

imp80 system/manager inctype=SYSTEM full=y 

This will import all the new system objects into your database from the most recent version of the database. Then you would execute the following series of commands to import the data:
imp80 system/manager inctype=RESTORE full=y 

imp80 system/manager inctype=RESTORE full=y 

imp80 system/manager inctype=RESTORE full=y 
Online help
You can get online help by executing the following command:
C:/Oracle/bin>imp80 help=y

The output from this online help command is shown in the following SlideShow:

Oracle Import Help
The next lesson concludes this module.