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
)