Create a tablespace in an Oracle database and an oracle database

Source: Internet
Author: User

Create a tablespace in an Oracle database and an oracle database

-- Create a tablespace in the Oracle database

Create tablespace new_taspace

-- Tablespace name

DATAFILE 'd: \ NEWTABLESPACE. dbf' -- the data file and location associated with the tablespace

Size 200 M -- Initial File size

Autoextend on next 20 mb maxsize 400 MB; -- the file size can be automatically expanded. Each extension is 20 MB, and the maximum size is 400 MB.

-- Create tablespace new_taspace1 -- data file and location associated with the tablespace DATAFILE 'd: \ NEWTABLESPACE1.DBF '-- Initial file SIZE: 200 MB

-- Log File
Logging
Extent management local
Segment space management auto; -- end with a semicolon

-- Delete the tablespace and delete the physical files together.
Drop tablespace new_taspace including contents and datafiles

-- Create a user
Create user orders
Identified by 123456.
Default tablespace new_taspace; -- create a default tablespace for the user

-- Assign a role to a user
Grant connect, resource to orders
Grant dba from orders

-- Revoke the user administrator role

Revoke dba from orders

-- Add the permission to access a table

Grant select on tep to orders

 

-- Create a book table
Create table book (
Id number (11) primary key,
Bookname varchar2 (50) not null,
Price number (11,2) not null,
Storage number (11) not null
)

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.