Posts tagged: Oracle DBA Interview Questions

Jul 01 2010

Explain the relationship among database, tablespace, and datafile.

The database is logically divided into one or more tablespaces.
For each tablespace we explicitly create one or more datafiles.

Jun 28 2010

How to recover if we delete a data file at OS level no backup for that?

bring the database to the mount state
sql>alter database create datafile ;
sql>recover datafile ;
sql>alter database open;

Jun 22 2010

How do you see how many instances are running?

In Linux, Unix the command: ps -ef|grep pmon
In Windows: services.msc

Jun 21 2010

Which is more efficient Incremental Backups using RMAN or Incremental Export?

RMAN

Jun 18 2010

You lost some datafiles and you don’t have any full backup and the database was running in NOARCHIVELOG mode. What you can do now?

You have lost datafiles and you dont have backup and database is not running in archive log mode……
So we need to recreate the datafiles which will be empty….. you can not recover, becuase you dont have backup and database not in archive log mode

Jun 16 2010

The current logfile gets damaged. What you can do now?

Once current redolog file is damaged, instance is aborted and it needs recovery upto undamaged part. Only undamaged part can be recovered. Here DBA must apply time based recovery, means it can be a point in time or specified by SCN.

It leads to incomplete recovery

Dec 25 2009

Difference between Dictionary managed tablespace (DMT) and Locally managed tablespace (LMT)

Locally Managed Tablespaces:
A tablespace that manages its own extents maintains a bitmap in each datafile to keep track of the free or used status of blocks in that datafile. Each bit in the bitmap corresponds to a group of blocks. When an extent is allocated or freed for reuse, Oracle changes the bitmap values to show the new status of the blocks. These changes do not generate rollback information because they do not update tables (like sys.uet$, sys.fet$) in the data dictionary (except for special cases such as tablespace quota information).
When you create a locally managed tablespace, header bitmaps are created for each datafile. If more datafiles are added, new header bitmaps are created for each added file.
Local management of extents automatically tracks adjacent free space, eliminating the need to coalesce free extents. The sizes of extents that are managed locally can be determined automatically by the system. Alternatively, all extents can have the same size in a locally managed tablespace.

Dictionary Managed Tablespaces:
In DMT, to keep track of the free or used status of blocks, oracle uses data dictionry tables. When an extent is allocated or freed for reuse, free space is recorded in the SYS.FET$ table, and used space in the SYS.UET$ table. Whenever space is required in one of these tablespaces, the ST (space transaction) enqueue latch must be obtained to do inserts and deletes agianst these tables. As only one process can acquire the ST enque at a given time, this often lead to contention. These changes generate rollback information because they update tables (like sys.uet$, sys.fet$) in the data dictionary.

Advantages of Locally Managed Tablespaces(LMT) over Dictionary Managed Tablespaces(DMT):

1. Reduced recursive space management
2. Reduced contention on data dictionary tables
3. No rollback generated
4. No coalescing required

Converting DMT to LMT:

SQL> exec dbms_space_admin.Tablespace_Migrate_TO_Local(‘ts1′);
PL/SQL procedure successfully completed.

Converting LMT to DMT:

SQL> exec dbms_space_admin.Tablespace_Migrate_FROM_Local(‘ts2′);
PL/SQL procedure successfully completed.

Important Points:
1. LMTs can be created as
a) AUTOALLOCATE: specifies that the tablespace is system managed. Users cannot specify an extent size.
b) UNIFORM: specifies that the tablespace is managed with uniform extents of SIZE bytes. The default SIZE is 1 megabyte.
2. One cannot create a locally managed SYSTEM tablespace in 8i.
3. This is possible with in 9.2.0.X, where SYSTEM tablespace is created by DBCA as locally managed by default. With a locally managed SYSTEM tablespace, the rest of the tablespaces in such database have to be locally managed as well.
4. Locally managed temporary tablespaces can not be of type “permanent”.

Alibi3col theme by Themocracy