oracle 資料庫建立指令碼

來源:互聯網
上載者:User

以下的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;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.