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