| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Creating tables - Newbie question
connect system/manager
create tablespace webtspc -- etc...
/
create user webdemo identified by webdemo default tablespace webtbspc
temporary tablespace temp -- assuming it exists
/
rem old style
grant connect, resource to webdemo
/
rem new style
grant create session, create table to webdemo
/
alter user webdemo quota unlimited on webtbspc
/
create user webuser identified by webuser temporary tablespace temp
/
grant create session to webuser
/
connect webdemo/webdemo
create table foo
(col1 number(1) primary key foo_prim -- might be : constraint foo_prim
primary key
, col2
)
tablespace webtspc -- in your case unnecessary it is already the default
/
create table bar
(col3 number(1) not null primary key bar_prim
col4 number(1) foreign key references foo
)
tablespace webtbspc
/
grant select, insert, update, delete on foo to webuser
/
grant select, insert, update, delete on bar to webuser
/
connect webuser/webuser
create synonym foo for webdemo.foo
/
create synonym bar for webdemo.bar
/
select * from foo
/
select * from bar
rem or
connect system/manager
create public synonym foo for webdemo.foo
/
rem etc.
rem normally you would issue grants to a role (made by create role etc)
and grant the role to an end-user.
Hth,
Sybrand Bakker, Oracle DBA
<gnawed_at_my-deja.com> wrote in message news:8cb2e1$ugj$1_at_nnrp1.deja.com...
> In article <954786937.17697.0.pluto.d4ee154e_at_news.demon.nl>,
> "Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote:
> > Answers embedded
> > <gnawed_at_my-deja.com> wrote in message
news:8calve$g55$1_at_nnrp1.deja.com...
> > > I'm trying to run an SQL script to create tables for a new database.
> > > This is only for development, not production.
> > >
> > > 1) Is it common to create a new tablespace for these tables?
> > Yes
> >
> > I noticed
> > > that the demo tables are all in the SYSTEM tablespace.
> >
> > This is some 100k only
> >
> > Is this
> > > standard? And how do I create a new tablespace with the proper
> > > permissions (see next question).
> >
> > create tablespace <tablespace_name>
> > default storage ( etc.
> > datafile '<filename on server>' size <whatever> M
> > alter user <youruser> quota unlimited on <tablespace name>
>
>
>
>
>
>> >
> >
> > Hth,
>
> >
![]() |
![]() |