This article illustrates the way Oracle deletes users and tablespaces under Linux. Share to everyone for your reference, specific as follows:
1. Delete a user
sql> conn/as sysdba
Connected.
sql> drop user userName cascade;
User has deleted
If the user cannot delete, and error:
ERROR at line 1:
Ora-01940:cannot drop a user is currently connected
By viewing the user's progress, kill the user process, and then delete the user.
Sql> Select sid,serial# from v$session where username= ' username ';
SID serial#
-------------------- 9019
sql> alter system kill session ' 150,9019 ';
System altered.
2. Delete a table space
Prerequisite: Before deleting a tablespace, make sure that the tablespace is not used by another user before deleting it
Copy Code code as follows:
Drop tablespace nsname including contents and datafiles cascade;
including contents delete content in a table space, if there is content in the tablespace before the table space is deleted without this parameter, the table space is not erased, so it is customary to add this parameter.
including datafiles delete data files in a tablespace。
cascade Constraints Delete foreign key references for tables in tablespace。
I hope this article will help you with your Oracle database program design.