rem ORA_TUT table creation SQL file

set echo off verify off pause off feedback on termout on
spool oratut.log
grant connect,resource to oratut identified by *******;
prompt Connecting to oratut
connect ********/*******
drop table calls;
drop table lookup;
drop sequence seq_nr;

prompt Creating calls

create table calls(
seq number(10) not null,
name char(30) not null,
priority number not null,
open_date date not null,
email char(100),
problem varchar2(2000),
software char(6),
close_date date
) pctfree 10 tablespace it_support storage
(initial 100k next 50k minextents 1 maxextents 99 pctincrease 5)
/

prompt Creating lookup
create table lookup(

LK_TYPE VARCHAR(6) NOT NULL,
LK_CODE VARCHAR(6) NOT NULL,
LK_DESC VARCHAR(30) NOT NULL
) pctfree 10 tablespace it_support storage
(initial 50k next 50k minextents 1 maxextents 99 pctincrease 3)
/

rem ###############################################################
prompt Creating sequences
rem ###############################################################

create sequence seq_nr

increment by 1 start with 1 maxvalue 999999999 nocache
/

rem ###############################################################
prompt Creating grants
rem ###############################################################

grant all on calls to system with grant option;
grant select on calls to public;
grant all on lookup to system with grant option;
grant select on lookup to public;
grant select on seq_nr to public;

connect SYSTEM/PWD;
revoke connect from oratut;

grant connect to ***** identified by *****;
grant select,update,insert, delete on oratut.calls to *****;
grant select,update,insert, delete on oratut.lookup to *****;

exit


home