Sample Code for creating a Schema in an Oracle database

Source: Internet
Author: User

Oracle DatabaseMediumCreate SchemaThe process can be implemented using code. This article describes a sample code for creating a Schema for an Oracle database, hoping to help you.

First, execute the following code:

 
 
  1. clear screen;  
  2. disconn;  
  3. conn / as sysdba;  
  4. drop user USER CASCADE;  
  5. DROP TABLESPACE USER_INDX including contents and datafiles;  
  6. DROP TABLESPACE USER_TS_TABLES including contents and datafiles;  
  7. DROP TABLESPACE USER_TEMP including contents and datafiles; 
 
 
  1. CREATE TABLESPACE USER_INDX  
  2.     NOLOGGING  
  3.     DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USER_INDX' SIZE 5120K AUTOEXTEND ON  
  4.     NEXT 32m maxsize 4096m  
  5.     EXTENT MANAGEMENT LOCAL  
  6.     ONLINE  
  7.     SEGMENT SPACE MANAGEMENT AUTO; 
 
 
  1. CREATE TABLESPACE USER_TS_TABLES  
  2.     NOLOGGING  
  3.     DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USER_TS_TABLES' SIZE 5120K AUTOEXTEND ON  
  4.     NEXT 32m maxsize 4096m  
  5.     EXTENT MANAGEMENT LOCAL  
  6.     ONLINE  
  7.     SEGMENT SPACE MANAGEMENT AUTO; 
 
 
  1. CREATE TEMPORARY TABLESPACE USER_TEMP  
  2.     TEMPFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USER_TEMP' SIZE 5120K AUTOEXTEND ON  
  3.     NEXT 32m maxsize 8192m  
  4.     EXTENT MANAGEMENT LOCAL; 
 
 
  1. create user USER IDENTIFIED BY USER  
  2.  default tablespace USER_TS_TABLES  
  3.  temporary tablespace USER_TEMP  
  4.  quota unlimited on USER_TS_TABLES; 

Then run the following code:

 
 
  1. GRANT CONNECT,RESOURCE,IMP_FULL_DATABASE TO USER;  
  2. disconn;  
  3. pause;  
  4. conn USER/USER;  
  5. @D:\0706\start.ddl;  
  6. disconn;  

The sample code for creating a Schema in an Oracle database is introduced here. I hope this introduction will be helpful to you!

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.