Oracle Tutorial (CS4347) TA Information –Name: Lidong Wu – –Office Hour:Tu. 3pm-4pm & Fr.

Slides:



Advertisements
Similar presentations
UIC Data Conversion and Submission via CDX Node Client UIC Database V2 6/16/
Advertisements

Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
Chapter 9 Auditing Database Activities
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
CS34311 CS3431 – Database Systems I Project Overview Elke A. Rundensteiner.
CS34311 CS3431 – Database Systems I Project Overview Murali Mani.
Concepts of Database Management Sixth Edition
Compe 341 Oracle Installation Procedure. Oracle From Click.
7/2/2015Murali Mani -- CS5421 Database Management Systems DB Application Development Project Statement + Introduction to Oracle.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Automating Student Course Profile & Student Record Report Uploads to GaDOE Chris A. McManigal Camden County Schools Kingsland, GA.
Overview What is SQL Server? Creating databases Administration Security Backup.
This presentation will guide you though the initial stages of installation, through to producing your first report Click your mouse to advance the presentation.
Eucalyptus Virtual Machines Running Maven, Tomcat, and Mysql.
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
CSCI 6962: Server-side Design and Programming
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Lecture 3 The Relational DB Model. Learning Objectives That the relational database model takes a logical view of data That the relational model’s basic.
WaveMaker Visual AJAX Studio 4.0 Training Authentication.
© 2003 By Default! A Free sample background from Slide 1 Week 2  Free PHP Hosting Setup  PHP Backend  Backend Security 
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
Copyright (c) by CNAPTICS Corporation. All rights reserved.1 INFO Oracle Database 11g: Administration II Presented By: Marc S. Paller,
1 Working with MS SQL Server Textbook Chapter 14.
1 OPOL Training (OrderPro Online) Prepared by Christina Van Metre Independent Educational Consultant CTO, Business Development Team © Training Version.
ISM 4212 Lab Creating DB Tables 02 copyright Lars Paul Linden 2007.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Present :Arezoo Mollahasani. Step 1  Define your server connection Open MySQL WorkBench and click New Server Instance on the right of the window.
1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout
CS 3630 Database Design and Implementation. Assignment 3 Style! Agreement between database designer and the client. UserName1_EasyDrive UserName2_EasyDrive.
Index and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Damian Tamayo Tutorial DTM Data Generator Fall 2008 CIS 764.
A Brief Documentation.  Provides basic information about connection, server, and client.
Creating Tables and Inserting Records -- Not easy to edit! -- check constraints! Create table test1 ( C1 char(5) primary key, C2 Varchar2(15) not null.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
DATABASE TOOLS CS 260 Database Systems. Overview  Database accounts  Oracle SQL Developer  MySQL Workbench.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 9 Auditing Database Activities.
1 More basics on DB access Elke A. Rundensteiner.
Creating Programs on UNIX This term you can create programs on UNIX or you can create programs using a C++ compiler on your PC. This set of slides steps.
1 Very basics on DB access Elke A. Rundensteiner.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
SQL in Oracle. Set up Oracle access at IU You need to install Oracle Client: – – For windows:
What is MySQL? MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, Many.
Contract Invoice Guide
Unix Servers Used in This Class  Two Unix servers set up in CS department will be used for some programming projects  Machine name: eustis.eecs.ucf.edu.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
© 2007 by Prentice Hall2-1 Introduction to Oracle 10g Chapter 2 Overview of SQL and SQL*Plus James Perry and Gerald Post.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
Basic SQL*Plus edit and execute commands SQL*Plus buffer and built-in editor holds the last SQL statement Statements are created in free-flow style and.
Intro To Oracle :part 1 1.Save your Memory Usage & Performance. 2.Oracle Login ways. 3.Adding Database to DB Trees. 4.How to Create your own user(schema).
Installation Oracle 11g Express 2 double click the "setup" button to install the Oracle.
MY SQL INTRODUCTION TO LOGIN BASIC COMMANDS OTHER COMMANDS.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
3 A Guide to MySQL.
Tutorial of Unix Command & shell scriptS 5027
SQL and SQL*Plus Interaction
Basics on DB access Elke A. Rundensteiner.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
ORACLE SQL Developer & SQLPLUS Statements
Aqua Data Studio.
COP5725 DATABASE MANAGEMENT POSTGRESQL TUTORIAL
Tutorial of Unix Command & shell scriptS 5027
Using SQL*Plus.
CSCE 206 Lab Structured Programming in C
Ch 1 .Installing and configuring SQL Server 2005
Presentation transcript:

Oracle Tutorial (CS4347) TA Information –Name: Lidong Wu – –Office Hour:Tu. 3pm-4pm & Fr. ECSS 4.209

Outlines 1.Connect Oracle Account 2.SQL Commands

Connect Oracle Account

Setup Oracle Account(win.) 1.You are assumed to have an account in the Unix system at UTD. 2.Oracle is available only on the machine csoracle.utdallas.edu. NOT APACHE. Login to csoracle at first.(either using PuTTY on windows, or ssh within Mac or Linux. )

Setup Oracle Account (cont.) 3a. Use putty to login csoracle.utdallas.edu  The free download is available at oad.html The hostname is csoracle.utdallas.edu The port is 22 The Connection type is SSH. Enter a Saved Session Name, then click save Open

Setup Oracle Account (cont.) 3b. Oracle SQL Developer  The free download is available at ndex.html. ndex.html Enter a Connection Name, then enter your netId and password Set Role is default, connection type is basic The hostname is csoracle.utdallas.edu The port is 1521 The SID is student. Click test; the status should show up as Success. Connect

Setup Oracle Account (cont.) 4.Run "oam.pl“  The account name is same as your netid;  Don ’ t use the special characters for your password, just use the letters and digitals.

Setup Oracle Account 5.Setup environment variables:  Use "ps" command to check the login shell you are using. {csoracle:~} ps PID TTY TIME CMD 8974 pts/4 0:00 bash {csoracle:~}

Setup Oracle Account Edit the configuration file (csh/tcsh):add the following lines to your ".login" file: (sh/ksh/bash): ".bash_profile" for bash and ".profile" for sh/ksh: * bash: add the following lines to your ".bash_profile" file Logout the machine csoracle.utdallas.edu and login again Run "oam.pl" if you want to change the password if [ -f /oracle/env.sh ] then. /oracle/env.sh; fi if ( -f /oracle/env.csh ) then source /oracle/env.csh endif

Run sqlplus {csoracle:~} sqlplus SQL*Plus: Release Production on Thu Sep 9 14:08: Copyright (c) 1982, 2007, Oracle. All rights reserved. Enter user-name: (netID) Enter password: (what you just set up) Connected to: Oracle Database 11g Enterprise Edition Release bit Production With the Oracle Label Security and Data Mining options SQL>

Setup Oracle Account (Mac /Linux) 1.Use SSH to login csoracle.utdallas.edu  Choose ssh protocol and csoracle.utdallas.edu as host name

If such an error occurs Contact #2760 # SQL*Plus: Release Production on Tue Sep 2 19:06: (c) Copyright 2000 Oracle Corporation. All rights reserved. Enter user-name: yxh Enter password: ERROR: ORA-12541: TNS:no listener Enter user-name:

SQL Command create drop alter insert update delete select Commit

Table & View Basic Structure of Table: Attribution1 Attribution2 Attribution3 … Tuple1: Attr_value Attr_value Attr_value Tuple2: Attr_value Attr_value Attr_value … Example of Relation between Table Table1(Department): Attr1(DeptNo), Attr2(DeptName), … Table2(Employee): Attr1(SSN), Attr2(DNo), … View is a mirror of Table, no record is stored in the view. From view, you could only access a subset of data in tables.

Create tables Grammar: create table Table_Name (Attribution_Name1 attribution_type, Attribution_Name2 attribution_type, … primary key (Attribution_Name) foreign key (Attribution_Name) reference ( Table_Name2) ); create view View_Name as select Attribution_Name1, Attribution_Name2,… from Table_Name where condition;

Create tables (Cont.) SQL> create table Merchandize (ItemID int, ItemType char(15), Price real, primary key (ItemID)); Table created. SQL> create view MerType as select ItemType from Merchandize where ItemID = 1; View created.

Create tables (Cont.) SQL> create table Electronics (ItemID int check (ItemID <= 10), BrandName char(15), Category char(15), primary key (ItemID), foreign key (ItemID) references Merchandize); Table created.

Alter Table SQL>alter table Electronics add ItemSize int; Table altered. Structure of Electronics: Previous: ItemID, BrandName, Category Current: ItemID, BrandName, Category, ItemSize

Insert record SQL>insert into Merchandize(ItemID, ItemType, Price) values(1, 'Electronics', 39.99); 1 Row created. Update records SQL>update Merchandize set Price=9.99 where ItemID=1 and ItemType= 'Electronics'; 1 Row updated. Let’s insert a few more records now…

select SQL>select ItemID, ItemType, Price from Merchandize where price > 39.99; SQL>select Merchandize.Price, Electronics.Category from Merchandize, Electronics where Merchandize. ItemID = Electronics.ItemID;

Delete all records SQL>delete from Merchandize; 1 Row deleted. SQL>delete from Merchandize where price > 9.99; Delete specific record(s)

Drop Table SQL>drop table Merchandize; Table dropped.

Other useful commands List all tables: List all fields in a table Submit the work SQL>select * from tab; SQL>describe mytable; SQL>commit;

Other useful commands(cont.) List only distinct (different) values : Sorts the records in ascending order by default: SQL> select distinct ItemType from Merchandize; SQL> select * from Merchandize order by ItemType;

Other useful commands(cont.) Returns the largest value of the selected column: SQL> select max(Price) as HighestPrice from Merchandize;

A transaction in Oracle All changes of data in an Oracle database can only be done within a transaction. A transaction must either be committed or rolled back.committedrolled back Data changed within a transaction is not visible to another session until it is committed.session

Store & Run commands in sql files Edit your sql commands and save it as a file, the file extension must be. sql, the file name should end with ". sql “ Put that file in your sqlplus working directory (it depends from where you run your sqlplus command). after login the sqlplus system

Examples of sql file Example 1: One sql command in a file The Table "Merchandize" will be created >vi create.sql create table Merchandize (ItemID char(6), ItemType char(15), Price real, primary key(ItemID));

Examples of sql file Example 2: many sql commands in one file Two records will insert into the table "Merchandize", then list all the records of the table " Merchandize ". >vi myscript.sql insert into Merchandize(ItemID, ItemType, Price) values(2,'Electronics', 39.99); insert into Merchandize(ItemID, ItemType, Price) values(4, 'Tools', 19.99); select * from Merchandize;

Save the output Use sql command: All output result will be redirected to a.lst Close output redirection: "spool off" SQL>spool a SQL>spool off

Purge Recyclebin Use sql command to delete the garbage: SQL> BIN$4qjxjq0zKpPgQLAKDFxDqQ==$0 TABLE BIN$4qjxjq0mKpPgQLAKDFxDqQ==$0 TABLE BIN$4qjxjq0gKpPgQLAKDFxDqQ==$0 TABLE SQL>purge recyclebin

Check the error reason Example: Logout sqlplus and run "oerr ora 942" in linux System will output the cause of this error >oerr ora 942 SQL> drop table merchandize1; drop table merchandize1 * ERROR at line 1: ORA-00942: table or view does not exist

Review If you can not execute sqlplus, –Make sure you login in csoracle NOT apache –Make sure you have set oracle environment correctly If you can create oracle account but can not access oracle server, –Contact System administrator #2760 –TA is NOT oracle administrator.

Students outside the UTD’s network Login apache.utdallas.edu Type in “ssh csoracle.utdallas.edu”

Useful links SQL Demo in Oracle – –