Oracle creates table spaces and users

Source: Internet
Author: User
Tags sqlplus

first, create a table space

1. Set the instance name

Echo $ORACLE _sid

Export Oracle_sid=mvbpbang

2, sqlplus login/sqlplus Command Login

When you install Oracle, you need to remember the set global database name (default = ORCL) and password when you log in two ways:

User name: sys (superuser ==SYSDBA)/System (Admin user and Sys think differently than the system cannot create tablespace) ...

Password: Sqlplus/as sysdba;

3. Create temporary tablespace/tablespace/create User/authorization

  

  

1: Create a temporary tablespace temporary tablespace user_temp  tempfile ' Q:\oracle\product\10.2.0\oradata\Test\xyrj_ TEMP.DBF ' size 50m  autoextend on  next 50m maxsize 20480m  extent management local;   2: Creating a data table space create tablespace user_data   datafile ' Q:\oracle\product\10.2.0\oradata\Test\ XYRJ_DATA.DBF ' size 50m  autoextend on  next 50m maxsize Unlimited  extent management Local
segment Space management auto; 3rd Step: Create a user and specify the tablespace created by the username identified by password default tablespace user_data Temporary Tablespace user_temp; 4th step: Grant CONNECT,RESOURCE,DBA to username the user permission ;
Second, delete user and table space

Delete User

Drop Userxxcascade

Note: Delete the user, just delete the schema objects under the user, will not delete the corresponding tablespace.

  Delete tablespace

drop  tablespace tablespace_name  including contents and datafiles ;

SQL Code
--Delete empty tablespace, but no physical file
Drop Tablespace tablespace_name;
--Delete non-empty table spaces, but not physical files
drop tablespace tablespace_name including contents;


--Delete empty table space, including physical files
Drop tablespace tablespace_name including datafiles;
--Delete a non-empty tablespace containing physical files
drop tablespace tablespace_name including contents and datafiles;
--Add Cascade CONSTRAINTS if the table in the other tablespace is associated with a field of a table in this table space with a constraint such as a foreign key.
drop tablespace tablespace_name including contents and datafiles cascade constraints;

---reproduced---

Http://www.cnblogs.com/xmaomao/p/3273102.html

Oracle creates table spaces and users

Related Article

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.