Home> php教程> PHP开发> body text

How to delete users and tablespaces in Oracle under Linux

高洛峰
Release: 2017-01-06 10:44:21
Original
1793 people have browsed it

The example in this article describes how to delete users and table spaces in Oracle under Linux. Share it with everyone for your reference, the details are as follows:

1. Delete a user

SQL> conn /as sysdba Connected. SQL> drop user userName cascade;
Copy after login

The user has been deleted

If the user cannot be deleted and an error is reported:

ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

View the user’s progress and kill the user process , and then delete the user.

SQL> select sid,serial# from v$session where username='userName'; SID SERIAL# ---------- ---------- 150 9019 SQL> alter system kill session '150,9019'; System altered.
Copy after login

2. Delete the table space

Prerequisite: Before deleting the table space, make sure that the table space is not used by other users before deleting it.

drop tablespace nsName including contents and datafiles cascade constraints ;
Copy after login

including contents Delete the contents in the table space. If there is content in the table space before deleting the table space, but this parameter is not added, the table space cannot be deleted, so it is customary to add this parameter.
including datafiles Delete the data files in the table space.
cascade constraints Also delete foreign key references to tables in tablespace.

I hope this article will be helpful to everyone in Oracle database programming.

For more related articles on how to delete users and table spaces in Oracle under Linux, please pay attention to the PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!