Talip Hakan ÖZTÜRK BANKASYA – ORACLE DBA OCE, 10g OCA, 10g OCP Veritabanı Objeleri.

Slides:



Advertisements
Similar presentations
Oracle 10g & 11g for Dev Virtual Columns DML error logging
Advertisements

Talip Hakan ÖZTÜRK BANKASYA – ORACLE DBA OCE, 10g OCA, 10g/11g OCP Okuma Tutarlılığı.
BACS 485—Database Management Advanced SQL Overview Advanced DDL, DML, and DCL Commands.
Manipulating Data Schedule: Timing Topic 60 minutes Lecture
Database Programming Sections 13. Marge Hohly  1. Which statements are True about the following sequence? The sequence was used to generate numbers.
10 Copyright © 2004, Oracle. All rights reserved. Creating Other Schema Objects.
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
8 Copyright © Oracle Corporation, All rights reserved. Manipulating Data.
System Administration Accounts privileges, users and roles
Managing Schema Objects
Copyright  Oracle Corporation, All rights reserved. 9 Manipulating Data: INSERT, UPDATE, DELETE.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
9 Copyright © 2009, Oracle. All rights reserved. Managing Data Concurrency.
Adapted from Afyouni, Database Security and Auditing DB Auditing Examples (Ch. 9) Dr. Mario Guimaraes.
SQL's Data Definition Language (DDL) – View, Sequence, Index.
Introduction to DBMS and SQL Introduction to DBMS and SQL GUIDED BY : MR. YOGESH SAROJ (PGT-CS) MR. YOGESH SAROJ (PGT-CS) Presented By : JAYA XII –COM.
Chapter 6 Additional Database Objects
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Objectives After completing this lesson, you should be able to do the following: Categorize the main database objects Review the table structure List.
Copyright © 2004, Oracle. All rights reserved. Lecture 3: Creating Other Schema Objects Lecture 3: Creating Other Schema Objects ORACLE.
Oracle Database Administration
Other database objects (Sequence). What Is a Sequence? A sequence: Automatically generates sequential numbers Is a sharable object Is typically used to.
11 Copyright © 2007, Oracle. All rights reserved. Creating Other Schema Objects.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
ACTION QUERIES (SQL COMMANDS ) STRUCTURED QUERY LANGUAGE.
In Oracle.  A PL/SQL block stored in the database and fired in response to a specified event ◦ DML statements : insert, update, delete ◦ DDL statements.
20 Copyright © Oracle Corporation, All rights reserved. Oracle9 i Extensions to DML and DDL Statements.
11 Copyright © Oracle Corporation, All rights reserved. Creating Views.
Database Programming Sections 11 & 12 – Creating, and Managing Views, Sequences, Indexes, and Synonymns.
Roles & privileges privilege A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The.
Session 2: SQL (A): Parts 1 and 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram.
8 Copyright © 2005, Oracle. All rights reserved. Managing Data.
SQL: Advanced topics Prof. Weining Zhang Cs.utsa.edu.
8 Copyright © Oracle Corporation, All rights reserved. Manipulating Data.
Creating DDL and Database Event Triggers. 2 home back first prev next last What Will I Learn? Describe events that cause DDL and database event triggers.
Dec 8, 2003Murali Mani Constraints B term 2004: lecture 15.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
8 Copyright © 2007, Oracle. All rights reserved. Managing Schema Objects.
Manipulating Data. Objectives After completing this lesson, you should be able to do the following: Describe each DML statement Insert rows into a table.
9 Manipulating Data. 9-2 Objectives At the end of this lesson, you should be able to: Describe each DML statement Insert rows into a table Update rows.
2 Copyright © 2006, Oracle. All rights reserved. Managing Schema Objects.
Database Programming Sections 7–Multi-row sub queries, IN, ANY, ALL, Data Manipulation Language (DML) transaction, INSERT, implicit, explicit, USER, UPDATE,
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Chapter 12 Additional Database Objects. Chapter Objectives  Define the purpose of a sequence and state how it can be used by an organization  Explain.
DDL and Views. Database Objects Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage;
Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Views, Sequence, and Stored Procedure used in PosgreSQL.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Database Programming Sections 12 – Sequences, Indexes, and Synonymns.
Chapter 12Introduction to Oracle9i: SQL1 Chapter 12 Additional Database Objects.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
1 11g NEW FEATURES ByVIJAY. 2 AGENDA  RESULT CACHE  INVISIBLE INDEXES  READ ONLY TABLES  DDL WAIT OPTION  ADDING COLUMN TO A TABLE WITH DEFAULT VALUE.
Murali Mani Constraints. Murali Mani Keys: Primary keys and unique CREATE TABLE Student ( sNum int, sName varchar (20), dept char (2), CONSTRAINT key.
2 Copyright © 2009, Oracle. All rights reserved. Managing Schema Objects.
CS 3630 Database Design and Implementation
Managing Privileges.
Creating Database Triggers
SQL Stored Triggers Presented by: Dr. Samir Tartir
ITEC 313 Database Programming
Oracle Certified 1z0-047 Exam Questions
Creating Other Schema Objects
Creating Other Schema Objects
الأزنده أ.موضي المحرج.
Chapter 5 Sequences.
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Managing Privileges.
Triggers.
Database Programming Using Oracle 11g
Presentation transcript:

Talip Hakan ÖZTÜRK BANKASYA – ORACLE DBA OCE, 10g OCA, 10g OCP Veritabanı Objeleri Ölçülebilirlik & Performans

Talip Hakan ÖZTÜRK  Azerbaycan Teknik Üniversitesi – Bilgisayar Müh.  BANKASYA - Oracle DBA  OCE, 10g OCA, 10g OCP  Oracle Blogger   Oracle Forum Sorumlusu ve Editörü 

 Veritabanı Objeleri – Demo  Views  Constraints  DML Triggers  DDL Triggers  B*Tree Indexes  Bitmap Indexes  Function Based Indexes  Index Organized Tables  External Tables  Synonyms  Sequence  Okuma Tutarlılığı (Read Consistency)  Kilitler (Locks) Gündem

Views  Tablo joinleri içerebilirler.  DML? Simple CREATE OR REPLACE FORCE VIEW calisanlar_v AS SELECT c.employee_id, c.first_name, c.last_name, c.hire_date FROM calisanlar c; Complex CREATE OR REPLACE FORCE VIEW calisanlar_v (min_salary, department_name) AS SELECT min(c.salary),d.department_name FROM calisanlar c, departmanlar d WHERE c.department_id=d.department_id GROUP BY d.department_name;

Constraints ALTER TABLE calisanlar ADD ( CONSTRAINT salary_check CHECK ( NVL(salary,0) >= 1000 )); insert into calisanlar (first_name,last_name, ,salary) values  Tablonun ilgili alanına uygulanan kısıtlamadır.

DML Triggers create table calisanlar_log ( user_id varchar2(10), log_date date, action varchar2(1000) ); CREATE OR REPLACE TRIGGER calisanlar_kontrol_delete BEFORE DELETE ON calisanlar REFERENCING NEW AS new OLD AS old FOR EACH ROW DECLARE BEGIN raise_application_error(-20001,'Silme islemi yapamazsiniz! DBA ile gorusunuz!'); end; delete from calisanlar where employee_id=105; CREATE OR REPLACE TRIGGER calisanlar_kontrol_insert AFTER INSERT ON calisanlar REFERENCING NEW AS new OLD AS old FOR EACH ROW DECLARE BEGIN INSERT INTO calisanlar_log (user_id,log_date,action) VALUES (USER, SYSDATE, 'calisanlar tablosuna kayıt insert edildi'); end; insert into calisanlar (first_name,last_name, ,salary) values

DDL Triggers CREATE OR REPLACE TRIGGER logon_trig AFTER LOGON ON SCHEMA BEGIN INSERT INTO log_trig_table(user_id,log_date,action) VALUES (USER, SYSDATE, 'Logging on'); END; / create table log_trig_table ( user_id varchar2(10), log_date date, action varchar2(10) ); select * from log_trig_table;

B*Tree Indexes S DEU DEN ENG SCO SPA USAAUS BEL CAN Set autotrace on SELECT * FROM CALISANLAR WHERE EMPLOYEE_ID=105; CREATE INDEX CALISANLAR_ID_X ON CALISANLAR(EMPLOYEE_ID); --ALTER SYSTEM FLUSH SHARED_POOL; --ALTER SYSTEM FLUSH BUFFER_CACHE; analyze index CALISANLAR_ID_X compute statistics;

Bitmap Indexes create table bitmap_index_demo ( value varchar2(20) ); insert into bitmap_index_demo select decode(mod(rownum,2),0,'M','F') from all_objects; create bitmap index bitmap_index_demo_idx on bitmap_index_demo(value); -- birinci session insert into bitmap_index_demo values ('M'); -- ikinci session insert into bitmap_index_demo values ('F'); -- birinci session insert into bitmap_index_demo values ('F'); create table bitmap_index_demo1 as select * from bitmap_index_demo; insert into bitmap_index_demo1 select decode(mod(rownum,2),0,'M','F') from all_objects; create index bitmap_index_demo1_idx on bitmap_index_demo1(value); -- birinci session insert into bitmap_index_demo1 values ('M'); -- ikinci session insert into bitmap_index_demo1 values ('F'); -- birinci session insert into bitmap_index_demo1 values ('F');

Function Based Indexes CREATE INDEX CALISANLAR_ID_2X ON CALISANLAR(SALARY); CREATE INDEX CALISANLAR_ID_3X ON CALISANLAR(SALARY*10/100); SELECT * FROM calisanlar WHERE SALARY*10/100>=1000;

Index Organized Tables Veriler B*Tree index yapısında saklanır. create table iot_table ( id number primary key, name varchar2(5) ) organization index; create table normal_table ( id number primary key, name varchar2(5) ); insert into iot_table values(5,'a'); commit;

External Tables create or replace directory talipdir as '/oracle/ora11g'; as sysdba grant read,write on directory talipdir to talip; as sysdba create table dblist ( CI_name varchar2(20), ID varchar2(20), logical_name varchar2(20), dbname varchar2(20), thread number, type varchar2(20), subtype varchar2(20), environment varchar2(20) ) organization external ( default directory talipdir access parameters ( records delimited by newline fields terminated by ';' ) location ('dblist.csv') )REJECT LIMIT unlimited; select * from dblist order by ci_name desc;

Synonyms ALI. HESAP_NO HESAP_NO Public Synonym To ALI.HESAP_NO VELISELIMAYSE Select * from hesap_no;  Private Synonyms  Public Synonyms create synonym ygm_test.calisanlar for talip.calisanlar; create public synonym calisanlar for talip.calisanlar;

Sequence CREATE SEQUENCE calisan_id INCREMENT BY 1 START WITH 1 MAXVALUE 100 MINVALUE 1 NOCYCLE CACHE 20 ORDER;

Session 1Session 2 10:30 UPDATE scott.emp SET sal = sal+10 WHERE ename = 'KING'; 10:32 UPDATE scott.emp SET sal = sal+20 WHERE ename = 'KING'; 10:34commit ; 10:35commit; Read Consistency

Session 1Session 2 10:30 UPDATE scott.emp SET sal = 1000 WHERE ename = 'KING'; 10:32 SELECT sal FROM scott.emp WHERE ename = 'KING'; 10:35commit ; Read Consistency

Session 1Session 2 10:30 UPDATE scott.emp SET sal = 1000 WHERE ename = 'KING'; 10:32 UPDATE scott.emp SET sal = 1500 WHERE ename = 'KING'; 10:34commit; 10:35commit ; Read Consistency

Session 1: UPDATE scott.emp SET ename = 'KING1' WHERE ename = 'KING'; (don NOT commit) Session 2: SELECT ename FROM scott.emp WHERE ename='KING' FOR UPDATE OF ename wait 10; after 10 seconds : * ERROR at line 1: ORA-30006: resource busy; acquire with WAIT timeout expired DML Locks

Deadlocks

TEŞEKKÜRLER Talip Hakan ÖZTÜRK Bilgisayar Mühendisi Oracle Certified Professional 10g Oracle Certified Associate 10g Oracle Certified Expert