How to Create tablespaces and users in oracle and create tables in oracle

Source: Internet
Author: User

How to Create tablespaces and users in oracle and create tables in oracle
1. First, if a user exists

Drop user username cascade;

2. if it cannot be deleted, the current user may be in the connection status. You can find the session

Select username, sid, serial # from v $ session where username = username;

Alter system kill session 'sid, serial #'

3. If you want to be safe, lock the current user first;

Alter user username account lock;

4. If the tablespace (temporary) to be deleted is the default tablespace of another user

Select * from v $ session

Select username, default_tablespace from dba_users where username = 'username ';

If there are two ways to deal with this problem: 1. Modify the default and temporary tablespaces of the queried user.

Alter user naro default tablespace TABLESPACENAME;

Alter user naro default temporary tablespace TEMPNAME;

5. Now you can delete the tablespace (temporary)

Drop tablespace TABLESPACENAME including contents and datafiles cascade constraints;

Drop tablespace TEMPSPACENAME including contents and datafiles cascade constraints;

6. Create a New tablespace (temporary)

Create tablespace SPACENAME datafile 'e: \ database \ data' size 200 M autoextend on next 200 m maxsize 20480 m extent management local;

Create temporary tablespace TEMPNAME tempfile 'e: \ database \ temp 'size 200 M autoextend on next 200 m maxsize 20480 m extent management local;

7. create user authorization and default tablespace

Create user username IDENTIFIED BY NARO ACCOUNT UNLOCK

Default tablespace spacename temporary tablespace tempname;

8. Authorization

Grant connect, resource to username;

Grant dba to username;

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.