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;