Hello World

rem
rem Header: trafic_main.sql 2015/03/19 10:23:26 smtaylor Exp $
rem
rem Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
rem
rem Permission is hereby granted, free of charge, to any person obtaining
rem a copy of this software and associated documentation files (the
rem « Software »), to deal in the Software without restriction, including
rem without limitation the rights to use, copy, modify, merge, publish,
rem distribute, sublicense, and/or sell copies of the Software, and to
rem permit persons to whom the Software is furnished to do so, subject to
rem the following conditions:
rem
rem The above copyright notice and this permission notice shall be
rem included in all copies or substantial portions of the Software.
rem
rem THE SOFTWARE IS PROVIDED « AS IS », WITHOUT WARRANTY OF ANY KIND,
rem EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
rem MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
rem NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
rem LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
rem OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
rem WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
rem
rem Owner : ahunold
rem
rem NAME
rem trafic_main.sql – Main script for trafic schema
rem
rem DESCRIPTON
rem trafic (Human Resources) is the smallest and most simple one
rem of the Sample Schemas
rem
rem NOTES
rem Run as SYS or SYSTEM
rem
rem MODIFIED (MM/DD/YY)
rem smtaylor 03/19/15 – added parameter 6, connect_string
rem smtaylor 03/19/15 – added @&connect_string to CONNECT
rem jmadduku 02/18/11 – Grant Unlimited Tablespace priv with RESOURCE
rem celsbern 06/17/10 – fixing bug 9733839
rem pthornto 07/16/04 – obsolete ‘connect’ role
rem hyeh 08/29/02 – hyeh_mv_comschema_to_rdbms
rem ahunold 08/28/01 – roles
rem ahunold 07/13/01 – NLS Territory
rem ahunold 04/13/01 – parameter 5, notes, spool
rem ahunold 03/29/01 – spool
rem ahunold 03/12/01 – prompts
rem ahunold 03/07/01 – trafic_analz.sql
rem ahunold 03/03/01 – trafic simplification, REGIONS table
rem ngreenbe 06/01/00 – created

SET ECHO OFF
SET VERIFY OFF

PROMPT
PROMPT Attribuez un mot de passe pour l utilisateur trafic
DEFINE pass = &1
PROMPT
rem PROMPT specify default tablespeace for trafic as parameter 2:
rem DEFINE tbs = &2
rem PROMPT
rem PROMPT specify temporary tablespace for trafic as parameter 3:
rem DEFINE ttbs = &3
PROMPT
PROMPT Quel est le mot de passe pour SYS as parameter 2:
DEFINE pass_sys = &2
rem PROMPT
rem PROMPT specify log path as parameter 5:
rem DEFINE log_path = &5
PROMPT
PROMPT Quelle est la connection (par ex ocalhost:1521/XEPDB1) as parameter 3:
DEFINE connect_string = &6
PROMPT

 

REM =======================================================
REM cleanup section
REM =======================================================

DROP USER trafic CASCADE;

REM =======================================================
REM create user
REM ttraficee separate commands, so the create user command
REM will succeed regardless of the existence of the
REM DEMO and TEMP tablespaces
REM =======================================================

CREATE USER trafic IDENTIFIED BY &pass;

ALTER USER trafic DEFAULT TABLESPACE users
QUOTA UNLIMITED ON users;

ALTER USER trafic TEMPORARY TABLESPACE temp;

GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO trafic;
GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE , UNLIMITED TABLESPACE TO trafic;

REM =======================================================
REM grants from sys schema
REM =======================================================

CONNECT sys/&pass_sys@&connect_string AS SYSDBA;
GRANT execute ON sys.dbms_stats TO trafic;

REM =======================================================
REM create trafic schema objects
REM =======================================================

CONNECT trafic/&pass@&connect_string
ALTER SESSION SET NLS_LANGUAGE=American;
ALTER SESSION SET NLS_TERRITORY=America;


— create tables, sequences and constraint

–@__SUB__CWD__/human_resources/trafic_cre


— populate tables

–@__SUB__CWD__/human_resources/trafic_popul


— create indexes

–@__SUB__CWD__/human_resources/trafic_idx


— create procedural objects

–@__SUB__CWD__/human_resources/trafic_code


— add comments to tables and columns

–@__SUB__CWD__/human_resources/trafic_comnt
rem select * from all_users;


— gather schema statistics

–@__SUB__CWD__/human_resources/trafic_analz