oracle sql and dba tutorial logo

Tutorial for Oracle SQL

Oracle DBA Interview Questions

Most asked Oracle DBA Interview Questions.

60 Technical Questions
42 Backup & Recovery Questions

Unix For Oracle DBA 20 Questions

Oracle DBA Topics

Overview of Oracle Grid Architecture

Difference between cluster and grid

Responsibilities of DBA's

Creating Oracle Database

Creating Database using SQL

Creating DB in 12c using DBCA

Creating DB in 12c using SQL commands

Managing Oracle 12c Container Databases

Creating Users in Oracle 12c

Managing Pluggable Databases in Oracle 12c

Creating Pluggable Database

Cloning Pluggable Database

Unplug and Plug databases in CDB's

Managing Tablespaces and Datafiles

Extending tablespaces

Decreasing size of a tablespace

Coalescing Tablespaces

Taking tablespaces Offline or Online

Making a Tablespace Read only

Renaming Tablespaces

Dropping Tablespaces

Viewing Info about Tablespaces

Renaming Datafiles

Relocating Datafiles

Relocating Datafiles in Multiple Tablespaces

Temporary Tablespace

Changing the size

Tablespace Groups

Creating a Temp. Tablespace Group

Assigning a Tablespace Group

Diagnosing and Repairing LMT

Scenario 1: Fixing Bitmap

Scenario 2: Dropping a Corrupted Segment

Scenario 3: Fixing Bitmap when Overlapped

Scenario 4: Correcting Corruption of Blocks

Scenario 5: Migrating from a Dictionary-Managed to LMT

Transporting Tablespaces

Procedure for transporting tablespaces

Transporting Tablespace Example


Adding New Redo Logfile Group

Adding Members to group

Dropping Members from group

Dropping Logfile Group

Resizing Logfiles

Renaming or Relocating Logfiles


Viewing Info About Logfiles

Managing Control Files

Multiplexing Control File

Changing the Name of a Database

Creating A New Control File

Cloning an Oracle Database


Switching to Automatic Management

Calculate Undo Retention

Altering UNDO Tablespace

Dropping an Undo Tablespace

Switching Undo Tablespaces

Viewing Information

SQL Loader


From Fixed Length file

From MySQL to Oracle

Using WHEN condition

Conventional and Direct Path Load

Direct Path

Restrictions on Using Direct Path Loads

Export and Import

Invoking Export and Import

Parameters of Export tool

Exporting Full Database

Exporting Schemas

Exporting Tables

Exporting Consistent Image of tables

Using Import Utility

Example Importing Tables

Import from One User to another User

Using Pattern Matching

Migrating a Database across platforms


Data Pump Export

Exporting a Full Database

Exporting a Schema

Exporting Individual Tables

Filtering Objects during Export

Filter Rows during Export

Suspending and Resuming Export

Data Pump Import Utility

Importing Full Dump File

Importing Objects between Schemas

Loading Objects between Tablespaces

Generating SQL File of DDL commands

Import objects of a Schema

Importing Only Particular Tables

Interactive Mode

Flash Back Features

Flashback Query

Flashback Version Query

Flashback Table to Past States

Purging Objects from Recycle Bin

Flashback Objects With Same Name

Flashback instead of PIT Recovery

Enabling Flash Back Database

Sizing flash recovery area

How far we can flashback database

Example:Flashing Back Database

Flashback Data Archive (FDA)
(Oracle Total Recall)


Creating FDA tablespace

Creating FDA

Querying historical data

Log Miner

LogMiner Configuration

LogMiner Dictionary Options

Using the Online Catalog

Extracting Dictionary to Log Files

Extracting Dictionary to File

Redo Log File Options

Example: Finding All Modifications

Mining Logfiles in a Time Range


Opening DB in Archivelog Mode

Reverting back to NoArchiveLog mode

Taking Offline (COLD) Backups

Taking Online (HOT) Backups

Recovering from the Loss of a Datafile

When in Noarchivelog Mode

When in Archivelog Mode

Recovering from loss of Control File

Recovery Manager ( RMAN )

Offline Backups using RMAN

Recover DB when in NOARCHIVELOG

Online Backups using RMAN

Backup tablespaces or datafiles

Image Backups in RMAN

Incremental Backup using RMAN

Updating backup copy for fast recovery

View info about RMAN backups

Configuring Retention policy

Configure Options in RMAN

Maintaining RMAN Repository

Recover datafiles (Archivelog mode)

Recover datafiles by renaming

Performing Disaster Recovery










Using Oracle DATA PUMP Utility

Starting with Oracle 10g,  Oracle has introduced an enhanced version of EXPORT and IMPORT utility known as DATA PUMP. Data Pump is similar to EXPORT and IMPORT utility but it has many advantages. Some of the advantages are:

 Using Data Pump Export Utility

To Use Data Pump,  DBA has to create a directory in Server Machine and create a Directory Object in the database mapping to the directory created in the file system.

The following example creates a directory in the filesystem and creates a directory object in the database and grants privileges on the Directory Object to the SCOTT user.

$mkdir my_dump_dir
Enter User:/ as sysdba
SQL>create directory data_pump_dir as ‘/u01/oracle/my_dump_dir’;

Now grant access on this directory object to SCOTT user

SQL> grant read,write on directory data_pump_dir to scott;

Example of Exporting a Full Database

To Export Full Database, give the following command

$expdp  scott/tiger FULL=y DIRECTORY=data_pump_dir DUMPFILE=full.dmp
             LOGFILE=myfullexp.log JOB_NAME=myfullJob

The above command will export the full database and it will create the dump file full.dmp in the directory on the server /u01/oracle/my_dump_dir

In some cases where the Database is in Terabytes the above command will not feasible since the dump file size will be larger than the operating system limit, and hence export will fail. In this situation you can create multiple dump files by typing the following command

$expdp  scott/tiger FULL=y DIRECTORY=data_pump_dir DUMPFILE=full%U.dmp
       FILESIZE=5G  LOGFILE=myfullexp.log JOB_NAME=myfullJob

This will create multiple dump files named full01.dmp, full02.dmp, full03.dmp and so on. The FILESIZE parameter specifies how much larger the dump file should be.

Example of Exporting a Schema

To export all the objects of SCOTT’S schema you can run the following export data pump command.

$ expdp scott/tiger DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp

You can omit SCHEMAS since the default mode of Data Pump export is SCHEMAS only.

If you want to export objects of multiple schemas you can specify the following command

$ expdp scott/tiger DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp

Exporting Individual Tables using Data Pump Export

You can use Data Pump Export utility to export individual tables. The following example shows the syntax to export tables

$ expdp hr/hr DIRECTORY=dpump_dir1 DUMPFILE=tables.dmp

Exporting Tables located in a Tablespace

If you want to export tables located in a particular tablespace you can type the following command

$expdp hr/hr DIRECTORY=dpump_dir1 DUMPFILE=tbs.dmp  TABLESPACES=tbs_4, tbs_5, tbs_6

The above will export all the objects located in tbs_4,tbs_5,tbs_6

Excluding and Including Objects during Export

You can exclude objects while performing a export by using EXCLUDE option of Data Pump utility. For example you are exporting a schema and don’t want to export tables whose name  starts with “A” then you can type the following command

$ expdp scott/tiger DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp

Then all tables in Scott’s Schema whose name starts with “A “ will not be exported.

Similarly you can also INCLUDE option to only export certain objects like this

$ expdp scott/tiger DIRECTORY=data_pump_dir DUMPFILE=scott_schema.dmp

This is opposite of EXCLUDE option i.e. it will export only those tables of Scott’s schema whose name starts with “A”

Similarly you can also exclude INDEXES, CONSTRAINTS, GRANTS, USER, SCHEMA

Using Query to Filter Rows during Export

You can use QUERY option to export only required rows. For Example, the following will export only those rows of employees tables whose salary is above 10000 and whose dept id is 10.

$ expdp hr/hr QUERY=emp:'"WHERE dept_id > 10 AND sal > 10000"'
     NOLOGFILE=y DIRECTORY=dpump_dir1 DUMPFILE=exp1.dmp

Suspending and Resuming Export Jobs (Attaching and Re-Attaching to the Jobs)

You can suspend running export jobs and later on resume these jobs or kill these jobs using Data Pump Export. You can start a job in one client machine and then, if because of some work, you can suspend it. Afterwards when your work has been finished you can continue the job from the same client, where you stopped the job, or you can restart the job from another client machine.

For Example, suppose a DBA starts a full database export by typing the following command at one client machine CLNT1 by typing the following command

$ expdp scott/tiger@mydb FULL=y DIRECTORY=data_pump_dir  
     DUMPFILE=full.dmp LOGFILE=myfullexp.log JOB_NAME=myfullJob

After some time, the DBA wants to stop this job temporarily. Then he presses CTRL+C to enter into interactive mode. Then he will get the Export> prompt where he can type interactive commands

Now he wants to stop this export job so he will type the following command

Are you sure you wish to stop this job ([y]/n): y

The job is placed in a stopped state and exits the client.

After finishing his other work, the DBA wants to resume the export job and the client machine from where he actually started the job is locked because, the user has locked his/her cabin. So now the DBA will go to another client machine and he reattach to the job by typing the following command

$expdp hr/hr@mydb ATTACH=myfulljob

After the job status is displayed, he can issue the CONTINUE_CLIENT command to resume logging mode and restart the myfulljob job.


A message is displayed that the job has been reopened, and processing status is output to the client.

Note: After reattaching to the Job a DBA can also kill the job by typing KILL_JOB, if he doesn’t want to continue with the export job.




HomeContact Us

Data Loader

Data Loader is a simple yet powerful tool to
export and import Data between many common database formats

Forms Data Loader

Tool to load data into Oracle E-Business Suite R12 / Oracle Apps using Macros and Forms Record and Playback

Interface Computers Academy © 2007-2017 All Rights Reserved