1

問題のあるスクリプトを使用して、Oracle 9i システムでユーザー名を一重引用符で囲んだユーザーを作成しました (つまり、ユーザー名はユーザー名ではなく「ユーザー名」です)。今、そのユーザーを削除したいと思います。「DROP USER 'username'」も「DROP USER \'username\'」も「DROP USER (SELECT username FROM all_users where user_id = 123)」も機能しませんでした。そのユーザーを削除するにはどうすればよいですか?

4

7 に答える 7

4
create user "'bla'" identified by bla;

drop user "'bla'";
于 2009-07-22T14:51:12.157 に答える
2

Oracleのドキュメントによると...

「引用識別子は、二重引用符 (") で始まり、終わります。引用符で囲まれた識別子を使用してスキーマ オブジェクトに名前を付ける場合は、そのオブジェクトを参照するたびに二重引用符を使用する必要があります。」

したがって、この...

DROP USER "username" CASCADE;
于 2009-07-22T14:59:02.347 に答える
2

これが古い投稿であることは知っていますが、この問題に関する検索の結果としてこれに出くわした人にとっては、ドロップ ユーザーでデータベース トリガーが起動しているように見えます。Oracle XE で見つけたソリューションをここに投稿しました (おそらく他の 10g リリースでも同じです)

誰かがこれが役に立つことを願って、

マイク

于 2010-02-18T00:09:48.280 に答える
1

DROP USER "'username'"またはを試してくださいDROP USER ''username''。(これらの最後の引用符はすべて一重引用符であることに注意してください)

于 2009-07-22T14:53:38.937 に答える
0

より良いフォーマットでもう一度:

declare 

   sel_username varchar2(30); 

   r_user_id    varchar2(30); 

   r_username   varchar2(30); 

   user_cmd     varchar2(200); 

BEGIN

/* 

   This procedure will delete a single userid and can be used to delete a user 
   with none displayable characters in the name 

   **Replace the user_id  in this script !!** 

   Author: Ulrich Henkenjohann  -  March 2010 / tested on ORACLE 10.2.0.4 

*/      
-- select the username for a special user_id. Ther username may contain none displayed characters

   select username into sel_username from dba_users where user_id = 34; 

   select user_id, username into r_user_id , r_username from dba_users where username = sel_username ; 

   DBMS_OUTPUT.PUT_LINE('Selected user: ' || r_user_id || ' ' || r_username); 

-- If a test is needed, an alter passwort command may be usefull 

-- user_cmd := 'ALTER USER "' || r_username || '" IDENTIFIED BY PASSWORDX '; 

-- Drop the selected user 

   user_cmd := 'DROP USER "' || r_username || '" CASCADE '; 

   DBMS_OUTPUT.PUT_LINE('Executing user_cmd: ' || user_cmd ); 

   execute immediate user_cmd ; 

END;
/
于 2010-03-24T11:12:20.593 に答える
0

オラクルのことはよくわかりませんが、二重引用符で囲んでみていただけますか?

(間違っている場合は、この回答を削除します)

于 2009-07-22T14:51:50.253 に答える
0

次のコードが役立つ場合があります。

declare 

   sel_username varchar2(30); 
   r_user_id    varchar2(30); 
   r_username   varchar2(30); 
   user_cmd     varchar2(200); 

BEGIN
/* 
   This procedure will delete a single user_id and can be used to delete a user 
   with none displayable characters in the name 

   **Replace** the user_id  in this script to that you want to delete !! 

   Author: Ulrich Henkenjohann  -  March 2010 / tested on ORACLE 10.2.0.4 

*/      
-- select the username for a special user_id. Ther username may contain none displayed characters

   select username into sel_username from dba_users where user_id = 34; 
   select user_id, username into r_user_id , r_username from dba_users where username = sel_username ; 
   DBMS_OUTPUT.PUT_LINE('Selected user: ' || r_user_id || ' ' || r_username); 

-- If a test is needed, an alter passwort command may be usefull 
-- user_cmd := 'ALTER USER "' || r_username || '" IDENTIFIED BY PASSWORDX '; 

-- Drop the selected user 

   user_cmd := 'DROP USER "' || r_username || '" CASCADE '; 
   DBMS_OUTPUT.PUT_LINE('Executing user_cmd: ' || user_cmd ); 
   execute immediate user_cmd ; 

END;
/
于 2010-03-24T11:06:24.103 に答える