How to delete users and tablespaces in Oracle in Linux: linuxoracle
This article describes how to delete users and tablespaces in Oracle in Linux. We will share this with you for your reference. The details are as follows:
1. delete a user
SQL> conn /as sysdbaConnected.SQL> drop user userName cascade;
User deleted
If the user cannot be deleted, an error is returned:
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
View the user's progress, kill the user process, and delete the user.
SQL> select sid,serial# from v$session where username='userName';SID SERIAL#---------- ----------150 9019SQL> alter system kill session '150,9019';System altered.
2. delete a tablespace
Prerequisites: before deleting a tablespace, make sure that the tablespace is not used by other users before deleting it.
Copy codeThe Code is as follows: drop tablespace nsName including contents and datafiles cascade constraints;
Including contents deletes the content in the tablespace. If there is content in the tablespace before the tablespace is deleted, but this parameter is not added, the tablespace cannot be deleted, so this parameter is habitually added.
Including datafiles: delete data files in a tablespace.
Cascade constraints also deletes the foreign key reference of the table in tablespace.
I hope this article will help you with Oracle database programming.
Articles you may be interested in:
- How to Create Oracle database users in LINUX
- How to create databases and users in oracle
- How to modify the username and password of an oracle Database
- The Oracle Method for deleting all tables under the current user applies to having or having no Delete permission
- Example of oracle user creation/deletion (oracle user deletion commands and authorization)
- Use shell scripts to delete tablespaces, create tablespaces, and delete users in oracle.
- How Does oracle delete users and provide solutions?
- How to add and authorize users, change passwords, unlock, and delete users in Oracle
- Oracle command line deletes and creates user code