domingo, 15 de novembro de 2009

Geracao das tablespaces

-- Script p/ geração das tablespaces
-- *** SCRIPT PARA ORACLE 8 SERVER (NT) ***


-- Cria tablespace p/ dados
create tablespace TBS_DADOS
datafile 'D:\BD\DataFiles\Dados.dbs' size 100M reuse
autoextend on next 10M maxsize 300M
default storage (initial 512K next 256K
minextents 1
maxextents unlimited
pctincrease 0)
online;

-- Cria tablespace p/ ¡ndices
create tablespace TBS_INDICES
datafile 'D:\BD\DataFiles\Indices.dbs' size 100M reuse
autoextend on next 10M maxsize 200M
default storage (initial 512K next 256K
minextents 1
maxextents unlimited
pctincrease 0)
online;

-- Cria tablespace p/ segmentos de rollback
create tablespace TBS_ROLLBACK
datafile 'D:\BD\DataFiles\Rollback.dbs' size 100M reuse
autoextend on next 10M maxsize 200M
default storage (initial 512K next 256K
minextents 1
maxextents unlimited
pctincrease 0)
online;

-- Cria tablespace p/ segmentos tempor rios
create tablespace TBS_TEMP
datafile 'D:\BD\DataFiles\Temp.dbs' size 100M reuse
autoextend on next 10M maxsize 200M
default storage (initial 512K next 256K
minextents 1
maxextents unlimited
pctincrease 0)
online
temporary;


-- Cria os segmentos de rollback
-- (OBS.: modificar o parâmetro rollback_segmentS em INIT*.ORA)
create rollback segment RBS01
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS02
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS03
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS04
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS05
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS06
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS07
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS08
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS09
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

create rollback segment RBS10
tablespace tbs_rollback
storage (initial 512K next 256K
minextents 2 maxextents 121
optimal 1M);

-- Altera os segmentos de rollback criados p/ "online"
alter rollback segment RBS01 online;
alter rollback segment RBS02 online;
alter rollback segment RBS03 online;
alter rollback segment RBS04 online;
alter rollback segment RBS05 online;
alter rollback segment RBS06 online;
alter rollback segment RBS07 online;
alter rollback segment RBS08 online;
alter rollback segment RBS09 online;
alter rollback segment RBS10 online;

-- Cria usu rio (que ser dono das tabelas)
create user USUARIO
identified by MINHA_SENHA
default tablespace TBS_DADOS
temporary tablespace TBS_TEMP
quota unlimited on TBS_DADOS
quota unlimited on TBS_INDICES
quota unlimited on TBS_ROLLBACK
quota unlimited on TBS_TEMP;

-- Cria e define a "role" de privil?gios
create role USUARIO_ROLE;

grant
create cluster,
create database link,
create procedure,
create session,
create sequence,
create synonym,
create table,
create trigger,
create view
to USUARIO_ROLE;

grant
alter session
to USUARIO_ROLE;

grant
create any index
to USUARIO_ROLE;

grant USUARIO_ROLE to USUARIO;
grant unlimited tablespace to USUARIO

0 comentários:

Postar um comentário