How to delete users and tablespaces in Oracle in Linux: linuxoracle

Source: Internet
Author: User

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

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.