ORCALE delete user prompts that the currently connected user cannot be deleted PLSQL

ORCALE delete user

1. Delete through related sentences

a. Delete directly:

	drop user xx cascade;

b. Prompt that the currently connected user cannot be deleted

	--锁定用户(防止再有其他连接产生)
 	alter user XXX account lock;
	--查询进程号 (获取sid,serial;注意大小写)
	SELECT * FROM V$SESSION WHERE USERNAME='XXX';
	--删除对应的进程
	alter system kill session 'sid,serial'
	--删除对应的用户
	drop user xx cascade

c. When deleting a process, it prompts that the corresponding process number does not exist, and the process number searched out is different each time

	--获取jobs
	select * from dba_jobs; 
	--删除库中的定时任务 (243为dba_jods搜索结果中的job字段)
	begin
	  dbms_job.remove(243);
	  commit;
	end;
	删除掉对应的job后就可以再去删除用户了,注意要以job所属用户登录才可以去删除job

It is recommended to delete the job through step 2c

2. Delete via PLSQL

a. Delete directly

Insert picture description here
Find the user that needs to be deleted in the Objects window -> Users, right click and drop to delete;

b. It prompts that the currently connected user cannot be deleted, as shown below

Insert picture description here
You can use 1b to eliminate logged in users

c. When deleting a process, it prompts that the corresponding process number does not exist, and the process number searched out is different each time

Check the session and
Insert picture description herefind the session to be deleted. I found that there is a running job in the Action to
Insert picture description herelog in to the user to be deleted. Delete the running job.
Insert picture description here
Note:
Can't log in to the locked user? alter user XXX account unlock; --Unlock user
Can't delete the job? Make the current connection the main link

After deleting it, log in to view the session again as an administrator user, and you can see that the user has only one active connection. After step 1b, remove the connection and then delete it.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45884459/article/details/109380252