Download presentation
Presentation is loading. Please wait.
1
Basics on DB access Elke A. Rundensteiner
2
DBMS? Oracle mySQL: Many other DBMS engines out there
Accounts already created Documentation: mySQL: You would need to create an account via CCC Documentation: Many other DBMS engines out there
3
Oracle Your accounts on Oracle are ready :
Upper case user names cannot have a “.” in them. Must log into CCC to ccc.wpi.edu source /cs/bin/oracle-setup
4
Oracle Version at WPI Version: 12.1.0.2.0
The oracle server SID is ORCL Version: host name is oracle.wpi.edu port is #1521
5
Problems while setting up Oracle
you may run into problems, typically due to typos or minor setup issues If you get really stuck, please send a message to CANVAS to show a screen-dump of what happens.
6
Oracle introduction Connecting
sqlplus <userName>/<PASSWORD> sqlplus Change passwd using password command You may end up submitting your passwd; Therefore don’t use password that you use for other purposes.
7
Oracle useful commands
These commands can be executed from SQL shell SELECT * FROM cat; -- lists tables you have created SELECT table_name FROM user_tables; -- as above. DESCRIBE <tableName>; -- describes schema for table with name tableName help index; -- shows list of help topics; help start; -- illustrates how to use command start exit; -- exit from SQL shell
8
Using Oracle from Windows
Multiple ways: Use aquastudio software from aquafold.com. connect to -- server: oracle.wpi.edu port: 1521 (this is the default) SID: ORCL Download oracle client for windows. Connect using sqlplus client or other tools: sqlplus
9
Working with the Data Server
10
Basic SQL Commands CREATE TABLE student(sNum INTEGER,sName VARCHAR (30)); creates table student with two columns INSERT INTO student VALUES (1, ‘Joe’); insert one row into the student table SELECT * FROM student; select all rows from student table DELETE FROM student; delete all rows in the student table DROP TABLE student; drop student table Purge recyclebin; purge recyclebin tables that get created. -- Only works if you are logged onto CCC1
11
Running scripts in SQLPlus
To enter OS environment, use sqlplus command: Host Now you can execute OS commands, like : cd.. , exit, etc.
12
Running scripts in SQLPlus
Create a file in your file system in the current directory called : createTable.sql @createTable -- executes the script start createTable -- also executes the script If you want to save your output to a file (similar to script in Unix): spool <fileName> <executeCmds...> spool off;
13
Loading data from a text file
Create a table : CREATE TABLE myTable1 (a int, b int); Create data file, say: sample.dat Put data into the file : 1,11 2,22 3,33
14
Loading from text file (Contd)
Create control file, say load.ctl LOAD DATA INFILE sample.dat INTO TABLE myTable1 FIELDS TERMINATED BY ‘,’ (a,b) Invoke SQL Loader (from your UNIX shell): $ sqlldr <user/password> control=load.ctl
15
Connecting to Oracle DBMS from SQL Developer
Install Juniper Networks - > Network Connect(WPI VPN) Download Oracle SQL Developer from oracl;e Configure SQL Developer Connection
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.