Friday, February 8, 2019

what are ddl, dml & dcl

what are ddl, dml & dcl


Data Definition Language(DDL) are statements used for defining the database structure or schema.

CREATE statement- to create objects in the database
ALTER statement- to alter the objects in the database
DROP – to delete the objects in the database

Data Manipulation language(DML) are statements used for managing data within schema objects.

SELECT statement- to retrieve data from the a database
INSERT statement- to insert data into a table
UPDATE – to updates existing data

Data Control Language(DCL) are statements used for controling the access of data.

GRANT statement- to give access privileges to database
REVOKE statement- to withdraw access privileges

Conclusion:

DDL statements are auto-commit. That means you cant roll back them.
while DML are not auto-commit. That means you can roll-back the operations

What happens while creating the database?

What happens while creating the database?


1.The oracle engine will creates the controlfile. The location and name of the file will be taken from the parameter file.

After the creation of the controlfile,

2.The Oracle will mount the database and then create the system tablespace. And in the system tablespace, a rollback segment with the name system is created. This rollback will exist till the life time of the database and will take care of all transactions(which are performed against the system tablespace).

3.The Controlfile records all the physical files as entries.

4.Now, Oracle has to create base tables in the system tablespace.
Base tableslike TAB$, SYN$, USER$, VIEWS$, .,.,
For creation of base tables, oracle needs the definitions of these tables. The definitions of these base tables have been pre-defined by oracle in a file called sql.bsq.
When we execute the create database command, this file is called.
After execution, the database is opened.

5.Execution of catalog.sql – $ORACLE_HOME/rdbms/admin/catalog.sql

This view creates most of the views, synonyms and public synonyms that are used by the DBA and programmer.

catproc.sql :- Creates most of the packages used for Oracle Programming.
The location of the script is $ORACLE_HOME/rdbms/admin/catproc.sql

pupbld.sql :- Product user profile, This script will create certain tables and roles in the system user that will be used by the DBA to restrict particular user from executing particular command.
The location of the script is $ORACLE_HOME/sqlplus/admin/pupbld.sql.

background_dump_dest = /ora1/oradata/sandy/bdump
If any error is encountered in any of the background processes. Then, those errors would be recorded in this directory. It also contains the alert log file

core_dump_dest=/ora1/oradata/sandy/cdump
It will contain the trace files associated with any memory leaks that may occur within the database. Memory leaks usually occur when a programmer  does not close a pl/sql cursor that had been opened previously. Any errors related to SGA will be recorded to CDUMP directory.

user_dump_dest=/ora1/oradata/sandy/udump
It contains the files that have been traced by the users or DBA.

Process Monitor (PMON):-

If a user updates or performs some dml operation on a set rows but does not commit then that set of rows will be locked. Thus other users cannot perform dml on those rows.
In the mean while, if the client system from where the dml operation was performed gets rebooted or disconnected from the oracle server.
Then, PMON will come into picture and release the locks that had been placed by the dead user process.
After the locks are released PMON will rollback the transaction.

ALERT_LOG_FILE :-

This is the most important file for the DBA. The location is in /ora1/oradata/sandy/bdump. This file will contain the entire physical changes that are made to the database. It will also contain log of every action that is done by the database including..

Startup.
Shutdown.
Startup of background processes.
Opening the files.
Any database related errors.

RAC Basic Faq's

RAC Basic Faq's


Useful Commands:

crsctl enable has –> Enable Automatic start of Oracle High Availability services after reboot
crsctl disable has –> Disable Automatic start of Oracle High Availability services after reboot
What is OHASD?
Ohasd stands for Oracle High Availability Services Daemon. Ohasd spawns 3 types of services at cluster level.

Level 1 : Cssd Agent
Level 2: Oraroot Agent (respawns cssd, crsd, cttsd, diskmon,acfs)
Level 3: OraAgent(respawns mdsnd, gipcd, gpnpd, evmd, asm), CssdMonitor

Useful Commands:
1. crsctl enable has –> To start has services after reboot.
2. crsctl disable has –> has services should not start after reboot
3. crsctl config has –> Check configuration whether autostart is enabled or not.
4. cat /etc/oracle/scls_scr/<Node_name>/root/ohasdstr –> check whether it is enabled or not.
5. cat /etc/oracle/scls_scr/<Node_name>/root/ohasdrun –> whether restart enabled if node fails.

What is OCR? How and why OLR is used? Where is the location of OCR & OLR?
OCR stands for Oracle Cluster Registry. It holds information on it such as node membership (which nodes are part of this cluster), Software Version, Location of the voting disk, Status of RAC databases, listeners, instances & services. OCR is placed in ASM, OCFS.

ASM can be brought up only if we have access to OCR. But, OCR is accessible only after the ASM Is up. In this case, how will CRS services come up?

Yes. For this OLR (Oracle Local Registry) is there. This is a multiplexing of OCR file which was placed in local file system.

OLR holds information on it such as CRS_HOME, GPnP details, active version, localhost version, OCR latest backup(with time & location), Node name.,., .
Location Of OCR & OLR:

#cat /etc/oracle/ocr.loc –> OCR file Details.
ocrconfig_loc=<+ASM_Location>
local_only=FALSE

# cat /etc/oracle/olr.loc –> OLR file Details.
olrconfig_loc=<file_name_with_location.olr>
crs_home=<CRS_HOME_Location>

Useful Commands:

NOTE: Some commands like restore need bounce of services. Please verify before taking any action.

ocrconfig –showbackup –> OCR file backup location
ocrconfig –export < File_Name_with_Full_Location.ocr > –> OCR Backup
ocrconfig –restore <File_Name_with_Full_Location.ocr> –> Restore OCR
ocrconfig –import <File_Name_With_Full_Location.dmp> –> Import metadata specifically for OCR.
Ocrcheck –details –> Gives the OCR info in detail
ocrcheck –local –> Gives the OLR info in detail
ocrdump –local <File_Name_with_Full_Location.olr> –> Take the dump of OLR.
ocrdump <File_Name_with_Full_Location.ocr> –> Take the dump of OCR.

What is the Voting Disk and how is this Used?
If a node joins cluster, if a node fails (may be evicted), if VIP need to be assigned in case of GNS is configured. In all the cases, voting disk comes into picture. Voting disk saves the info of which nodes were part of cluster. While starting the crs services, with the help of OCR, it will vote in the voting disk (Nothing but mark attendance in the cluster)

We need not take the backup of the voting disk periodically like our cron jobs. We are supposed to take backup only in SOME of the below cases.

There are two different jobs done by voting disk.

Dynamic – Heart beat information
Static – Node information in the cluster
Useful Commands:

dd if=Name_Of_Voting_Disk of=Name_Of_Voting_Disk_Backup –> Taking backup of voting disk
crsctl query css votedisk –> Check voting disk details.
crsctl add css votedisk path_to_voting_disk –> To add voting disk
crsctl add css votedisk –force –> If the Cluster is down
crsctl delete css votedisk <File_Name_With_Password_With_file_name> –> Delete Voting disk
crsctl delete css votedisk –force –> If the cluster is down
crsctl replace votedisk <+ASM_Disk_Group> –> Replace the voting disk.

What is CRS?
CRSD stands for Cluster Resource Service Daemon. It is a proce–> which is responsible to monitor, stop, start & failover the resources. This process maintains OCR and this is responsible for restarting resource when any failover is about to take place.

Useful Commands:

crs_stat –t –v –> Check crs resources
crsctl stat res -t –> Check in a bit detail view. BEST ONE.
crsctl enable crs –> Enable Automatic start of Services after reboot
crsctl check crs –> Check crs Services.
crsctl disable crs –> Disable Automatic start of CRS services after reboot
crsctl stop crs –> Stop the crs services on the node which we are executing
crsctl stop crs –f –> Stop the crs services forcefully
crsctl start crs –> To start the crs services on respective node
crsctl start crs –excl –> To start the crs services in exclusive mode when u lost voting disk.
You need to replace the voting disk after you start the css.
crsctl stop cluster –all –> Stop the crs services on the cluster nodes
crsctl start cluster –all –> Start the crs services on all the cluster nodes.
olsnodes –> Find all the nodes relative to the cluster
oclumon manage –get master –> With this you will get master node information
cat $CRS_HOME/crs/init/<node_name>.pid –> Find PID from which crs is running.

What is CSSD?
CSSD stands for Cluster Synchronization Service Daemon. This is responsible for communicating the nodes each other. This will monitor the heart beat messages from all the nodes.

Example:

We have 2 node RAC cluster. Till one hour back, our CSSD is monitoring both the nodes and able to communicate each other. Now, if one of the node is down, CRS should know that one of the node is down. This information is provided by CSSD process.

Simple Scenario:

If both the nodes are up & running now. And due to one of the communication channel, CSSD process got information that the other node is down. So, in this case, new transactions cannot be assigned to that node. The node eviction will be done. And the node which is running now will be taking the ownership as master node.

This sample scenario was taken for a better understanding ONLY.

Useful Commands:
crsctl stop css–> For stopping the css
crsctl disable css –> Disabling automatic startup after reboot.

What is CTTSD?
CTTSD stands for Cluster Time Synchronization Service Daemon. This service by default will be in observer mode. If time difference is there, it won’t be taking any action. To run this service in active mode, we need to disable all the time synchronization services like NTP (Network Time Protocol). But, it is recommended as per my knowledge to keep this service in observer mode. This line was quoted because, if this service is in online mode. And time synchronization difference is huge, the cttsd process may terminate. And sometimes, crsd fail to startup due to time difference.

Useful Commands:
cluvfy comp clocksync -n all -verbose –> To check the clock synchronization across all the nodes
crsctl check ctts –> Check the service status & timeoffset in msecs.

What is VIP?
VIP stands for Virtual IP Address. Oracle uses VIP for Database level access. Basically, when a connection comes from application end. Then using this IP address, it will connect. Suppose if IP for one of the node is down. As per protocol timeout, it need to wait 90 seconds to get a session. In this scenario, VIP comes into picture. If one of the VIP is down, connections will be routed only to the active node. The VIP must be on same address as public IP address. This VIP is used for RAC failover and RAC management.

Useful Commands:
srvctl start vip –n <node_name> -i <VIP_Name> –> To start VIP
srvctl stop vip –n <node_name> -i <VIP_Name> –> To stop VIP
srvctl enable vip -i vip_name –> Enable the VIP.
srvctl disable vip -i vip_name –> Disable the VIP.
srvctl status nodeapps –n <node_name> –> status of nodeapps
srvctl status vip –n <node_name> –> status of vip on a node

What is SCAN IP & Listener?
SCAN stands for Single Client Access Name. Scan IP’s must be on same sub net mask. Three SCAN IP’s is a recommended number of count which redirects user sessions to the scan listeners. Load balancing on scan listener will be done by least_recently_loaded algorithm.

SCAN Listener… When a connection is initiated from the application end, scan listener verifies the load balancing. And once it gets info, it will assign the connection to the node listener. And user can do his transaction.

Main use is that we need not change the connect string in the application servers if any changes on the cluster are done like adding a node, deleting a node and other modifications basing on requirement.

Useful Commands:
srvctl config scan –> retrieves scan listener configuration
srvctl config scan_listener –> List of scan listeners with Port number
srvctl add scan –n <node_name> –> Add a scan listener to the cluster
srvctl add scan_listener –p <Desired_port_number> –> to add scan listener on specific port
SQL> SHOW PARAMETER REMOTE_LISTENER; –> find the list of scan listeners
srvctl stop scan –> stops all scan listeners when used without –i option
srvctl stop scan_listener –> Stops one or more services in the cluster
srvctl start scan –> To start the scan VIP
srvctl start scan_listener –> Start the scan listener.
srvctl status scan –> verify scan VIP status
srvctl status scan_listener –> Verify scan listener status.
srvctl modify scan_listener –> Modify the scan listener
srvctl relocate scan_listener –i <Ordinal_Number> –n <node_name> –> relocate the scan listener to another node.

What is ologgerd?
Ologgerd stands for cluster logger service Daemon. This is otherwise called as cluster logger service. This logger services writes the data in the master node. And chooses other nodes as standby. If any network issue occurs between the nodes, and if it is unable to contact the master. Then the other node takes ownership & chooses a node as standby node. This master will manage the operating system metric database in CHM repository.

Useful Commands:
Oclumon manage –get master –> Find which is the master node
oclumon manage -get reppath –> Will get the path of the repository logs
oclumon manage -get repsize –> This will give you the limitations on repository size
Oclumon showobjects –>find which nodes are connected to loggerd
Oclumon dumpnodeview –> This will give a detail view including system, topconsumers, processes, devices, nics, filesystems status, protocol errors.
oclumon dumpnodeview -n <node_1 node_2 node_3> -last “HH:MM:SS” –> you can view all the details in c. column from a specific time you mentioned.
oclumon dumpnodeview allnodes -last “HH:MM:SS” –> If we need info from all the nodes.11.What is sysmon?
This process is responsible for collecting information in the local node. This will collect the info from every node and that data will be sent the data to master loggerd. This will send the info like CPU, memory usage, Os level info, disk info, disk info, process, file system info.

What is evmd?
Evmd stands for Event Volume Manager Daemon. This handles event messaging for the processes. It sends and receives actions regarding resource state changes to and from all other nodes in a cluster. This will take the help of ONS(Oracle Notification Services).

Useful Commands:

evmwatch -A -t “@timestamp @@” –> Get events generated in evmd.
Evmpost –u “<Message here>” –h <node_name> –> This will post message in evmd log in the mentioned node.

What is mdnsd?
Mdnsd stands for Multicast Domain Name Service. This process is used by gpndp to locate profiles in the cluster as well as by GNS to perform name resolutions. Mdnsd updates the pid file in init directory.

What is ONS?
ONS stands for Oracle Notification Service. ONS will allow users to send SMS, emails, voice messages and fax messages in a easy way. ONS will send the state of database, instance. This state information is used for load balancing. ONS will also communicate with daemons in other nodes for informing state of database.

This is started as part of CRS as part of nodeapps. ONS will run as a node application. Every node will have its own ONS configured.

Useful Commands:

srvctl status nodeapps –> Status of nodeapps
cat $ORACLE_HOME/opmn/conf/ons.config –> Check ons configuration.
$ORACLE_HOME/opmn/logs –> ONS logs will be in this location.

what is OPROCD ?
OPROCD stands for Oracle Process Monitor Daemon. Oprocd monitors the system state of cluster nodes. Stonith, which is nothing but power cycling the node. Simply, means power off & power on the server using reboot command. And main change in OPROCD is cssd agent from 11gR2.

Useful Commands:

CRS_HOME/oprocd stop –> To stop the processon single node.

What is FAN?
FAN stands for Fast Application Notification. If any state change occurs in cluster/instance/node, an event is triggered by the event manager and it is propogated by ONS. The event is known as FAN event. It was the feature which was introduced in Oracle 10g for an immediate notification. FAN uses ONS for notifying.

Useful Commands:

onsctl ping –> To check whether ons is running or not.
onsctl debug –> Will get detail view of ons.
onsctl start –> Start the daemon.
onsctl stop –> Stop the daemon.

What is TAF?
TAF stands for Trasparent Application Failover. When any rac node is down, the select statements need to failover to the active node. And insert, delete, update and also Alter session statements are not supported by TAF. Temporary objects & pl/sql packages are lost during the failover.

There are two types of failover methods used in TAF.

Basic failover: It will connect to single node. And no overload will be there. End user experiences delay in completing the transaction.
Preconnect failover: It will connect to primary & backup node at at time. This offers faster failover. An overload will be experienced as statement need to be ready to complete transaction with minimal delay.
Useful Commands:

Add a service:
Srvctl add service –d <database_name> -s <Name_for_service> -r <instance_names> -p <Policy_specification>
Policy specification – none, basic, preconnect

2.Check TAF status:
SELECT machine, failover_type, failover_method, failed_over, COUNT(*) FROM gv$session GROUP BY machine, failover_type, failover_method, failed_over;

What is FCF?

FCF stands for Fast Connection Failover. It is an application level failover process. This will automatically subscribes to FAN events and this will help in immediate reaction on the up & down events from the database cluster. All the failure applications are cleaned up immediately, so that the application will receive a failure message. And after cleanup, if new connection is received then with load balancing it will reach active node. As said, this is application level process I am not discussing much.

What is GCS(LMSn)?

GCS stands for Global Cache Service. GCS catches the information of data blocks, and access privileges of various instances. Integrity is maintained by maintaining global access. It is responsible for transferring blocks from instance to another instance when needed.

Clear Understanding: Blocks of table “A” were retrieved with a connection to second node. Now, if first node requests blocks from this table, services need not pick the data from the datafiles. Blocks can be retrieved from other instance. This is the main use of GCS.

What is GES(LMD)?

GES stands for Global Enqueue Service. GES controls library and dictionary caches on all the nodes. GES manages transaction locks, table locks, library cache locks, dictionary cache locks, database mount lock.

21. What is GRD?

GRD stands for Global Resource Directory. This is to record the information of resources and enqueues. As the word, it stores info on all the information. Information like Data block identifiers, data block mode(shared, exclusive, null), buffer caches will be having access.

22. What is GPNPD?

GPNPD stands for Grid Plug aNd Play Daemon. A file is located in CRS_HOME/gpnp/<node_name>/profile/peer/profile.xml which is known as GPNP profile. And this profile consists of cluster name, hostname, ntwork profiles with IP addresses, OCR. If we do any modifications for voting disk, profile will be updated.

Useful Commands:

gpnptool ver -> Check the version of tool.
gpnptool lfind ->  get local gpnpd server.
gpnptool get -> read the profile
gpnptool lfind -> check daemon is running on local node.
gpnptool check –p= CRS_HOME/gpnp/<node_name>/profile/peer/profile.xml -> Check whether configuration is valid.
23. why is Diskmon?

Disk monitor daemon continuously runs when ocssd starts. And it monitors and performs I/O fencing for Exadata storage server (This server is termed as cell as per Exadata). This process will run since the ocssd starts because exadata cell can be added to any cluster at any time.

Useful Commands:

./crsctl stat res ora.diskmon <– To check diskmon status.

Export or import with advantages?

Export or import with advantages?


What happens when we export data from a database?
Before going into the topic, you should note some things. Export means using select statement from source(backup). And import means using the insert statement (restore).

The export utility will simply prepare a set of sql statements and execute them against the target database.
The data that is returned by the select operation(definition and rows of the objects) will be written to a file known as the dump file. The extension of the dump file is “.dmp”.
This dump file is platform independent and can be carried to any other oracle site.
DBA can import the objects from the dump file into database when required.
Import file reads the definition from dump file and creates the objects there after.
It executes insert statements from the dump file against the database and loads the data back into the database objects that were created from the datafile.

Advantages of export and import:

We can backup and restore a particular object(table).
These are used to copy objects from one oracle schema to another.
For performing an oracle database from one operating system to another(like windows to linux), then logical backups are the only way to do that using dump file.
We can export(backup) and import(restore) objects without shutting down the database.
Whenever we upgrade the oracl le versions like 8i to 9i, oracle will automatically upgrade the database. But, still we need to export full database before we begin the upgrade process.  This is because, if upgrade fails then exp will be helpful.
Export helps in performing a database re-org. After using database for a while, it gets fragmented with some segments relating to so many extents. This will result in poor I/O performance. For this, we follow some steps.

1. Full Database Export.
2. Drop the Database.
3. Create a Brand New Database.
4. Full Database Import

At the end of the import, all the segments will be back within single huge extents and we will get rid of all fragmentation.
Exports can be done at table level, schema level, tablespace level or full database.
While exporting a table we can mention the query option from 8i onwards, example export the emp table where the deptno=10
If the database is too large the dump file can run into GB and this much space may not be available. In a single file system, thus we can export the data to multiple files spanning across multiple files.
The size of an export dump file is usually 6 to 10 times smaller than the size of the database.

why??????????

1.  Control file, redolog file are not exported
2. Export does not carry any base tables(objects owned by sys user)
3. The temporary segments are ignored.
4. Undo and rollback segments are ignored as we are interested only in committed data.
5. Only table data goes into the dump file along with the table definitions

Time taken for exp:imp is usually 1:6 ratio as export is only a select operation where as import is a combination of DML+DDL operations and each line goes through the undo or rollback segments. And also goes to logfiles.
Import operation will cause a lot of redo activity and hence log switching will occur.

Differences Between traditional exp/imp and datapump

Differences Between traditional exp/imp and datapump


1)Impdp/Expdp has self-tuning utilities. Tuning parameters that were used in original Export and Import, such as BUFFER and RECORDLENGTH, are neither required nor supported by Data Pump Export and Import.

2)Data Pump represent metadata in the dump file set as XML documents rather than as DDL commands.

3)Impdp/Expdp use parallel execution rather than a single stream of execution, for improved performance.

4)In Data Pump expdp full=y and then impdp schemas=prod is same as of expdp schemas=prod and then impdp full=y where in original export/import does not always exhibit this behavior.

5)Expdp/Impdp access files on the server rather than on the client.

6)Expdp/Impdp operate on a group of files called a dump file set rather than on a single sequential dump file.

7)Sequential media, such as tapes and pipes, are not supported in oracle data pump.But in original export/import we could directly compress the dump by using pipes.

8)The Data Pump method for moving data between different database versions is different than the method used by original Export/Import.

9)When you are importing data into an existing table using either APPEND or TRUNCATE, if any row violates an active constraint, the load is discontinued and no data is loaded. This is different from original Import, which logs any rows that are in violation and continues with the load.

10)Expdp/Impdp consume more undo tablespace than original Export and Import.

11)If a table has compression enabled, Data Pump Import attempts to compress the data being loaded. Whereas, the original Import utility loaded data in such a way that if a even table had compression enabled, the data was not compressed upon import.

12)Data Pump supports character set conversion for both direct path and external tables. Most of the restrictions that exist for character set conversions in the original Import utility do not apply to Data Pump. The one case in which character set conversions are not supported under the Data Pump is when using transportable tablespaces.

13)There is no option to merge extents when you re-create tables. In original Import, this was provided by the COMPRESS parameter. Instead, extents are reallocated according to storage parameters for the target table.

Basic DBA Faq's

Basic DBA Faq's



What is Log Switch?
The point at which ORACLE ends writing to one online redo log file and begins writing to another is called a log switch.

What is On-line Redo Log?
The On-line Redo Log is a set of tow or more on-line redo files that record all committed changes made to the database. Whenever a transaction is committed, the corresponding redo entries temporarily stores in redo log buffers of the SGA are written to an on-line redo log file by the background process LGWR. The on-line redo log files are used in cyclical fashion.

Which parameter specified in the DEFAULT STORAGE clause of CREATE TABLESPACE cannot be altered after creating the tablespace?
All the default storage parameters defined for the tablespace can be changed using the ALTER TABLESPACE command. When objects are created their INITIAL and MINEXTENS values cannot be changed.

What are the steps involved in Database Startup?
Start an instance, Mount the Database and Open the Database.

What are the steps involved in Instance Recovery?
Rolling forward to recover data that has not been recorded in data files, yet has been recorded in the on-line redo log, including the contents of rollback segments. Rolling back transactions that have been explicitly rolled back or have not been committed as indicated by the rollback segments regenerated in step a. Releasing any resources (locks) held by transactions in process at the time of the failure. Resolving any pending distributed transactions undergoing a two-phase commit at the time of the instance failure.

Can Full Backup be performed when the database is open?
No.

What are the different modes of mounting a Database with the Parallel Server?
Exclusive Mode If the first instance that mounts a database does so in exclusive mode, only that Instance can mount the database. Parallel Mode If the first instance that mounts a database is started in parallel mode, other instances that are started in parallel mode can also mount the database.

What are the advantages of operating a database in ARCHIVELOG mode over operating it in NO ARCHIVELOG mode?
Complete database recovery from disk failure is possible only in ARCHIVELOG mode. Online database backup is possible only in ARCHIVELOG mode.

What are the steps involved in Database Shutdown?
Close the Database, Dismount the Database and Shutdown the Instance.

What is Archived Redo Log?
Archived Redo Log consists of Redo Log files that have archived before being reused.

What is Restricted Mode of Instance Startup? – An instance can be started in (or later altered to be in) restricted mode so that when the database is open connections are limited only to those whose user accounts have been granted the RESTRICTED SESSION system privilege.

What is Partial Backup?
A Partial Backup is any operating system backup short of a full backup, taken while the database is open or shut down.

What is Mirrored on-line Redo Log?
A mirrored on-line redo log consists of copies of on-line redo log files physically located on separate disks, changes made to one member of the group are made to all members.

What is Full Backup?
A full backup is an operating system backup of all data files, on- line redo log files and control file that constitute ORACLE database and the parameter.

Can a View based on another View?
Yes.

Can a Tablespace hold objects from different Schemes?
Yes.

Can objects of the same Schema reside in different tablespaces?
Yes.

What is the use of Control File?
When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery.

Do View contain Data?
Views do not contain or store data.

What are the Referential actions supported by FOREIGN KEY integrity constraint?
UPDATE and DELETE Restrict – A referential integrity rule that disallows the update or deletion of referenced data. DELETE Cascade – When a referenced row is deleted all associated dependent rows are deleted.

What are the type of Synonyms?
There are two types of Synonyms Private and Public

What is a Redo Log?
The set of Redo Log files YSDATE,UID,USER or USERENV SQL functions, or the pseudo columns LEVEL or ROWNUM.

What is an Index Segment?
Each Index has an Index segment that stores all of its data.

Explain the relationship among Database, Tablespace and Data file.?
Each databases logically divided into one or more tablespaces one or more data files are explicitly created for each tablespace

What are the different type of Segments?
Data Segment, Index Segment, Rollback Segment and Temporary Segment.

What are Clusters?
Clusters are groups of one or more tables physically stores together to share common columns and are often used together.

What is an Integrity Constrains?
An integrity constraint is a declarative way to define a business rule for a column of a table.

What is an Index?
An Index is an optional structure associated with a table to have direct access to rows, which can be created to increase the performance of data retrieval. Index can be created on one or more columns of a table.

What is an Extent?
An Extent is a specific number of contiguous data blocks, obtained in a single allocation, and used to store a specific type of information.

What is a View?
A view is a virtual table. Every view has a Query attached to it. (The Query is a SELECT statement that identifies the columns and rows of the table(s) the view uses.)

What is Table?
A table is the basic unit of data storage in an ORACLE database. The tables of a database hold all of the user accessible data. Table data is stored in rows and columns.

What is a Synonym?
A synonym is an alias for a table, view, sequence or program unit.

What is a Sequence?
A sequence generates a serial list of unique numbers for numerical columns of a database and its tables.

What is a Segment?
A segment is a set of extents allocated for a certain logical structure.

What is schema?
A schema is collection of database objects of a User.

Describe Referential Integrity?
A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the value for the column or set of columns (the dependent value) matches a value in a column of a related table (the referenced value). It also specifies the type of data manipulation allowed on referenced data and the action to be performed on dependent data as a result of any action on referenced data.

What is Hash Cluster?
A row is stored in a hash cluster based on the result of applying a hash function to the row and its cluster key value. All rows with the same hash key value are stores together on disk.

What is a Private Synonyms?
A Private Synonyms can be accessed only by the owner.

What is Database Link?
A database link is a schema object in one database that enables you to access objects on another database

What is a Tablespace?
A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related logical structures together

What is Rollback Segment?
A Database contains one or more Rollback Segments to temporarily store “undo” information.

What are the Characteristics of Data Files? – A data file can be associated with only one database. Once created a data file can’t change size. One or more data files form a logical unit of database storage called a tablespace.

How to define Data Block size?
A data block size is specified for each ORACLE database when the database is created. A database users and allocated free database space in ORACLE datablocks. Block size is specified in INIT.ORA file and can’t be changed later.

What does a Control file Contain?
A Control file records the physical structure of the database. It contains the following information. Database Name Names and locations of a database datafiles and redolog files. Time stamp of database creation. When is hot backup taken. Rman config details.

What is difference between UNIQUE constraint and PRIMARY KEY constraint?
A column defined as UNIQUE can contain Nulls while a column defined as PRIMARY KEY cannot contain Nulls.

What is Index Cluster?
A Cluster with an index on the Cluster Key 48.When does a Transaction end? – When it is committed or Rollbacked.

What are the factors that affect OPTIMIZER in choosing an Optimization approach?
The OPTIMIZER_MODE initialization parameter Statistics in the Data Dictionary the OPTIMIZER_GOAL parameter of the ALTER SESSION command hints in the statement.

What is the effect of setting the value ALL_ROWS for OPTIMIZER_GOAL, parameter of the ALTER SESSION Command?
The Optimizer chooses Cost_based approach and optimizes with the goal of best throughput if statistics for atleast one of the tables accessed by the SQL statement exist in the data dictionary. Otherwise the OPTIMIZER chooses RULE_based approach.

What is the function of Optimizer?
The goal of the optimizer is to choose the most efficient way to execute a SQL statement.

What is Execution Plan?
The combinations of the steps the optimizer chooses to execute a statement is called an execution plan.

What are the different approaches used by Optimizer in choosing an execution plan?
Rule-based and Cost-based.