Oracle DBA Tutorial02

Embed Size (px)

DESCRIPTION

o

Citation preview

Oracle DBA Tutorial02 Managing Database Processes

Two typesof server processes are used to serve user1. Dedicated server process = defaultWhen a client request is received, anew server process and a session are created for the client.

2. shared server process = need to change initialization parameter to enable it.

When the first request is received from a client, the Dispatcher process places this request on a common queue. The request is picked up by an available shared server process. The Dispatcher process then manages the communication between the client and the shared server process.

shared server can be configured for A. Connection Pooling= Dispatcher usestime-out protocol connectionsto service more active connection rather than inactive connections.

B.session multiplexing= combines multiple sessions for transmission over a single network connection in order to conserve the operating system's resources.

Database Resident Connection Pooling [DRCP]

DRCP complements middle-tier connection pools that share connections betweenthreads in a middle-tier process.When the first request is received from a client, the Connection Broker picks an available pooled server and hands off the client connection to the pooled server. If no pooled servers are available, the Connection Broker creates one. If the pool has reached its maximum size, the client request is placed on the wait queue until a pooled server is available.

Example of Memory Usage for Dedicated Server, Shared Server, and Database Resident Connection Pooling Consider an application in which the memory required for each session is 400 KB and the memory required for each server process is 4 MB. The pool size is 100 and the number of shared servers used is 100.

If there are 5000 client connections, the memory used by each configuration is asfollows ->Dedicated Server Memory used = 5000 X (400 KB + 4 MB) = 22 GB

Shared Server Memory used = 5000 X 400 KB + 100 X 4 MB = 2.5 GB Out of the 2.5 GB, 2 GB is allocated from the SGA.

DRCP Memory used = 100 X (400 KB + 4 MB) + (5000 X 35KB)= 615 MB

Configuring Shared Server

Initialization parameter

SHARED_SERVERS:Specifies the initial number of shared servers to start and the minimum number of shared servers to keep. This is the only required parameter for using shared servers.

MAX_SHARED_SERVERS:Specifies the maximum number of shared servers that can run simultaneously.

SHARED_SERVER_SESSIONS:Specifies the total number of shared server user sessions that can run simultaneously. Setting this parameter enables you to reserve user sessions for dedicated servers.

Shared server is enabled by setting theSHARED_SERVERSinitialization parameter to avalue greater than 0. Shared server can be started dynamically by setting the SHARED_SERVERS parameter to a nonzero value with the ALTER SYSTEM statement, or SHARED_SERVERS can be included at database startup in the initialization parameter file.

Assume a database is being used by a telemarketing center staffed by 1000 agents. Onaverage, each agent spends 90% of the time talking to customers and only 10% of the time looking up and updating records. To keep the shared servers from being terminated as agents talk to customers and then spawned again as agents access the database, a DBA specifies that the optimal number of shared servers is 100. However, not all work shifts are staffed at the same level. On the night shift, only 200 agents are needed. Since SHARED_SERVERS is a dynamic parameter, a DBA reduces the number of shared servers to 20 at night, thus allowing resources to be freed up forother tasks such as batch jobs.

Decreasing the Number of Shared Server Processes

ALTER SYSTEM SET SHARED_SERVERS = 2

Dispatcher Configuration

Monitor the following views to determine the load on the dispatcher processes:V$QUEUEV$DISPATCHERV$DISPATCHER_RATE

To increase the number of dispatchers for the TCP/IP protocol from 2 to 3, anddecrease the number of dispatchers for the TCP/IP with SSL protocol from 2 to 1, you can issue the following statement

ALTER SYSTEM SET DISPATCHERS = '(PROT=tcp)(DISP=3)', '(PROT-tcps)(DISP=1)';

Configuring DRCP

Oracle Database includes a default connection pool calledSYS_DEFAULT_CONNECTION_POOL. By default, this pool is created, but not started. For starting it issue the following command SQL> EXECUTE DBMS_CONNECTION_POOL.START_POOL();Once started, the connection pool remains in this state until it is explicitly stopped.To access the DRCP from client machine we need to use following command oraclehost.company.com:1521/books.company.com:POOLED

or(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=hostname)(PORT=1575))(CONNECT_DATA=(SERVICE_NAME=orcl)(SERVER=POOLED)))

Disable connection pooling SQL> EXECUTE DBMS_CONNECTION_POOL.STOP_POOL();

Configuration Parameters for DRCP

MINSIZEMAXSIZEINCRSIZESESSION_CACHED_CURSORSINACTIVITY_TIMEOUTMAX_THINK_TIMEMAX_USE_SESSIONMAX_LIFETIME_SESSIONNUM_CBROKMAXCONN_CBROK

Example of changing connection pool parameters SQL> EXECUTE DBMS_CONNECTION_POOL.ALTER_PARAM ('','MINSIZE','5');

Change connection pool to default value by SQL> EXECUTE DBMS_CONNECTION_POOL.RESTORE_DEFAULTS();

Oracle Database Background Processes

Database writer (DBWn)= This process writes data blocks from database buffer cache to data files. There are max 20 processLog writer (LGWR)= It writes redo log buffer to disk.Checkpoint (CKPT)=The checkpoint process is responsible for signalling DBWnat checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint.System monitor (SMON)= The system monitor performs recovery when a failed instance starts up again.Process monitor (PMON)= The process monitor performs process recovery when a user process fails.Archiver (ARCn) One or more archiver processes copy the redo log files to archival storage when theyare full or a log switch occurs.Recoverer (RECO) =The recoverer process is used to resolve distributed transactions that are pendingbecause of a network or system failure in a distributed database.Dispatcher (Dnnn)= Dispatchers are optional background processes, present only when the shared server configuration is used.Global Cache Service(LMS) =In an Oracle Real Application Clusters environment, this process manages resources and provides inter-instance resource control.

Altering Parallel Execution for a Session

Some useful commands ALTER SESSION DISABLE PARALLEL DDL;ALTER SESSION ENABLE PARALLEL DML;ALTER SESSION FORCE PARALLEL DDL PARALLEL 10;

Terminating Sessions

ALTER SYSTEM KILL SESSION '8,16';

Identify which system to terminate using following command

SELECT SID, SERIAL#, STATUSFROM V$SESSION WHERE USERNAME = 'RAM';

SID SERIAL# STATUS----- --------- --------8 5 ACTIVE10 60 INACTIVE

To kill a inactive session issue the following command

SELECT SID,SERIAL#,STATUS,SERVERFROM V$SESSION WHERE USERNAME = 'RAM';

SID SERIAL# STATUS SERVER----- -------- --------- ---------8 16INACTIVE DEDICATED12 63 INACTIVE DEDICATED2 rows selected.ALTER SYSTEM KILL SESSION'8,16';Statement processed.

Some important information on processes are stored in the following views

V$PROCESS= Contains information about the currently active processesV$SESSION= Lists session information for each current sessionV$SESS_IO= Contains I/O statistics for each user sessionV$SESSION_LONGOPS= Displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions, statistics gathering, and query execution. More operations are added for every Oracle Database release.V$SESSION_WAIT= Displays the current or last wait for each sessionV$SESSION_WAIT_HISTORY= Lists the last ten wait events for each active sessionV$WAIT_CHAINS= Displays information about blocked sessionsV$SYSSTAT= Contains session statisticsV$RESOURCE_LIMIT =Provides information about current and maximum global resource utilization for some system resourcesV$SQLAREA= Contains statistics about shared SQL areas. Contains one row for each SQL string. Provides statistics about SQL statements

Oracle Space Management Tutorial

Your Oracle Database has three basic blocks.

1. Blocks2. Extents3. Segments

Blocks

Block is the lowest storage unit of database. Block must equal or multiple of the os block size to mazimize the I/O performance. Define the lowest block size during database creation using following init parameter DB_BLOCK_SIZE.

A newly created block contain free space for new rows or index [only one type of data is allowed in block]. When block data exceed PCTFREE of a block new row or updated row will be assigned to a new block with a pointer pointing the new block from old block.

PCTFREE parameter defines the free space inside a block which is kept for future update of row value.

Starting with Oracle9i Release 2, you can use Automatic Segment Space Management (ASSM) to manage free space within blocks; you enable ASSM in locally managed tablespaces by using the segment space management auto keywords in the create tablespace command (although this is the default for locally managed tablespaces).

Extents

Extents holds the object and consists of several blocks. When a table is created, an initial extent is allocated. Once the space is used in the initial extent, incremental extents are allocated. In a locally managed tablespace, these subsequent extents can either be the same size (using the UNIFORM keyword when the tablespace is created) or optimally sized by Oracle (AUTOALLOCATE). For extents that are optimally sized, Oracle starts with aminimum extent size of 64KB and increases the size of subsequent extents as multiples of the initial extent as the segment grows.

For checking extents information use the following sql command sets.

SQL> create table xxxx (a char(2000))2 storage (initial 1m next 2m pctincrease 50)3 tablespace users;

SQL> begin2 for i in 1..3000 loop3 insert into xxxx ('a');4 end loop;5 end;6 /

SQL> select segment_name, extent_id, bytes, blocks from user_extents where segment_name = 'XXXX';

Unless a table is truncated or the table is dropped, any blocks allocated to an extent remain allocated for the table, even if all rows have been deleted from the table. The maximum number of blocks ever allocated for a table is known as thehigh-water mark (HWM).

Segments

Groups of extents are allocated for a single segment. A segment must be wholly contained within one and only one tablespace. Every segment represents one and only one type of database object, such as a table, a partition of a partitioned table, an index, or a temporary segment. For partitioned tables, every partition resides in its own segment; however, a cluster (with two or more tables) resides within a single segment. Similarly, a partitioned index consists of one segment for each index partition.

Database space usage views

The following objects gives the details of database space usage.

1. DBA_TABLESPACES2. DBA_SEGMENTS3. DBA_EXTENTS4. DBA_FREE_SPACE5. DBA_LMT_FREE_SPACE6. DBA_THRESHOLDS7. DBA_OUTSTANDING_ALERTS8. DBA_ALERT_HISTORY9. V$ALERT_TYPESselect reason_id, object_type, scope, internal_metric_category,internal_metric_name from v$alert_typeswhere group_name = 'Space';

Sample select queries.

select tablespace_name, block_size, contents, extent_management from dba_tablespaces; select tablespace_name, count(*) NUM_OBJECTS,sum(bytes), sum(blocks), sum(extents) from dba_segments group by rollup (tablespace_name); select owner, segment_name, tablespace_name,extent_id, file_id, block_id, bytes from dba_extents where segment_name = 'XXX$'; select tablespace_name, sum(bytes) from dba_free_space group by tablespace_name;

OMF

OMF has been introduced in oracle database by which without mentioning the exact file location we can create the datafiles, redo log or backup files in specified destination. The specific destinations are mentioned in the following init parameter.

DB_CREATE_FILE_DEST= The default operating system file directory where datafiles and tempfiles are created if no pathname is specified in the create tablespace command.This location is used for redo log files and control files if DB_CREATE_ONLINE_LOG_DEST_n is not specified.

DB_CREATE_ONLINE_LOG_DEST_n= Specifies the default location to store redo log files and control files when no pathname is specified for redo log files or control files at database-creation time. Up to five destinations can be specified with this parameter, allowing up to five multiplexed control files and five members of each redo log group.

DB_RECOVERY_FILE_DEST= Defines the default pathname in the servers file system where RMAN backups, archived redo logs, and flashback logs are located. Also used for redolog files and control files if neither DB_CREATE_FILE_DEST nor DB_CREATE_ONLINE_LOG_DEST_n is specified.

How to know about the Segments That Cannot Allocate Additional Extents?

select s.tablespace_name, s.segment_name,s.segment_type, s.ownerfrom dba_segments swhere s.next_extent >=(select max(f.bytes)from dba_free_space fwhere f.tablespace_name = s.tablespace_name)or s.extents = s.max_extentsorder by tablespace_name, segmen

How to know the datafile and tablespace space usage and free space?

http://www.oracle-latest-technology.com/2011/12/oracle-dba-health-checkup-and.html

Check the DIAGNOSTIC_DEST parameter for logfile, trace file and alert file location.

How to set Space Usage Warning Levels in Oracle database ?

SQL> select metrics_name, warning_operator warn, warning_value wval,critical_operator crit, critical_value cval,consecutive_occurrences consecfrom dba_thresholds;

---- PL/SQL anonymous procedure to update the Tablespace Space Usage threshold--declare/* OUT */warning_operator number;warning_value varchar2(100);critical_operator number;critical_value varchar2(100);observation_period number;consecutive_occurrences number;/* IN */metrics_id number;instance_name varchar2(50);object_type number;object_name varchar2(50);new_warning_value varchar2(100) := '60';beginmetrics_id := DBMS_SERVER_ALERT.TABLESPACE_PCT_FULL;object_type := DBMS_SERVER_ALERT.OBJECT_TYPE_TABLESPACE;instance_name := 'xx';object_name := NULL;

-- retrieve the current values with get_thresholddbms_server_alert.get_threshold(metrics_id, warning_operator, warning_value,critical_operator, critical_value,observation_period, consecutive_occurrences,instance_name, object_type, object_name);

-- update the warning threshold value from 85 to 60dbms_server_alert.set_threshold(metrics_id, warning_operator, new_warning_value,critical_operator, critical_value,observation_period, consecutive_occurrences,instance_name, object_type, object_name);end;

Now check the status from dba_thresholds again.

How to check and monitor space usage by index

SQL> alter index hr.emp_ix monitoring usage;Index altered.

SQL> select * from v$object_usage;INDEX_NAME TABLE_NAME MON USED START_MONITORING--------------- --------------- --- ---- -------------------EMP_IX EMPLOYEES YES NO 12/23/2012 10:00:00

SQL> alter index hr.emp_ix nomonitoring usage;

SQL> select * from v$object_usage;INDEX_NAME TABLE_NAME MON USED START_MONITORING END_MONITORING---------- --------------- --- ---- ------------------- ---------------EMP_IX EMPLOYEES NO YES 12/23/2012 10:04:55 12/24/2012 11:00:00

Sure enough, the index appears to be used at least once during a typical day.

SQL> analyze index hr.emp_ix validate structure;

SQL> select pct_used from index_stats where name = 'EM_IX';PCT_USED----------76

SQL> analyze index hr.emp_ix validate structure;

SQL> select pct_used from index_stats where name = 'EMP_IX';PCT_USED----------26SQL> alter index hr.emp_job_ix rebuild online;Index altered.

SEGMENT Space Management

Frequent inserts, updates, and deletes on a table may, over time, leave the space within a table fragmented. Oracle can perform segment shrink on a table or index.

SQL> alter table hr.emp add (work_record varchar2(4000));SQL> alter table hr.emp enable row movement;

We have enabled ROW MOVEMENT in the table so that shrink operations can be performed on the table if recommended by Segment Advisor.

variable task_id number-- PL/SQL block followsdeclarename varchar2(100);descr varchar2(500);obj_id number;beginname := ''; -- unique name generated from create_taskdescr := 'Check HR.EMPLOYEE table';dbms_advisor.create_task('Segment Advisor', :task_id, name, descr, NULL);dbms_advisor.create_object(name, 'TABLE', 'HR', 'EMP', NULL, NULL, obj_id);dbms_advisor.set_task_parameter(name, 'RECOMMEND_ALL', 'TRUE');dbms_advisor.execute_task(name);end;/SQL> print task_idTASK_ID----------380SQL>

Now that we have a task number from invoking Segment Advisor, we can query DBA_ADVISOR_FINDINGS to see what we can do to improve the space utilization of the HR.EMP table.

SQL> select owner, task_id, task_name, type, message, more_info from dba_advisor_findings where task_id = 380;

WORK_RECORD columns may create blocks in the table with free space that can be reclaimed. The view DBA_ADVISOR_RECOMMENDATIONS provides similar information.

SQL> select owner, task_id, task_name, benefit_type from dba_advisor_recommendationswhere task_id = 380;OWNER TASK_ID TASK_NAME---------- ------- ----------RJB 380 TASK_00003BENEFIT_TYPE--------------------------------------------------Perform shrink, estimated savings is 107602 bytes.

In any case, we will shrink the segment HR.EMP to reclaim the free space. As an added time-saving benefit to the DBA, the SQL needed to perform the shrink is provided in the view DBA_ADVISOR_ACTIONS.

SQL> select owner, task_id, task_name, command, attr1 from dba_advisor_actions where task_id = 384;OWNER TASK_ID TASK_NAME COMMAND---------- ------- ---------- -----------------RJB 6 TASK_00003 SHRINK SPACEATTR1-----------------------------------------------------alter table HR.EMPLOYEES shrink space1 row selected.SQL> alter table HR.EMPLOYEES shrink space;Table altered.

As mentioned earlier, the shrink operation does not require extra disk space and does not prevent access to the table during the operation, except for a very short period of time at the end of the process to free the unused space.Oracle RMAN Tutorial Part 1 Creating and configuring RMAN repositoryHere are the basic description on RMAN configuration and setup. By reading this article you can configure a RMAN by yourself in a very practical manner. I have only concentrated on RMAN practical implementation perspective here.

First lets check how to setup a RMAN repository. Ideally this repository should be a other database than target[the db which would be backed up] database.

Repository Catalog Creation and Configuration

create tablespace$ sqlplus / as sysdba

SQL> create tablespace rman datafile '/u01/.....dbf' size 125m autoextend on next 50m maxsize 500m;SQL> grant recovery_catalog_owner to rmanUser identified by rmanUser;SQL> alter user rmanUser default tablespace rman quota unlimited on rman;

Create catalog$ rman catalog rmanUser/rmanUser@

RMAN> create catalog;

Register a Target Database

$ rman target / catalog rmanUser@

RMAN> register database;

Now, show all default RMAN settings.

RMAN> show all;

Now, check how to change some of the default configuration. Lets change the retention policy first.

RMAN> configure retention policy to recovery window of 2 days;RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/s1/ors/backup01/rmanbackup/control_backup/controlfile_Weekly%F.trc';RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/s1/ors/backup01/rmanbackup/control_backup/snap_control_file_Weekly_PORS.f';RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1;RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/sky1/UORSrmanbkp/FULL/backup_Weekly_%D_%s_%p_%t.rman' MAXPIECESIZE 2048M;

configure the backup as compressed backup.

RMAN> configure device type disk backup type to compressed backupset;

Some common initialization parameter ->

DB_RECOVERY_FILE_DEST = location of RMAN disk backup by default. Also the flash back up recovery location.DB_RECOVERY_FILE_DEST_SIZE = upper limit flash back up recovery size.Oracle RMAN Tutorial Part 2 BACKUP OPERATION

Full database backup using RMAN

RMAN> backup as backupset database spfile;RMAN> sql 'alter system archive log current';

Now, check the backup using following command.RMAN> list backup by backup;

tablespace backupRMAN> backup as backupset tablespace ;

datafile backupRMAN> backup as backupset datafile 'dbf file location>;

Full Image copy of databaseRMAN> backup as copy database;

control file and spfile backupRMAN> backup current controlfile spfile;

Incremental backup

Full incremental backup is mentioned as "level 0". Use the following command for full backup.RMAN> backup incremental level 0 as compressed backupset database;

next incremental backupup are called "level 1". This backups can be differential or cumulative.RMAN> backup incremental level 1 as compressed backupset database;RMAN> backup incremental level 1 as compressed backupset cumulative database;

Validate backup taken by RMANRMAN> backup validate database archivelog all;Oracle RMAN Tutorial Part 3 Recovery Operation

Block Mediar Recovery

check the corrupted block using following sql command.SQL> select * from v$ database_block_corruption;

Now recover block.RMAN> recover datafile 4 block 204;

Control file recoveryRMAN> restore controlfile;

Restore the tablespace

First check the missing tablespace by following sql.

SQL> select * from v$datafile_header;

RMAN> report schema;

RMAN> sql 'alter tablespace offline immediate';RMAN> restore tablespace ;RMAN> recover ;RMAN> sql 'alter tablespace online';

Restoring a datafile.RMAN> Restore datafile 4;RMAN> recover datafile 4;

Restoring a Entire Database

RMAN> startup mount;RMAN> restore database;RMAN> recover database;RMAN> alter database open;

Other RMAN useful commands that you need to know.

RMAN> list failure;RMAN> list failure 1020 detail;RMAN> advice failure;

RMAN> list backup summary;RMAN> report schema at time '20-dec-11';RMAN> report schema;

=================================================Now check a practical RMAN shell scripts written for backing up a big Analytics production database.

----------------------RMAN full backup scripts which is scheduled to run once in weekend.

. /sky/oracle/.profile

dt=`date +"%d.%m.%Y"`

rman $HOME/CRON_LOGS/RMANFULLlogs/RmanFULLbkp.err00 23 * * 6 rm /sky-backup/INC/* 1>$HOME/CRON_LOGS/RMANINClogs/old_INC_delete.log30 23 * * 6 rm /sky-backup/FULL/* 1>$HOME/CRON_LOGS/RMANINClogs/old_FULL_delete.log--------------------------

You can also delete old archive log files as it's been backed up in RMAN.moving archivelog file to other location ->find . -type f -name '*.arc' -mtime +2 -exec gzip {} \; & to gzip

=================================================Apps DBA Tutorial 01 - Concurrent ManagerConcurrent Processing= This is a batch processing job which runs in background while user works on front end transaction.Concurrent Request= When user asks to run a program that request is called Concurrent request.Concurrent Manager= Concurrent Manager is the program which runs the concurrent requests.

There are three types of concurrent managers.1. Internal Concurrent Manager [ICM]ICM ensures that all the concurrent manager is running. It starts and stops all concurrent managers. It also controlsservice managersin each node.Internal Monitormonitors the ICM and restarts ICM if ICM fails.2. Conflict Resolution Manager [CRM]It checks concurrent program incompatibility.3. Standard ManagaerIt takes care of processing any concurrent request. This manager runs always in 24x7 mode.

How to start Concurrent Manager in R12

There are two ways to start concurrents manager.1.$INST_TOP/admin/scripts/adcmctl.shstart apps/2. strtmgr.sh utilityA sample command is as follows.$FND_TOP/bin/strtmgr sysmgr=apps/apps logfile=/tmp/log

some important parameters of strtmgr is as follows.a. Mgrname= The name of manager. Default is "Internal Manager".b. Sleep= The number of seconds ICM waits before checking new request from table FND_CONCURRENT_REQUEST.c. Diag=Deault is N. Diag=Y means full diagionistic output will be written in log file.d. Pmon= The number of sleep cycle ICM will wait before checking failed manager.e. Quesiz

Location of Concurrent Manager Log file

The deault name of the log file isstd.mgr.For 11i a. $APPLCSF/$APPLLOG if $APPLCSF env variable is setb. $FND_TOP/$APPLLOG if $APPLCSF env variable is not set

For R12$INST_TOP/logs/appl/conc/log

How to check the status of the concurrent manager

There are 3 ways to find the status.

1. Operating system levelIf process FNDLIBR is running that means that concurrent manager is up and running.$ ps -ef | grep FNDLIBR | grep appmgr01

2. From FormsGo to System Administrator > Cocurrent > Manager > Administrator.If concurrent manager is running then the value of Actual and Target should be greater than or equal to 1.

3. Sql scriptRun the following sql script to check the concurrent manager status.$ cd $FND_TOP/sql$ sqlplus -s apps/apps @afimchk.sql

How to Stop Concurrent Manager

1. $ADMIN_SCRIPTS_HOME/adcmctl.shstop apps/

2. By killing FNDLIBR process issueing -9.

3. Individual concurrent manager can be stopped by navigating to Concurrent > Manager > Administrator.

4. UsingCONCSUB Utility$ CONCSUB username/pw SYSADMIN 'System Administrator' SYSADMIN WAIT=Y CONCURRENT FND ABORTs

What is CONCSUB Utility

CONCSUB Utility allows user to submit concurrent request from operating system level.An example of that request is as follows.

CONCSUB [WAIT=] CONCURRENT [START=] [REPEAT_DAYS=] [REPEAT_END=]

Wait parameter = whether CONCSUB waits till request completes. W=Y means it return to Unix promt immediately.

Flow of a Concurrent Request

Once Concurrent Request is submitted the following things happen ->

A. FND_CONCURRENT_REQUESTS table is updated with the request with scheduled time.B. Once request is scheduled the concurrent manager checks the table FND_CONCURRENT_TABLES to find out if there is any incompatibility in program.C. If there is any incompatibility CRM [Conflict Resolution Manager] takes care.D. For no incompatibility it first checks whether there is any special manager who can take care the request else standard manager takes care.E. Once completed FND_CONCURRENT_REQUEST table is updated with status.

Some Important phases of concurrent manager

A. Standby = Request is put in standby mode while CRM is resolving the incompatibility.B. No Manager = CM is down or no manager was defined.C. Disabled = Concurrent Program is disabled.

How to add or define a new Concurrent Manager

Go to System Administrator > Concurrent > Manager > Define.

The important parameters of the above screen is as follows.a. Manager= Name of the concurrent managerb. Type= What type of concurrent manager we are going to define. The options are Concurrent manager, Transactional Manager, internal Monitor etc..c. Cache Size= If cache size is 5, CM reads 5 requests at a time from quesue and waits until those are completed before reading new records.d. Consumer Group= AResource Consumer Groupis a group of users who has similar resource usage requirements. Like we can create LOW_GROUP, HIGH_RESOURCE_GROUP consumer group and assign it here.

Parallel Concurrent Processing Details

1. NodeThis is only applicable if parallel conc processing is enabled. The node must be registered with EBS and it must be there in FND_NODES table.2. System QueueThis is used only if we want to use OS queue instead of default conc manager queue.

Program LibraryCM only runs those programs which is listed in program libraries.

Specialization RulesIf we want to run certain types of request only and include and exclude some Cons Request the this screen is used.

Work ShiftsIt defines the time for which the concurrent manager will be active. To define workshifts go to Concurrent > Manager > Work Shifts.

Concurrent Manager AdministrationGo to System Administrator > Cocurrent > Manager > Administrator.

Some important description and functionality of this screen.

Process ActualThe number of actual process running on that CM.Process TargetThe maximum number of process that can be active. Process Target >= Process Actual.RunningThe number of request currently running.

Controlling Parameter->TerminateImmediately abort all running request and particular manager terminates. If we terminate IM then all the cns manager stops.DeactivateHere before stopping the manager all the requests get completed. This is the difference between shut down and terminate.RestartVerifyThis is available only for IM. The process monitoring of othere concurrent manager by IM is known asPMON Cycle.Verify forces to PMON cycle to occur immediately.

Parallel Concurrent Processing

Parallel concurrent helps to distribute load across various nodes to utilize full hardware resources. The following are some of the architecture of parrallel concurrent processing.

1. Cluster EnvIn a cluster environment, multiple computer/CPU, each representing a single node, share a common pool of disks. Oracle Database resides in that common disk whereas multiple instances of RAC run simultaneously on multiple nodes of cluster. CM is also divided in multiple nodes.

2. Massively Parallel envHere, multiple nodes are housed in a single computer and all nodes share a common pool of disk. Separate RAC instances run simultaneously on multiple node.

3. Networked EnvMultiple computers of same type are connected via LAN to a single DB or a RAC DB.

How Parallel Concurrent Processing happens

Each conc manager is assigned a primary and secondary node. The CM starts in primary node by default. It changes to the secondary node once there are some faults in primary node. ICM can run on any of the node. It can activate and deactivate any CM. Due to heavy fault tolerance of ICM it is monitored by Internal Monitor [IM]. IM starts ICM if it will fail in any time.

Generic Service Management [GSM]

GSM is a new concept and powerful framework to manage services in different host machines. Some services such as oracle forms listener, reports server, apache web listener, workflow mailer can be integrated in this framework. With GSM, the ICM will manage these services in each hosts. And each hosts has aservice managerwhich acts on behalf of ICM in that hosts. This service manager monitor and controls the services in that host and send the end result to ICM.

Important Diagonistic Scripts for Concurrent Manager

For details see metalink note 213021.1.

All scripts are inside $FND_TOP/sql.1.afimchk.sql= Tell status of ICM and PMON.2.afcmstat.sql= lists active manager processes.3.afrqscm.sql= prints log file names of the managers.4.afimlock.sql= lists the locks that ICM is waiting to get.

Question and answer'swhat is sga?TheSGA(System Global Area) is an area of memory (RAM) allocated when an Oracle Instance starts up. The SGA's size and function are controlled by initialization (INIT.ORA or SPFILE) parameters.

SQL> SHOW SGATotal System Global Area 638670568 bytesFixed Size 456424 bytesVariable Size 503316480 bytesDatabase Buffers 134217728 bytesRedo Buffers 679936 bytesSQL> SELECT * FROM v$sga;NAME VALUE-------------------- ----------Fixed Size 456424Variable Size 503316480Database Buffers 134217728Redo Buffers 679936

SQL> select * from v$sgainfo;NAME BYTES RESIZEABLE -------------------------------- ---------------------- ---------- Fixed SGA Size 2109352 No Redo Buffers 13533184 No Buffer Cache Size 3103784960 Yes Shared Pool Size 822083584 Yes Large Pool Size 67108864 Yes Java Pool Size 134217728 Yes Streams Pool Size 134217728 Yes Shared IO Pool Size 0 Yes Granule Size 16777216 No Maximum SGA Size 4277059584 No Startup overhead in Shared Pool 251658240 No Free SGA Memory Available 0

what is difference between 9i and 10g

New featureCompletely reworked 10g Enterprise Manager (OEM)AWR and ASH tables incorporated into OEM Performance Pack and Diagnostic Pack options

Automated Session History (ASH) materializes the Oracle Wait Interface over time

Data Pump replaces imp utility with impdpAutomatic Database Diagnostic Monitor (ADDM)

Automatic Storage Management (ASM) introduced Stripe And Mirror Everywhere (SAME) standard

Automatic Workload Repository (AWR) replaces STATSPACK

SQLTuning Advisor

SQLAccess Advisor

Rolling database upgrades (using Oracle10g RAC)Ability to UNDROP a table from a recycle binAbility to rename tablespacesAbility to transport tablespaces across machine types (E.g Windows to Unix)Support for bigfile tablespaces that is up to 8 Exabytes in sizeRMAN introduces compression for backups

Flashback enhancements for flashback database and flashback table syntaxNew commands

Set Database Default Tablespace syntax

Rename Tablespace commandNew drop database syntax

New alter database begin backup syntaxTablespacesSYSAUX tablespaceysaux, system, Transportable tablespaces, Bigfile tablespacesSmallfile tablespacesDefault tablespaces (temp), Displaying tablespaces (dba_tablespaces)

Multiple Temporary Tablespaces supported to reduce stress on sorting in TEMPMoreover, 10g has additional 149 features than 9i

what is RAC ?Oracle RAC allows multiple computers to run OracleRDBMSsoftware simultaneously while accessing a singledatabase, thus providing aclustereddatabase.In a non-RAC Oracle database, a singleinstanceaccesses a single database. Thedatabaseconsists of a collection ofdata files, control files, andlocated ondisk. Theinstancecomprises the collection of Oracle-related memory andoperating systemprocesses thredo logsat run on a computer system.In an Oracle RAC environment, two or more computers (each with an instance) concurrently access a single database. This allows an application or user to connect to either computer and have access to a single coordinated set of data.what is temp tablespace ? how will you add size in temp tablespace?Temporary tablespaces are used to manage space for database sort operations and for storing global temporary tables. For example, if you join two large tables, and Oracle cannot do the sort in memory (see SORT_AREA_SIZE initialisation parameter), space will be allocated in a temporary tablespace for doing the sort operation. Other SQL operations that might require disk sorting are: CREATE INDEX, ANALYZE, Select DISTINCT, ORDER BY, GROUP BY, UNION, INTERSECT, MINUS, Sort-Merge joins, etc.

When we create a TEMPFILE, Oracle only writes to the header and last block of the file. This is why it is much quicker to create a TEMPFILE than to create a normal database file.The DBA should assign a temporary tablespace to each user in the database to prevent them from allocating sort space in the SYSTEM tablespace. This can be done with one of the following commands:

SQL> CREATE USER scott DEFAULT TABLESPACE data TEMPORARY TABLESPACE temp;SQL> ALTER USER scott TEMPORARY TABLESPACE temp;SQL> select TABLESPACE_NAME, BYTES_USED, BYTES_FREE from V$TEMP_SPACE_HEADER;Several methods exist to reclaim the used space for a larger than normal temporary tablespace depending on which release of Oracle you are running. The method that exists for all releases of Oracle is to simply drop and recreate the temporary tablespace back to its original (or another reasonable) size. If you are using Oracle9ior higher, you can apply another method which is to drop the large tempfile (which will drop the tempfile from the data dictionary AND the O/S file system) using thealter database tempfile '' drop including datafiles

what is shared pool?Theshared poolis used forobjectsthat are shared among all users. For example: table definitions, PL/SQL definitions, cursors and so on.The shared pool can further be subdivied into:Control structuresCharacter setsDictionary cacheThe dictionary cache stores parts fo thedata dictionarybecause Oracle has to query the data dictionary very often as it is fundamental to the functioning of Oracle.Library cacheThe library cache is further divided intoShared SQL AreaPL/SQL ProceduresControl Structures

select name, bytes/1024/1024 "MB"from v$sgastatwhere pool = 'shared pool'order by bytes desc;

what is tablespace concepts?Database is divided into one or more logical storage units known as table space. The table space is createdbydatabase administrator. After the table space gets created by administrator tables can be created by users in their table space in other words tables can be created in the table space provided for the users.Thereare three types of tablespaces in Oracle: Permanent tablespaces Undo tablespaces temporary tablespaces

what is triggers?Oracle lets you define procedures calledtriggersthat run implicitly when anINSERT,UPDATE, orDELETEstatement is issued against the associated table or, in some cases, against a view, or when database system actions occur. These procedures can be written in PL/SQL or Java and stored in the database.Triggers are similar to stored procedures. A trigger stored in the database can include SQL and PL/SQL or Java statements to run as a unit and can invoke stored procedures. However, procedures and triggers differ in the way that they are invoked. A procedure is explicitly run by a user, application, or trigger. Triggers are implicitly fired by Oracle when a triggering event occurs, no matter which user is connected or which application is being used.

how to create trigger ...create trigger trigger-name before eventcreate trigger trigger-name after eventcreate trigger trigger-name instead of event

Difference between temporary tablespace and permanenttablespace

Temporary Tablespace is in generally used for sorting purpose while Permanent tablespace is used to sore permanent objects

what is logical backup ?Logical backup is taking by the use of Exp /expdb utility .

what is oracle precompiler?The Oracle Precompilers are used to process C, COBOL, or PL/I programs before passing them to their native compilers.Oracle Precompilers translate embedded SQL statements in the programs into the appropriate native language statements and calls necessary to access the Oracle9i database server.how do u resize and add the datafile?to resize data filealter databse datafile 'location of datafile' resize 2000Mto add the data filealter tablespace tablspace_name add datafile 'datafile_location' size 4M autoextend off;

how to take table space backup ?we can take tablespace backup through data Pump .check below link for details of data pump.http://chetanyadavds.blogspot.com/2010/08/export-and-import-using-datapump.html

Ques.: What isSHMMAX & Semaphores ?

TheSHMMAXparameter is used to define the maximum size (in bytes) for a shared memory segment and should be set large enough for the largest SGA size. If theSHMMAXis set incorrectly(too low), it is possible that the Oracle SGA(which is held in shared segments)may be limited in size. An inadequateSHMMAXsetting would result in the following:ORA-27123: unable to attach to shared memory segmentYou can determine the value ofSHMMAXby performing the following:# cat /proc/sys/kernel/shmmax33554432A semaphore can be thought of as a counter that is used to control access to a shared resource. Semaphores provide low level synchronization between processes(or threads within a process)so that only one process(or thread)has access to the shared segment, thereby ensureing the integrity of that shared resource.

QUESTION: Which process starts the RMAN in Oracle

We initiate RMAN. RMAN is basically a utility. We invoke rman by executing the rman binary executable ($ORACLE_HOME/bin) from the operating system prompt. So, when you break it down, users start rman. When you further break it down, it comes down to "User Process".

Phase-1: When we invoke rman, oracle creates a "user process" to run/start it as below:

a) $

Phase-2: When rman is started and connected to target database, 2 server processes are spawned, by default. That is, when you attempt to connect to the target database (using "connect target /"), RMAN checks the parameter, $ORACLE_SID, and invokes a server process. On successful authentication, RMAN would connect you to the target database with 'sysdba' privilege. RMAN would then immediately invoke another server process (some people call it "channel process") and this will be used to perform actions. However, more than 1 channel process may also be started if you allocate more channels (by overriding the default settings)

c) RMAN> connect target /

Note: You can merge phase-1 and phase-2 by using:

d) $ rman target /

In the interviews, as you do not get sufficient time to explain all this, you can say that "user process" will invoke RMAN and RMAN, in turn, invokes "server process(es)" on establishing a connection with target database. However, to be politically correct, when we run rman executable, user process is started. When we subsequently connect to target database, server process/(es) is/(are) started.

QUESTION: Can we use rman on a shared connection to server ?Is the server process started when we connect to target database or when a backup begins or when a channel is allocated ?

only Dedicated server process can be used for RMAN. If you use a shared server configuration, you MUST modify the tns entries of your database to use the clause, "SERVER=dedicated". Set up a new net service name (for example, set 'xxxx_new' for 'xxxx') and Ensure that you use the SAME service name. When you use this clause, you force the listener to spawn a dedicated server process.

Example:

xxxx_new =(DESCRIPTION=(ADDRESS= ................)(CONNECT_DATA=(SERVICE_NAME=xxxx) (SERVER=dedicated)))

Then, connect to RMAN as:

$ /bin/rman

RMAN> connect target sys/@xxxx_newTo answer you second question, when you connect to the target database, RMAN spawns 2 server processes, by default, as explained in my previous day's comment.

The 1st server process checks compatibility, executes queries against controlfile and performs resync operations. This process also executes sql statements issued from rman prompt. There can only be 1 such server process. If you notice any performance issues related to oracle layers, you have to analyze this process.

2nd server process monitors the activities being carried out by the channels. When you issue any new operation via rman prompt, this process will determine if the previous activities were completed and only then the new operations are permitted. Even in this case, there can only be 1 such 2nd server process per instance. This process is very quick and does not cause any performance issue(s). By the way, in very rare cases, if you use different connect strings while MANUALLY allocating channels (using "allocate channel" command) additional 2nd server processes will be spawned by RMAN. I have intentionally called this process as "2nd server process", in order to distinguish it from the 1st server process.

In addition, when you issue a command to perform backup or recovery operations, RMAN spawns another server process or server session. This process is also called 'target connection'. By default only 1 target connection is allocated. If you allocate multiple channels MANUALLY, more than 1 target connection (also known as server process or server session) will be spawned, where each server process or target connection or server session corresponds to each of the allocated channels. If you notice any performance issues related to the media manager, you have to track down and analyze this process, i.e. track the server session corresponding to the channels. You can find this by joining v$session and v$process and querying sid, spid and client_info.

what is the difference between database refresh and database cloningAnswer :_Database refresh is normally done for Test/DEV databases during development and test phases of App Development, where latest production cut of database is taken and applied on these environments.

Cloning is creating replica of already existing databases on the same/different target hosts. Cloning doesn't necessarily involve copying Oracle Home. Database can also be cloned on the same machine.More oracle DBA interview question and answer

What is the Maximum allowed length of Record group Column?Record group column names cannot exceed 30 characters.Which parameter can be used to set read level consistency across multiple queries?Read onlyWhat are the different types of Record Groups?Query Record GroupsNonQuery Record GroupsState Record GroupsFrom which designation is it preferred to send the output to the printed?PreviewerWhat are difference between postdatabasecommit and post-form commit?Post-form commit fires once during the post and commit transactions process, after the database commit occurs. The post-form-commit trigger fires after inserts, updates and deletes have been posted to the database but before the transactions have been finalized in the issuing the command. The post-database-commit trigger fires after oracle forms issues the commit to finalized transactions.What are the different display styles oflist items?Pop_listText_listCombo boxWhich of the above methods is the faster method?performing the calculation in the query is faster.With which function of summary item is the compute at options required?percentage of total functions.What are parameters?Parameters provide a simple mechanism for defining and setting the valuesof inputs that are required by a form at startup. Form parameters are variables of type char,number,date that you define at design time.What are the three types of user exits available ?Oracle Precompiler exits, Oracle call interface, NonOracle user exits.How many windows in a form can have console?Only one window in a form can display the console, and you cannot change the console assignment at runtime.What is an administrative (privileged) user? (for DBA )Oracle DBAsand operators typically use administrative accounts to manage the database and database instance. An administrative account is a user that is granted SYSOPER or SYSDBA privileges. SYSDBA and SYSOPER allow access to a database instance even if it is not running. Control of these privileges is managed outside of the database via password files and specialoperating systemgroups. This password file is created with the orapwd utility.What are the two repeating frame always associated with matrix object?One down repeating frame below one across repeating frame.What are the master-detail triggers?On-Check_delete_masterOn_clear_detailsOn_populate_detailsHow does one connect to an administrative user? (for DBA )If an administrative user belongs to the "dba" group onUnix, or the "ORA_DBA" (ORA_sid_DBA) group on NT, he/she can connect like this:connect / as sysdbaNo password is required. This is equivalent to the desupported "connect internal" method.A password is required for "non-secure" administrative access. These passwords are stored in password files. Remote connections via Net8 are classified as non-secure. Look at this example:connect sys/password as sysdbaHow does one create a password file? (for DBA )The Oracle Password File ($ORACLE_HOME/dbs/orapw or orapwSID) stores passwords for users with administrative privileges. One needs to create a password files before remote administrators (like OEM) will be allowed to connect.Follow this procedure to create a new password file:. Log in as theOracle softwareowner. Runcommand: orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=mypasswd. Shutdown the database (SQLPLUS> SHUTDOWN IMMEDIATE). Edit the INIT.ORA file and ensure REMOTE_LOGIN_PASSWORDFILE=exclusive is set.. Startup the database (SQLPLUS> STARTUP)NOTE: The orapwd utility presents asecurity riskin that it receives a password from the command line. This password is visible in the process table of many systems. Administrators needs to be aware of this!Is it possible to modify an external query in a report which contains it?No.Does a grouping done for objects in the layout editor affect the grouping done in the data model editor?No.How does one add users to a password file? (for DBA )One can select from the SYS.V_$PWFILE_USERS view to see which users are listed in the password file. New users can be added to the password file by granting them SYSDBA or SYSOPER privileges, or by using the orapwd utility. GRANT SYSDBA TO scott;If a break order is set on a column would it affect columns which are under the column?NoWhy are OPS$ accounts a security risk in a client/server environment? (for DBA)If you allow people to log in with OPS$ accounts from WindowsWorkstations, you cannot be sure who they really are. With terminals, you can rely on operating system passwords, with Windows, you cannot.If you set REMOTE_OS_AUTHENT=TRUE in your init.ora file, Oracle assumes that the remote OS has authenticated the user. If REMOTE_OS_AUTHENT is set to FALSE (recommended), remote users will be unable to connect without a password. IDENTIFIED EXTERNALLY will only be in effect from the local host. Also, if you are using "OPS$" as your prefix, you will be able to log on locally with or without a password, regardless of whether you have identified your ID with a password or defined it to be IDENTIFIED EXTERNALLY.Do user parameters appear in the data modal editor in 2.5?NoCan you pass data parameters to forms?NoIs it possible to link two groups inside a cross products after the cross products group has been created?noWhat are the different modals of windows?Modalless windowsModal windowsWhat are modal windows?Modal windows are usually used as dialogs, and have restricted functionality compared to modelless windows. On some platforms for example operators cannot resize, scroll or iconify a modal window.What are the different default triggers created when Master Deletes Property is set to Non-isolated?Master Deletes Property Resulting Triggers----------------------------------------------------Non-Isolated(the default) On-Check-Delete-MasterOn-Clear-DetailsOn-Populate-DetailsWhat are the different default triggers created when Master Deletes Property is set to isolated?Master Deletes Property Resulting Triggers---------------------------------------------------Isolated On-Clear-DetailsOn-Populate-DetailsWhat are the different default triggers created when Master Deletes Property is set to Cascade?Master Deletes Property Resulting Triggers---------------------------------------------------Cascading On-Clear-DetailsOn-Populate-DetailsPre-deleteWhat is the diff. bet. setting up of parameters in reports 2.0 reports2.5?LOVs can be attached to parameters in the reports 2.5 parameter form.What are the difference between lov & list item?Lov is a property where as list item is an item. A list item can have only one column, lov can have one or more columns.What is the advantage of the library?Libraries provide a convenient means of storing client-side program units and sharing them among multipleapplications. Once you create a library, you can attach it to any other form, menu, or library modules. When you can call library program units from triggersmenu itemscommands and user named routine, you write in the modules to which you have attach the library. When a library attaches another library, program units in the first library can reference program units in the attached library. Library support dynamic loading-that is library program units are loaded into an application only when needed. This can significantly reduce the run-time memory requirements of applications.What is lexical reference? How can it be created?Lexical reference is place_holder for text that can be embedded in asql statements. A lexical reference can be created using & before the column or parameter name.What is system.coordination_operation?It represents the coordination causing event that occur on the master block in master-detail relation.What is synchronize?It is a terminal screen with the internal state of the form.It updatesthe screen display to reflect the information that oracle forms has in its internal representation of the screen.What use of command line parameter cmd file?It is a command line argument that allows you to specify a file that contain a set of arguments for r20run.What is a Text_io Package?It allows you to read and write information to a file in thefile system.What is forms_DDL?Issues dynamic Sql statements at run time, including server side pl/SQl and DDLHow is link tool operation different bet. reports 2 & 2.5?In Reports 2.0 the link tool has to be selected and then two fields to be linked are selected and the link is automatically created. In 2.5 the first field is selected and the link tool is then used to link the first field to the second field.What are the different styles of activation of ole Objects?In place activationExternal activationHow do you reference a Parameter?In Pl/Sql, You can reference and set the values of form parameters using bind variables syntax. Ex. PARAMETER name = '' or :block.item = PARAMETER Parameter nameWhat is the difference between object embedding & linking in Oracle forms?In Oracle forms, Embedded objects become part of the form module, and linked objects are references from a form module to a linked source file.Name of the functions used to get/set canvas properties?Get_view_property, Set_view_propertyWhat are the built-ins that are used for setting the LOV properties at runtime?get_lov_propertyset_lov_propertyWhat are the built-ins used for processing rows?Get_group_row_count(function)Get_group_selection_count(function)Get_group_selection(function)Reset_group_selection(procedure)Set_group_selection(procedure)Unset_group_selection(procedure)What are built-ins used for Processing rows?GET_GROUP_ROW_COUNT(function)GET_GROUP_SELECTION_COUNT(function)GET_GROUP_SELECTION(function)RESET_GROUP_SELECTION(procedure)SET_GROUP_SELECTION(procedure)UNSET_GROUP_SELECTION(procedure)What are the built-in used for getting cell values?Get_group_char_cell(function)Get_groupcell(function)Get_group_number_cell(function)What are the built-ins used for Getting cell values?GET_GROUP_CHAR_CELL (function)GET_GROUPCELL(function)GET_GROUP_NUMBET_CELL(function)Atleast how many set of data must a data model have before a data model can be base on it?FourTo execute row from being displayed that still use column in the row which property can be used?Format trigger.What are different types of modules available in oracle form?Form module - a collection of objects and code routines Menu modules - a collection of menus and menu item commands that together make up an application menu library module - a collection of user named procedures, functions and packages that can be called from other modules in the applicationWhat is the remove on exit property?For a modelless window, it determines whether oracle forms hides the window automatically when the operators navigates to an item in the another window.What is WHEN-Database-record trigger?Fires when oracle forms first marks a record as an insert or an update. The trigger fires as soon as oracle forms determines through validation that the record should be processed by the next post or commit as an insert or update. c generally occurs only when the operators modifies the first item in the record, and after the operator attempts to navigate out of the item.What is a difference between pre-select and pre-query?Fires during the execute query and count query processing after oracle forms constructs the select statement to be issued, but before the statement is actually issued. The pre-query trigger fires just before oracle forms issues the select statement to the database after the operator as define the example records by entering the query criteria in enter query mode.Pre-query trigger fires before pre-select trigger.What are built-ins associated with timers?find_timercreate_timerdelete_timerWhat are the built-ins used for finding object ID functions?Find_group(function)Find_column(function)What are the built-ins used for finding Object ID function?FIND_GROUP(function)FIND_COLUMN(function)Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?FalseUse the Add_group_row procedure to add a row to a static record group 1. true or false?FalseDifference between 10g and 11g1.SIMPLIFIED AND IMPROVED AUTOMATIC MEMORY MANAGEMENT2.NEW FAULT DIAGNOSABILITY INFRASTRUCTURE TO PREVENT, DETECT, DIAGNOSE, AND HELP RESOLVE CRITICAL DATABASE ERRORS3.INVISIBLE INDEXES4.VIRTUAL COLUMNS5.ENHANCED SECURITY FOR PASSWORD-BASED AUTHENTICATION BY ENABLING USE OF MIXED CASE IN PASSWORDS.6.TABLESPACE-LEVEL ENCRYPTION7.ABILITY TO ONLINE REDEFINE TABLES THAT HAVE MATERIALIZED VIEW LOGSGeneral ORACLE DBA interview Question1. What is an Oracle Instance? An instance is the (executed) Oracle software (Oracle processes) and the memory they use (SGA). It is the instance that manipulates the data stored in the database.

2. What information is stored in Control File?The database nameThe timestamp of database creation The names and locations of associated datafiles and redo log files Tablespace information Datafile offline ranges The log history Archived log information Backup set and backup piece information Backup datafile and redo log information Datafile copy information The current log sequence number

3. When you start an Oracle DB which file is accessed first?Oracle first open and reads the initialization parameter file (init.ora).

4. What is the Job of SMON, PMON processes?PMONIt cleaned up the failed processes BY>> Rolling back the transaction>> Releasing all currently held table or row locks>> freeing other resource currently held by the user>>Restart the dead dispatcher

SMONif the oracle instance fails , any information that in SGA that has not been written to the disk is cost .>> the background process smon automatic perform instance recovery when the database is reopened.>>Instance recovery Roll forward changes in the redolog Open the database for user access Roll back the uncommitted transaction also perform It combines or coalesces, adjacent area of free space in the datafile . Dislocate the temporary segment

5. What is Instance Recovery?

Instance recovery Roll forward changes in the redolog Open the database for user access Roll back the uncommitted transaction also perform It combines or coalesces, adjacent area of free space in the datafile . Dislocate the temporary segment6. What is written in Redo Log Files?

# Log writer (LGWR) writes redo log buffer contents Into Redo Log FIles. Log writer does this every three seconds, when the redo log buffer is 1/3 full and immediately before the Database Writer (DBWn) writes its changed buffers into the datafile.

7. How do you control number of Datafiles one can have in an Oracle database?

8. How many Maximum Datafiles can there be in an Oracle Database?

In a database there can have maximum 65533 data files.9. What is a Tablespace?

A tablespace is a logical group of data files in a database. A database typically contains at least one tablespace, and usually two or more. Within the database, the tablespace plays a role similar to that of a folder on the hard drive of a computer.

Some database programs, such as Oracle, automatically create a tablespace called SYSTEM that contains general information about the structure and contents of the database. A small database can be entirely contained in the SYSTEM tablespace, but in most cases, user datais placed in other tablespaces.

There is no relationship between a tablespace and a schema. Objects in the same schema can be in different tablespaces, and a tablespace can hold objects from different schemas.10. What is the purpose of Redo Log files?

11. Which default Database roles are created when you create a Database?

12. What is a Checkpoint?

13. Which Process reads data from Datafiles?

14. Which Process writes data in Datafiles?

15. Can you make a Datafile auto extendible. If yes, how?

16. What is a Shared Pool?

17. What is kept in the Database Buffer Cache?

18. How many maximum Redo Logfiles one can have in a Database?

19. What is difference between PFile and SPFile?

20. What is PGA_AGGREGRATE_TARGET parameter?

21. Large Pool is used for what?

22. What is PCT Increase setting?

23. What is PCTFREE and PCTUSED Setting?

24. What is Row Migration and Row Chaining?

25. What is 01555 - Snapshot Too Old error and how do you avoid it?

26. What is a Locally Managed Tablespace?

27. Can you audit SELECT statements?

28. What does DBMS_FGA package do?

29. What is Cost Based Optimization?

30. How often you should collect statistics for a table?

31. How do you collect statistics for a table, schema and Database?

32. Can you make collection of Statistics for tables automatic?

33. On which columns you should create Indexes?

34. What type of Indexes are available in Oracle?

35. What is B-Tree Index?

36. A table is having few rows, should you create indexes on this table?

37. A Column is having many repeated values which type of index you should create on thiscolumn, if you have to?

38. When should you rebuilt indexes?

39. Can you built indexes online?

40. Can you see Execution Plan of a statement.

41. A table is created with the following settingstorage (initial 200k next 200k minextents 2 maxextents 100 pctincrease

40) What will be size of 4th extent?

42. What is DB Buffer Cache Advisor?

43. What is STATSPACK tool?

44. Can you change SHARED_POOL_SIZE online?

45. Can you Redefine a table Online?

46. Can you assign Priority to users?

47. You want users to change their passwords every 2 months. How do you enforce this?

48. How do you delete duplicate rows in a table?

49. What is Automatic Management of Segment Space setting?

50. What is the difference between DELETE and TRUNCATE statements?

51. What is COMPRESS and CONSISTENT setting in EXPORT utility?

52. What is the difference between Direct Path and Convention Path loading?

53. Can you disable and enable Primary key?

54. What is an Index Organized Table?

55. What is a Global Index and Local Index?

56. What is the difference between Range Partitioning and Hash Partitioning?

57. What is difference between Multithreaded/Shared Server and Dedicated Server?

58. Can you import objects from Oracle ver. 9i to 10g?

59. How do you move tables from one tablespace to another tablespace?

60. How do see how much space is used and free in a tablespace?

During the last versions of Oracle database there have been several step-by-step changes in the way the database manages its memory.The first step in this series was done in Oracle9i by merging the different process work areas (sort area, hash area etc.) to a single aggregate memory pool, controlled by the server parameter pga_aggregate_target.With Oracle 10g a similar approach was taken for the shared memory area. The different pools like the buffer cache, shared pool etc. were integrated into a single pool. The corresponding server parameters are sga_target and sga_max_target.Apart from this automatic management, in both cases it is still possible to manually manage the memory areas or as a compromise to set lower limits for some memory areas.The same holds true for Oracle 11g. Additionally, there is another new option to manage the whole memory requirements of the Oracle instance, i.e. shared memory SGA and process memory PGA, in one single pool with the parameters memory_target and memory_max_target.When one starts at looking how this is actually realized, it is a small surprise. In any database release up to version 10g Oracle makes use of the so-called System V-style shared memory. Thus it always was and is possible to verify existence and size of the shared memory area by issuing Unix commands like ipcs, either manually or script-driven.[root@ora11gr2 ~]# ipcs -m Shared Memory Segments key shmid owner perms bytes nattch status000000000 65536 oracle 600 393216 2 dest000000000 98305 oracle 600 393216 2 dest000000000 131074 oracle 600 393216 2 dest000000000 163843 oracle 600 393216 2 dest000000000 196612 oracle 600 393216 2 dest000000000 229381 oracle 600 393216 2 dest000000000 262150 oracle 600 393216 2 dest 000000000 294919 oracle 600 393216 2 dest 000000000 327688 oracle 600 393216 2 dest 0x75fc1f04 285376521 oracle 660 348127232 34 000000000 425994 oracle 600 393216 2 destListing 1: Shared Memory Segments until Oracle10gThe listing shows an SGA with a size of 332MB. The nattch column gives the number of processes sharing this shared memory area 34 in this case. These are the server processes as well as the background processes like DBWR, LGWR etc. A performance tool like Quest Performance Analysis for Oracle also attaches to the SGA for getting performance data directly from memory, thereby incrementing the process count.Now, if one switches on automatic memory management (AMM) in an Oracle 11g database by setting memory_target to some value, e.g. 500M, the picture gets completely different:[root@ora11gr2 ~]# ipcs -m Shared Memory Segments key shmid owner perms bytes nattch status000000000 65536 oracle 600 393216 2 dest000000000 98305 oracle 600 393216 2 dest 000000000 131074 oracle 600 393216 2 dest 000000000 163843 oracle 600 393216 2 dest 000000000 196612 oracle 600 393216 2 dest 000000000 229381 oracle 600 393216 2 dest 000000000 262150 oracle 600 393216 2 dest 000000000 294919 oracle 600 393216 2 dest 000000000 327688 oracle 600 393216 2 dest 000000000 285442057 oracle 660 4096 0 000000000 425994 oracle 600 393216 2 dest 000000000 285474827 oracle 660 4096 0 0x75fc1f04 285507596 oracle 660 4096 0Listing 2: Shared Memory Segments in Oracle 11gHere the SGA shows up with a size of only 4KB and without any attached process.What Happened?The background for this different behavior is that with System V-style shared memory management it is not easily possible to move memory between the monolithic shared memory segment and the private memory areas (PGA) of the processes. But exactly this was one of the objectives for Oracle 11g. Therefore, to make this possible, whenever one uses memory_target the Oracle instance internally changes to another management form offered by the operating system, the so-called Posix-Style shared memory management.This allows breaking up the shared memory into small portions which are called granules by Oracle. Each granule can then easily be de-allocated from SGA and reallocated into PGA or vice versa, effectively moving memory between SGA and PGA. Unfortunately, Posix-managed shared memory is not visible with the mentioned tools like ipcs. Instead of that it is managed by the means of a virtual file system called shmfs or tmpfs. On Linux-based systems this is most often mounted on /dev/shm. So the current Posix-style shared memory usage is identical with the used space in this virtual file system.[oracle@ora11gr2 ~]$ df -k /dev/shmFilesystem 1K-blocks Used Available Use% Mounted ontmpfs 614400 335688 278712 55% /dev/shmListing 3: Shared Memory virtual file systemA look into the directory /dev/shm also shows the granules. Depending on the overall memory size each granule is either 4MB or 16MB in size. Some granules have size 0, indicating that this memory area is currently attached to PGA, but could be called back into SGA at any time.[oracle@ora11gr2 ~]$ df ls -la /dev/shm-rw-r 1 oracle oinstall 4194304 Jan 5 19:51 ora_PS112_285474827_68-rw-r 1 oracle oinstall 4194304 Jan 5 19:51 ora_PS112_285474827_69-rw-r 1 oracle oinstall 0 Jan 5 19:51 ora_PS112_285474827_7-rw-r 1 oracle oinstall 4194304 Jan 5 19:51 ora_PS112_285474827_70Listing 4: Directory /dev/shmUseful tools for Troubleshooting in this environment are the OS commands fuser and pmap.fuser takes a shared memory granule (i.e. a file in the virtual directory) as argument and lists all processes accessing this granule, i.e. all processes attached to this shared memory segment, e.g.:sbin/fuser -v /dev/shm/ora_PS112_285507596_9USER PID ACCESS COMMANDoracle 22848 .m oracleoracle 22850 .m oracleoracle 22854 .m oracleListing 5: Process structureThe opposite direction is covered by by pmap which lists the shared memory granules belonging to a given process.For the database administrator it is important to know that, prior to starting the Oracle instance, the underlying virtual file system has to be sized accordingly. The determining factor here is the value of the memory_max_target parameter. If not set explicitly it defaults to the memory_target parameter value.At first try the Oracle instance often gives back the following error message:SQL> startupORA-00845: MEMORY_TARGET not supported on this systemListing 6: Error message when starting the Oracle instanceContrary to the wording of this error message the root cause is not at all a lack of support for memory_target. A quick look into Oracles alert log gives a better description of what happened:[oracle@ora11gr2 trace]$ tail -3 alert_PS112.logStarting ORACLE instance (normal)WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 2097152000 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 629145600 and used is 0 bytes. Ensure that the mount point is /dev/shm for this directory.memory_target needs larger /dev/shmListing 7: Error message in alert logThe solution is to un-mount the file system /dev/shm and re-mount it with a higher size, which is specified by the mount parameter size.[root@ora11gr2 ~]# umount /dev/shm# Adjust entry in /etc/fstab, e.g.:# tmpfs /dev/shm tmpfs size=2000m 0 0[root@ora11gr2 ~]# mount /dev/shmListing 8: Change of /dev/shm file systemSummaryIn the course of introducing Automatic Memory Management (AMM) in version 11g, Oracle performed a major change in the internal memory management on OS level. This affects the prerequisites for setting up a database. Also it has an impact on troubleshooting processes, e.g. other diagnostic tools and OS commands have to be used.Oracle11gTablespacesPosted: January 26, 2012 inOracle Architecture,Oracle Performance Tuning Tags:Oracle tablespace0The primary tablespace in any database is theSYSTEMtablespace, which contains information basic to the functioning of the database server, such as the data dictionary and the system rollback segment. TheSYSTEMtablespace is the first tablespace created at database creation. It is managed as any other tablespace, but requires a higher level of privilege and is restricted in some ways. For example, you cannot rename or drop theSYSTEMtablespace or take it offline.heSYSAUXtablespace, which acts as an auxiliary tablespace to theSYSTEMtablespace, is also always created when you create a database. It contains information about and the schemas used by various Oracle products and features, so that those products do not require their own tablespaces. As for theSYSTEMtablespace, management of theSYSAUXtablespace requires a higher level of security and you cannot rename or drop it.The steps for creating tablespaces vary by operating system, but the first step is always to use your operating system to create a directory structure in which your datafiles will be allocated. On most operating systems, you specify the size and fully specified filenames of datafiles when you create a new tablespace or alter an existing tablespace by adding datafiles. Whether you are creating a new tablespace or modifying an existing one, the database automatically allocates and formats the datafiles as specified.To create a new tablespace, use the SQL statementCREATE TABLESPACEorCREATE TEMPORARY TABLESPACE. You must have theCREATE TABLESPACEsystem privilege to create a tablespace. Later, you can use theALTER TABLESPACEorALTER DATABASEstatements to alter the tablespace. You must have theALTER TABLESPACEorALTER DATABASEsystem privilege, correspondingly.You can also use theCREATE UNDO TABLESPACEstatement to create a special type of tablespace called an undo tablespace, which is specifically designed to contain undo records. These are records generated by the database that are used to roll back, or undo, changes to the database for recovery, read consistency, or as requested by aROLLBACKstatement.Locally Managed TablespacesLocally managed tablespaces track all extent information in the tablespace itself by using bitmaps, resulting in the following benefits: Fast, concurrent space operations. Space allocations and deallocations modify locally managed resources (bitmaps stored in header files). Enhanced performance Readable standby databases are allowed, because locally managed temporary tablespaces do not generate any undo or redo. Space allocation is simplified, because when theAUTOALLOCATEclause is specified, the database automatically selects the appropriate extent size. User reliance on the data dictionary is reduced, because the necessary information is stored in file headers and bitmap blocks. Coalescing free extents is unnecessary for locally managed tablespaces.All tablespaces, including theSYSTEMtablespace, can be locally managed.TheDBMS_SPACE_ADMINpackage provides maintenance procedures for locally managed tablespaces.Creating a Locally Managed TablespaceCreate a locally managed tablespace by specifyingLOCALin theEXTENT MANAGEMENTclause of theCREATE TABLESPACEstatement. This is the default for new permanent tablespaces, but you must specify theEXTENTMANAGEMENTLOCALclause if you want to specify either theAUTOALLOCATEclause or theUNIFORMclause. You can have the database manage extents for you automatically with theAUTOALLOCATEclause (the default), or you can specify that the tablespace is managed with uniform extents of a specific size (UNIFORM).If you expect the tablespace to contain objects of varying sizes requiring many extents with different extent sizes, thenAUTOALLOCATEis the best choice.AUTOALLOCATEis also a good choice if it is not important for you to have a lot of control over space allocation and deallocation, because it simplifies tablespace management. Some space may be wasted with this setting, but the benefit of having Oracle Database manage your space most likely outweighs this drawback.If you want exact control over unused space, and you can predict exactly the space to be allocated for an object or objects and the number and size of extents, thenUNIFORMis a good choice. This setting ensures that you will never have unusable space in your tablespace.When you do not explicitly specify the type of extent management, Oracle Database determines extent management as follows: If theCREATE TABLESPACEstatement omits theDEFAULTstorage clause, then the database creates a locally managed autoallocated tablespace. If theCREATE TABLESPACEstatement includes aDEFAULTstorage clause, then the database considers the following: If you specified theMINIMUM EXTENTclause, the database evaluates whether the values ofMINIMUM EXTENT,INITIAL, andNEXTare equal and the value ofPCTINCREASEis 0. If so, the database creates a locally managed uniform tablespace with extent size =INITIAL. If theMINIMUM EXTENT,INITIAL, andNEXTparameters are not equal, or ifPCTINCREASEis not 0, the database ignores any extent storage parameters you may specify and creates a locally managed, autoallocated tablespace. If you did not specifyMINIMUM EXTENTclause, the database evaluates only whether the storage values ofINITIALandNEXTare equal andPCTINCREASEis 0. If so, the tablespace is locally managed and uniform. Otherwise, the tablespace is locally managed and autoallocated.The following statement creates a locally managed tablespace namedlmtbsband specifiesAUTOALLOCATE:CREATE TABLESPACE lmtbsb DATAFILE '/u02/oracle/data/lmtbsb01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL AUTOALLOCATE;AUTOALLOCATEcauses the tablespace to be system managed with a minimum extent size of 64K.The alternative toAUTOALLOCATEisUNIFORM. which specifies that the tablespace is managed with extents of uniform size. You can specify that size in theSIZEclause ofUNIFORM. If you omitSIZE, then the default size is 1M.The following example creates a tablespace with uniform 128K extents. (In a database with 2K blocks, each extent would be equivalent to 64 database blocks). Each 128K extent is represented by a bit in the extent bitmap for this file.CREATE TABLESPACE lmtbsb DATAFILE '/u02/oracle/data/lmtbsb01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;You cannot specify theDEFAULTstorage clause,MINIMUM EXTENT, orTEMPORARYwhen you explicitly specifyEXTENT MANAGEMENT LOCAL. If you want to create a temporary locally managed tablespace, use theCREATE TEMPORARY TABLESPACEstatement.Specifying Segment Space Management inLocally Managed TablespacesIn a locally managed tablespace, there are two methods that Oracle Database can use to manage segment space: automatic and manual. Manual segment space management uses linked lists called freelists to manage free space in the segment, while automatic segment space management uses bitmaps. Automatic segment space management is the more efficient method, and is the default for all new permanent, locally managed tablespaces.Automatic segment space management delivers better space utilization than manual segment space management. It is also self-tuning, in that it scales with increasing number of users or instances. In an Oracle Real Application Clusters environment, automatic segment space management allows for a dynamic affinity of space to instances. In addition, for many standard workloads, application performance with automatic segment space management is better than the performance of a well-tuned application using manual segment space management.Although automatic segment space management is the default for all new permanent, locally managed tablespaces, you can explicitly enable it with theSEGMENT SPACE MANAGEMENT AUTOclause.The following statement creates tablespacelmtbsbwith automatic segment space management:CREATE TABLESPACE lmtbsb DATAFILE '/u02/oracle/data/lmtbsb01.dbf' SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;TheSEGMENT SPACE MANAGEMENT MANUALclause disables automatic segment space management.The segment space management that you specify at tablespace creation time applies to all segments subsequently created in the tablespace. You cannot change the segment space management mode of a tablespace.Bigfile TablespacesA bigfile tablespace is a tablespace with a single, but very large (up to 4G blocks) datafile. Traditional smallfile tablespaces, in contrast, can contain multiple datafiles, but the files cannot be as large. The benefits of bigfile tablespaces are the following: A bigfile tablespace with 8K blocks can contain a 32 terabyte datafile. A bigfile tablespace with 32K blocks can contain a 128 terabyte datafile. The maximum number of datafiles in an Oracle Database is limited (usually to 64K files). Therefore, bigfile tablespaces can significantly enhance the storage capacity of an Oracle Database. Bigfile tablespaces can reduce the number of datafiles needed for a database. An additional benefit is that theDB_FILESinitialization parameter andMAXDATAFILESparameter of theCREATE DATABASEandCREATE CONTROLFILEstatements can be adjusted to reduce the amount of SGA space required for datafile information and the size of the control file. Bigfile tablespaces simplify database management by providing datafile transparency. SQL syntax for theALTERTABLESPACEstatement lets you perform operations on tablespaces, rather than the underlying individual datafiles.Bigfile tablespaces are supported only for locally managed tablespaces with automatic segment space management, with three exceptions: locally managed undo tablespaces, temporary tablespaces, and theSYSTEMtablespace.Creating a Bigfile TablespaceTo create a bigfile tablespace, specify theBIGFILEkeyword of theCREATETABLESPACEstatement (CREATEBIGFILETABLESPACE). Oracle Database automatically creates a locally managed tablespace with automatic segment space management. You can, but need not, specifyEXTENTMANAGEMENTLOCALandSEGMENTSPACEMANAGEMENTAUTOin this statement. However, the database returns an error if you specifyEXTENTMANAGEMENTDICTIONARYorSEGMENTSPACEMANAGEMENTMANUAL. The remaining syntax of the statement is the same as for theCREATE TABLESPACEstatement, but you can only specify one datafile. For example:CREATE BIGFILE TABLESPACE bigtbs DATAFILE '/u02/oracle/data/bigtbs01.dbf' SIZE 50G...You can specifySIZEin kilobytes (K), megabytes (M), gigabytes (G), or terabytes (T).If the default tablespace type was set toBIGFILEat database creation, you need not specify the keywordBIGFILEin theCREATE TABLESPACEstatement. A bigfile tablespace is created by default.If the default tablespace type was set toBIGFILEat database creation, but you want to create a traditional (smallfile) tablespace, then specify aCREATESMALLFILETABLESPACEstatement to override the default tablespace type for the tablespace that you are creating.Identifying a Bigfile TablespaceThe following views contain aBIGFILEcolumn that identifies a tablespace as a bigfile tablespace: DBA_TABLESPACES USER_TABLESPACES V$TABLESPACEYou can also identify a bigfile tablespace by the relative file number of its single datafile. That number is 1024 on most platforms, but 4096 on OS/390.Encrypted TablespacesYou can encrypt any permanent tablespace to protect sensitive data. Tablespace encryption is completely transparent to your applications, so no application modification is necessary. Encrypted tablespaces primarily protect your data from unauthorized access by means other than through the database. For example, when encrypted tablespaces are written to backup media for travel from one Oracle database to another or for travel to an off-site facility for storage, they remain encrypted. Also, encrypted tablespaces protect data from users who try to circumvent the security features of the database and access database files directly through the operating system file system.Tablespace encryption does not address all security issues. It does not, for example, provide access control from within the database. Any user who is granted privileges on objects stored in an encrypted tablespace can access those objects without providing any kind of additional password or key.When you encrypt a tablespace, all tablespace blocks are encrypted. All segment types are supported for encryption, including tables, clusters, indexes, LOBs (BASICFILEandSECUREFILE), table and index partitions, and so on.o maximize security, data from an encrypted tablespace is automatically encrypted when written to the undo tablespace, to the redo logs, and to any temporary tablespace. There is no need to explicitly create encrypted undo or temporary tablespaces, and in fact, you cannot specify encryption for those tablespace types.For partitioned tables and indexes that have different partitions in different tablespaces, it is permitted to use both encrypted and non-encrypted tablespaces in the same table or index.Tablespace encryption uses the transparent data encryption feature of Oracle Database, which requires that you create an Oracle wallet to store the master encryption key for the database. The wallet must be open before you can create the encrypted tablespace and before you can store or retrieve encrypted data. When you open the wallet, it is available to all session, and it remains open until you explicitly close it or until the database is shut down.To encrypt a tablespace, you must open the database with theCOMPATIBLEinitialization parameter set to 11.1.0 or higher. The default setting forCOMPATIBLEfor a new Oracle Database 11g Release 1 installation is 11.1.0. Any user who can create a tablespace can create an encrypted tablespace.Transparent data encryption supports industry-standard encryption algorithms, including the following Advanced Encryption Standard (AES) and Triple Data Encryption Standard (3DES) algorithms: 3DES168 AES128 AES192 AES256The encryption key length is implied by the algorithm name. For example, the AES128 algorithm uses 128-bit keys. You specify the algorithm to use when you create the tablespace, and different tablespaces can use different algorithms. Although longer key lengths theoretically provide greater security, there is a trade-off in CPU overhead. If you do not specify the algorithm in yourCREATETABLESPACEstatement, AES128 is the default. There is no disk space overhead for encrypting a tablespace.ExamplesThe following statement creates an encrypted tablespace with the default encryption algorithm:CREATE TABLESPACE securespaceDATAFILE '/u01/app/oracle/oradata/orcl/secure01.dbf' SIZE 100MENCRYPTIONDEFAULT STORAGE(ENCRYPT);The following statement creates the same tablespace with the AES256 algorithm:CREATE TABLESPACE securespaceDATAFILE '/u01/app/oracle/oradata/orcl/secure01.dbf' SIZE 100MENCRYPTION USING 'AES256'DEFAULT STORAGE(ENCRYPT);RestrictionsThe following are restrictions for encrypted tablespaces: You cannot encrypt an existing tablespace with anALTERTABLESPACEstatement. However, you can use Data Pump or SQL statements such asCREATETABLEASSELECTorALTERTABLEMOVEto move existing table data into an encrypted tablespace. Encrypted tablespaces are subject to restrictions when transporting to another database. When recovering a database with encrypted tablespaces (for example after aSHUTDOWNABORTor a catastrophic error that brings down the database instance), you must open the Oracle wallet after database mount and before database open, so the recovery process can decrypt data blocks and redo.Querying Tablespace Encryption InformationTheDBA_TABLESPACESandUSER_TABLESPACESdata dictionary views include a column namedENCRYPTED. This column containsYESfor encrypted tablespaces.The viewV$ENCRYPTED_TABLESPACESlists all currently encrypted tablespaces. The following query displays the name and encryption algorithm of encrypted tablespaces:SELECT t.name, e.encryptionalg algorithm FROM v$tablespace t, v$encrypted_tablespaces eWHERE t.ts# = e.ts#;

NAME ALGORITHM ------------------------------ --------- SECURESPACE AES128Temporary TablespacesA temporary tablespace contains transient data that persists only for the duration of the session. Temporary tablespaces can improve the concurrency of multiple sort operations that do not fit in memory and can improve the efficiency of space management operations during sorts.Temporary tablespaces are used to store the following: Intermediate sort results Temporary tables and temporary indexes Temporary LOBs Temporary B-treesWithin a temporary tablespace, all sort operations for a particular instance share a single sort segment, and sort segments exist for every instance that performs sort operations that require temporary space. A sort segment is created by the first statement after startup that uses the temporary tablespace for sorting, and is released only at shutdown.By default, a single temporary tablespace namedTEMPis created for each new Oracle Database installation. You can create additional temporary tablespaces with theCREATETABLESPACEstatement. You can assign a temporary tablespace to each database user with theCREATE USERorALTER USERstatement. A single temporary tablespace ca