Oracle

October 12, 2017 | Author: G.R.THIYAGU ; Oracle DBA | Category: Relational Database, Oracle Database, Databases, Relational Model, Sql
Share Embed Donate


Short Description

Download Oracle...

Description

10g Database Administration BASICS

Data  Data is nothing piece of Information , that needs to be stored.  In computer term, data is referred as Information.  It should be performed for any business.  It is stored on Computer system.

Database  Database is any organized collection of data.  Collection of related information stored in an organized manner.  Purpose is Store and Retrieve information.  Database must implement the SQL request.  It needs to be Stored, Organized, Accessed, Protected & Manipulated.  ACID Model is one of the most important concepts of Database Theory.

Acid Model  ACID refers basic properties of Database transaction.  Atomicity All or nothing , entire transaction fails if part of query fails.  Consistency Only valid data is written to database.  Isolation Multiple simultaneous transactions don’t impact each other  Durability Committed transactions to database will never be lost.

Database components & It’s objects  Tables , Queries , Forms , Reports , Pages, Macros & Modules.  Table , View , Sequence , Index , Synonym  Objects

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 1

10g Database Administration BASICS

DBS  DBS Stands for Data Base System.  It is also called as DBMS , collection of records stored into the database  Database & DBMS software together called as Data Base System.

Functions of DBMS  Data definitions  Data manipulations  Multiuser access control  Data Security & Data Integrity  Data Dictionary & Performance  Data Backup , Recovery & Concurrency  Data transformation & presentation  Database language & Application programming interfaces.  Database communication Interfaces & Storage management.

DBMS Disadvantages  Cost of Data conversion and can’t be organize complex data easily.  Migration , Software & Hardware is high Cost.  Power dependency - Database damage.  DBMS software’s are complex and internal training required to staffs.  Possible for some un authorized users to access the database.  Implementing a DBMS can be more expensive, especially for largest organizations. (FILE PROCESSING SYSTEM to DBMS)

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 2

10g Database Administration BASICS

RDBMS Entry  RDBMS = DBMS + REFERENTIAL INTEGRITY  In 1970 , Codd introduced theory of relational database.  Thirteen rules defined by codd for RDBMS.  RDBMS manages relationship among multiple tables .

Ted Codd Rules for Relational Databases Codd's idea for an RDBMS uses the mathematical concepts of relational algebra to break down data into sets and related common subsets. 1. Information rule All information in the relational database to be represented in one and only one way, namely by values in column positions within rows of tables. 2. Guaranteed access rule This rule is essentially a restatement of the fundamental requirement for primary keys. It says that every individual scalar value in the database must be logically addressable by specifying the mane of the containing table, the name of the containing column and the primary key value of the containing row. 3. Systematic treatment of null values The DBMS is required to support a representation of "missing information and inapplicable information" that is systematic, distinct from all regular values (for example, "distinct from zero or any other number," in the case of numeric values), and independent of data type. It is also implied that such representations must be manipulated by the DBMS in a systematic way. ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 3

10g Database Administration BASICS 4. Active online catalog based on the relational model The system is required to support an online, inline, relational catalog that is accessible to authorized users by means of their regular query language. 5. Comprehensive data sublanguage rule The system must support a least one relational language that (a) has a linear syntax, (b) can be used both interactively and within application programs, and (c) supports data definition operations (including view definitions), Data manipulation operations (updates well as retrieval), security & integrity constraints and transaction management operations (begin, commit , and rollback ). 6. View updating rule All views that are theoretically updatable must be updatable by the system. 7. High-level insert, update, and delete The system must support set-at-a-time INSERT, UPDATE & DELETE operators. 8. Physical data independence Application programs and ad hoc programs are logically unaffected when physical access methods or storage structures are altered. 9. Logical data independence Logical data independence--Application programs and ad hoc programs are logically unaffected, to the extent possible, when changes are made to the table structures.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 4

10g Database Administration BASICS 10. Integrity independence Integrity constraints must be specified separately from application programs and stored in the catalog. It must be possible to change such constraints as and when appropriate without unnecessarily affecting existing applications. 11. Distribution independence Existing applications should continue to operate successfully (a) when a distributed version of the DBMS is first introduced; (b) when existing distributed data is redistributed around the system. 12. The non subversion rule If the system provides a low-level (record-at-a-time) interface, then that interface cannot be used to subvert the system (e.g.) bypassing a relational security or integrity constraint.

Characteristics of Relational Database  Data is stored in database as set of tables.  Tables are joined by relational links.  Reduces duplication data in database.  Allows greater flexibility and efficiency.  Database divided into number of tables.  Tables are connected through a Key field.  Key field is column in the table. (emp_id)  This is needed to organize complex data.  Can communicate with RDBMS using Structured Query Language.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 5

10g Database Administration BASICS

Table

e Table

Table

Table

Table

Table

Table

Table

Table

Table

Key Field Table

Table

Fig: Relational Database model

RDBMS  RDBMS stands for Relational Database Management System.  Designed by E.F Codd year of 1970.  Relational Model is based on relational algebra.  RDBMS follows ACID property. Relational Database  Multi table.  Relational model represents data in the form of table.  Data’s are stored as rows and columns in multiple tables.  Table is two dimensional array contains ROWS & Columns.  RDBMS stores data in tables with relationships to other tables.  RDBMS makes data to be relational between multiple tables.  Normalization works to check database table consistency.

 Foregin key concept is supported by RDBMS it enforces the rule  Tables having relationship to each other tables connected through keyfield.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 6

10g Database Administration BASICS

Table / Relation

Emp Id

Name

Qualification

10000

San

MCA

10002

Sam

MBA

10003

Sams

MSIT Tuple/row

Attribute / Column Fig: Table in relational model

Internal working access data’s are relational manner that is RDBMS. Main advantage of an RDBMS is that it checks for referential integrity (relationship between related records using Foreign Keys). You can set the constraints in an RDMBS such that when a particular record is changed, related records are updated / deleted automatically.

RDBMS Terminology Relational Term

Informal Equivalents

Relation , Entity

Table

Tuple

Row , Record

Cardinality

No of rows

Attribute

Column , Field

Degree

No of columns

Primary key

Unique Identifier

Domain

Set of legal values

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 7

10g Database Administration BASICS

Is Oracle RDBMS or ORDBMS ?? Oracle Database is an RDBMS , it implements object-oriented features such as user defined types, inheritance & polymorphism. Oracle is called an object relational database management system. Oracle extended the relational model to an object relational model , it possible to store complex business models in a relational database. An ORDBMS (Object Relational Database Management System) is a hybrid DBMS system that can be used as both an Object Database Management System ODBMS , and a Relational Database Management System RDBMS So Oracle database is an example of an ORDBMS

Significant Features of Oracle Grid computing , Robust , Scalability and Performance , Backup & Recovery , Open connectivity , Space management , Security Mechanism Tools and applications etc .., Oracle is the world's most complex and flexible database.

Oracle 10g Features  Comes with two versions 10.1 & 10.2  10.1.0 Released in Jan 2003 , 10.2.0 Released July 2005  G stands for Grid Computing.  It comes with both Grid and Rac.  It has 149 new features.  Most popular will be Model Clause & Table space Transportable.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 8

10g Database Administration BASICS

Some Features given below  Automatic Database Diagnostic Monitor  Automatic Shared Memory Management  Automatic undo tuning  Automatic Workload Repositoty  Automatic Storage managent  Automatic Maintenance tasks  Bigfile Tablespaces  Drop Database  Default Permanent Table space  Enhanced Enterprise Manager  Flush buffer cache  HTML DB  Introducing Datapump  New Flashback Features  New (bunch of)wait events  New Initialization Parameters  Optimizer Statistics Gathering  Redo logfile size Advisor  Rename Tablespace  Segment Shrink  Server Alerts  Sql Tuning Advisor  Sql Access Advisor  Skip Unusable Indexes

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 9

10g Database Administration BASICS  Simplified Oracle10g installation  Transparent Data Encryption  Temporary tablespace group  Transport tablespace across Platforms  Undo Advisor

Comparison between 10.1 and 10.2 Installation , Server configuration and Database upgrades.

Version

10.1

10.2

Supported Parameters

255

258

Unsupported Parameters

918

1127

Dynamic Performance Views (V$)

340

396

Fixed Views (X$)

529

597

Events (Waits)

811

874

Statistics

332

363

Latches

348

382

Background Processes (Fixed SGA)

109

157

GRID Computing Grid computing enables the creation of a single IT infrastructure that can be shared by multiple business processes. Oracle software is specifically designed for grid computing, delivering a higher quality of service to those business processes at a much lower cost.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 10

10g Database Administration BASICS

Relational model has three major aspects. Relational database conforms to the relational model. Structures - are well-defined objects (tables, views, indexes, and so on) that store or access the data of a database. Operations - are clearly defined actions that allow users to manipulate the data and structures of a database. Integrity Rules - protects the data and the structure of a database and governs operation on the data and structures of a database

SQL SQL means Structured Query Language. Originally developed for IBM’s (DB2) product in IBM laboratory. SQL pronounced (“ess-que-el”) not sequel. 1970 IBM invented high level database language is called SQL. Sql enables to select, insert, modify & delete the information in a database. Sql Performs system security functions & set user permissions on tables and databases. It handles online transaction processing within an application. SQL transfers data between different

databases. SQL's greatest benefits are that it is truly a

cross-platform language and a cross-product language. GUI tools for sql TOAD, SQL Developer. Sql allows to modify structure of the database can easily create new database objects such as tables, indexes, views, sequences … STATIC SQL Statement can’t be altered at run time. Statements are hard coded in the program and executed “as-is” at runtime. Static sql is faster and more secure than dynamic sql. Dynamic Sql statements is constructed and executed at program execution time. Dynamic sql provides more flexibility. SQL3 is an extension of the SQL standard that supports object-relational extensions. SQL3 was finalized in 1999. ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 11

10g Database Administration BASICS

SQL Naming Rules …. Table names and Column names  Must begin with a letter  Must be 1 to 30 characters long  Must contain only A-Z,a-z,0-9,_, $ and #  Must not be an Oracle Server reserved words  Must not duplicate name of the another object owned by the same user  SQL KEYWORDS can’t be used as an identifier, no embedded spaces are allowed in identifiers.

Queries & SQL* Plus Queries are used to select or extract data from a database. Extracting data from the database by using SQL is termed called querying the database. SQL * Plus is an interactive and batch query tool that is installed with every Oracle Database Server or Client installation. It has a command-line user interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus webbased user interface.

User vs. Schema If oracle _user has objects then call it SCHEMA else call it USER END IF; SCOTT is schema that includes EMP, DEPT, BONUS tables with various grants. SYS is schema that includes tons of tables, views, grants etc. Technically ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 12

10g Database Administration BASICS a schema is set of metadata (data dictionary) used by database. Schema is collection of database objects including logical structures owned bySpecific user. Objects including tables, indexes, views, stored-procedures etc,.. create user command creates user, can create objects. create schema will not create schema. It allows to create multiple tables views etc. DDL, DML, DCL, TCL commands DDL Statements are used to define the database structure or schema.  CREATE - to create objects in the database  ALTER - alters the structure of the database  DROP - delete objects from the database  TRUNCATE - remove all records from a table except table structure  COMMENT - add comments to the data dictionary  RENAME - rename an object DML statements are used for managing data within schema objects.  SELECT - retrieve data from the a database  INSERT - insert data into a table  UPDATE - updates or adding any data within a table, specified columns  DELETE - deletes all records from a table, space for the records remain  MERGE- (UPSERT) operation (insert or update)  CALL - call a PL/SQL or Java subprogram  EXPLAIN PLAN - explain access path to data  LOCK TABLE - control concurrency SELECT  Oracle still recommends to consider SELECT as DML command not data retrieval (DRL) command.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 13

10g Database Administration BASICS DCL Statements – almost belongs Database administration privilege’s  GRANT - gives user's access privileges to database  REVOKE - withdraw access privileges given with the GRANT command TCL Commands are used to manage changes made by DML commands  COMMIT - save work done  SAVEPOINT - identify a point in a transaction to which can later roll back  ROLLBACK - restore database to original since the last COMMIT  SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use. Somemore points to remember :  GRANT- to allow specified users to perform specified tasks.  REVOKE- to cancel previously granted or denied permissions.  DDL commands are auto commit.  DBCC -(Database Console Commands) statements check the physical and logical consistency of a database.

ORACLE BASICS Explored by Thiyagu Gunasekaran

Page | 14

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF