Create oracle users and tablespaces in windows and linux

Source: Internet
Author: User

1. Create oracle users and tablespaces in Windows
-- Create a data table space
Create tablespace oras_data -- Name of the tablespace
Logging
Datafile 'd: \ oracle \ product \ 10.1.0 \ oradata \ oras_data.dbf '-- storage of the tablespace file space
Size 32 m
Autoextend on
Next 32 m maxsize 2048 m
Extent management local; -- the table space is automatically increased.
-- Create a user and specify a tablespace
Create user oras identified by oras -- create user and password
Default tablespace oras_data; -- specifies the tablespace
 
-- Grant permissions to users
 
Grant dba, connect, resource, CTXAPP, create view to oras; -- grant the user some Permissions
 
 
2. Create oracle users and tablespaces in linux
 
The procedure is as follows:
1. log on to linux and Log On As an oracle user (if logged on as a root user, use the su-oracle command to switch to an oracle user)
2. Open sqlplus using sysdba. The command is as follows: sqlplus "/as sysdba"
3. Check the location where the user tablespace is normally placed: execute the following SQL:
Select name from v $ datafile;
The preceding SQL statements are used to check the location of your tablespace files.
 
-- Create a data table space
Create tablespace oras_data -- Name of the tablespace
Logging
Datafile '/oracle/product/10.1.0/oradata/oras_data.dbf' -- tablespace file (view the default storage location of the tablespace: select name from v $ datafile)
Size 32 m
Autoextend on
Next 32 m maxsize 2048 m
Extent management local -- the table space is automatically increased.
-- Create a user and specify a tablespace
Create user oras identified by oras -- create user and password
Default tablespace oras_data -- specifies the tablespace that the User specifies
 
-- Grant permissions to users
 
Grant dba, connect, resource, CTXAPP, create view to oras; -- grant the user some Permissions
 
 
 
Conclusion: differences,
 
1. Windows:
 
Logging
Datafile 'd: \ oracle \ product \ 10.1.0 \ oradata \ oras_data.dbf'
 
 
2. in Linux:
 
Logging
Datafile '/oracle/product/10.1.0/oradata/oras_data.dbf'
 
 
 
3. in Linux:
 
Do not add the ";" sign to the end of the SQL statement. It cannot be executed. As shown in the following figure, remove.
 
Grant dba, connect, resource, CTXAPP, create view to oras; -- grant the user some Permissions
 
 
 
Everything else is the same, very simple.
 
 
 
--####################################### ####
 
 
 
-- View the usage of all tablespaces
Select tablespace_name, sum (bytes)/1024/1024 from dba_data_files group by tablespace_name;
 
 
 
-- View the index of the specified tablespace and the number of tablespaces occupied by each table.
Select SEGMENT_TYPE, owner, sum (bytes)/1024/1024 from
Dba_segments
Where tablespacE_name = 'oras _ data'
Group by segment_type, owner
 
-- Deleting a user deletes all tables and views under this User Name
Drop user oras cascade
-- Delete a tablespace
Drop tablespace oras_data including contents and datafiles

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.