Oracle Database creation script

Source: Internet
Author: User

The following mydata is the user name and database name. In this way, you do not need to create an instance or use the orcl Sid.

====================================== Script start ================== ====================

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
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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.