Oracle uses scripts to create data table spaces and users

Source: Internet
Author: User

Oracle uses scripts to create data table space and users -- Create Table space (enterprise database) ----- declare v_rowcount number (5); begin select count (*) into v_rowcount from dual where exists (select 1 from dba_tablespaces where tablespace_name = 'plstwhept '); If v_rowcount = 0 Then Execute immediate 'create tablespace plstwhept datafile' E: \ app \ lukelu \ oradata \ PLSTWHEPT. dbf ''size 50 m autoextend on next 1 m extent management local uniform size 128 k segment space management auto'; End If; end;/www.2cto.com -- create a tablespace (User Library) declare v_rowcount number (5); begin select count (*) into v_rowcount from dual where exists (select 1 from dba_tablespaces where tablespace_name = 'plstwmwh1 '); if v_rowcount = 0 Then Execute immediate 'create TABLESPACE PLSTWMWH1 DATAFILE ''' E: \ app \ lukelu \ oradata \ PLSTWMWH1.dbf ''SIZE 50 m autoextend on next 1 m extent management local uniform size 128 k segment space management auto'; End If; end; /---- create a user and assign the user a space ---- declare v_rowcount number (5); begin select count (*) into v_rowcount from dual where exists (select 1 from all_users where username = 'plstwms '); if v_rowcount = 0 Then Execute immediate 'create user plstwms identified by "999666" default tablespace plstwhept temporary tablespace temp '; End If; end;/grant create any table to plstwms; grant dba to plstwms; grant execute on DBMS_LOCK to plstwms; grant select on DBA_OBJECTS to plstwms; grant create any sequence to plstwms; ---- create user ---- declare v_rowcount number (5 ); begin select count (*) into v_rowcount from dual where exists (select 1 from all_users where username = 'plstwms1 '); if v_rowcount = 0 Then Execute immediate 'create user plstwms1 identified by "999666" default tablespace PLSTWMWH1 temporary tablespace temp '; End If; end;/grant create any table to plstwms1; grant dba to plstwms1; grant execute on DBMS_LOCK to plstwms1; grant select on DBA_OBJECTS to plstwms1; grant create any sequence to plstwms1;

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.