以下的mydata是使用者名稱,也是資料庫的名字,這種建立資料庫的方式不用建立一個執行個體,還是用orcl 的sid
=========================指令碼開始===========================
SET ECHO OFF
PROMPT
PROMPT specify password for mydata as parameter 1:
DEFINE pass = &1
PROMPT
PROMPT specify default tablespeace for mydata as parameter 2:
DEFINE tbs = &2
PROMPT
PROMPT specify temporary tablespace for mydata as parameter 3:
DEFINE ttbs = &3
PROMPT
PROMPT specify password for SYS as parameter 4:
DEFINE pass_sys = &4
PROMPT
PROMPT specify log path as parameter 5:
DEFINE log_path = &5
PROMPT
-- The first dot in the spool command below is
-- the SQL*Plus concatenation character
DEFINE spool_file = &log_path.mydata_main.log
SPOOL &spool_file
REM =======================================================
REM cleanup section
REM =======================================================
DROP USER mydata CASCADE;
REM =======================================================
REM create user
REM tmydataee separate commands, so the create user command
REM will succeed regardless of the existence of the
REM DEMO and TEMP tablespaces
REM =======================================================
CREATE USER mydata IDENTIFIED BY &pass;
ALTER USER mydata DEFAULT TABLESPACE &tbs
QUOTA UNLIMITED ON &tbs;
ALTER USER mydata TEMPORARY TABLESPACE &ttbs;
GRANT CREATE SESSION, CREATE VIEW, ALTER SESSION, CREATE SEQUENCE TO mydata;
GRANT CREATE SYNONYM, CREATE DATABASE LINK, RESOURCE TO mydata;
REM =======================================================
REM grants from sys schema
REM =======================================================
CONNECT sys/&pass_sys AS SYSDBA;
GRANT execute ON sys.dbms_stats TO mydata;