oracle 数据库创建脚本
以下的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;