Delete more than 1 user from the database
Hi All,
I have a list of users in a file and i want to write a script to delete all these
users from my database.
I have tried deleting users using:
drop user user1,user2,user3..... but it doesn't seem to work.
Can anyone suggest how do i read the users from the file and delete them one by one
I have written a script but getting a error.Can anyone help :-
create or replace PROCEDURE drop_user
is
v_filehandle utl_file.file_type;
v_user VARCHAR2(20);
lv1 VARCHAR2(200);
err_code VARCHAR2(20);
err_msg VARCHAR2(250);
BEGIN
v_filehandle:=utl_file.fopen('/tmp','user_list.lst','R');
LOOP
BEGIN
utl_file.get_line(v_filehandle,v_user);
lv1:='drop user'|| v_user;
execute immediate lv1;
EXCEPTION
WHEN OTHERS THEN
err_code := SQLCODE;
err_msg := substr(SQLERRM, 1, 200);
dbms_output.put_line(err_code|| ':-' || err_msg);
END;
END LOOP;
utl_file.fclose(v_filehandle);
END DROP_USER;
ERROR :
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.UTL_FILE", line 98
ORA-06512: at "SYS.UTL_FILE", line 157
ORA-06512: at "TOM.DROP_USER", line 9
ORA-06512: at line 1
Similar Messages
-
Script to Delete more than 1 user from the database
Hi All,
I have a list of users in a file and i want to write a script to delete all these
users from my database.
I have tried deleting users using:
drop user user1,user2,user3..... but it doesn't seem to work.
Can anyone suggest how do i read the users from the file and delete them one by oneYou can use an external table :
SYS@db102 SQL> select username from all_users
2 where username like 'USER%';
USERNAME
USER1
USER2
USER3
SYS@db102 SQL> !cat users_to_drop.txt
USER1
USER2
USER3
SYS@db102 SQL> create table test.users_to_drop
2 (
3 userx char(30)
4 )
5 organization external
6 ( type oracle_loader
7 default directory work
8 access parameters
9 ( records delimited by newline
10 )
11 location ('users_to_drop.txt')
12 )
SYS@db102 SQL> /
Table created.
SYS@db102 SQL> begin
2 for U in (select userx from test.users_to_drop) loop
3 dbms_output.put_line('Dropping '||U.userx);
4 execute immediate 'drop user '||U.userx||' cascade';
5 end loop;
6 end;
SYS@db102 SQL> /
Dropping USER1
Dropping USER2
Dropping USER3
PL/SQL procedure successfully completed.
SYS@db102 SQL> select username from all_users
2 where username like 'USER%';
no rows selected
SYS@db102 SQL> -
How to delete a purchase order from the database
I thought that I was in development machine but I was wrong., I have created a purchase order that I would like to delete from the database.
Thanks in advance.>
Amarnath Reddy Gurappa wrote:
> Hi ,
>
> I would suggest you to put the deletion mark and save the PO .
>
> IF you really want to delete the po in the database then go to the table ekko and
> ekpo and delete them ,but for this you should have access to se16n and
> &sap_edit
PLEASE, do not recommend such, because it is a wrong approach.
a purchase order has certainly more entries than jsut in table EKKO, and EKPO. you can check in DB15 how many tables belong to the object MM_EKKO. If you delete jsut entries from EKKO and EKPO, then you create inconsistencies.
SE16N and &sap_edit, is not anymore possible having current patches installed. SAP revoked this option, because people like you spread this thru the internet and this is causing security issues.
A phyiscal deletion should only be done via archiving, this is the standard process.
If you entered something in error, then set the deletion indicator, everybody can do mistakes, but deleting it with irregular options from the database is certainly a much bigger error. -
HOW TO IMPORT DATA MORE THAN ONCE FROM THE SAME EXPORT DUMP FILE?
before asking my question i'd like to mention that i'm a french spoke...
so my english is a little bit bad. sorry for that.
my problem is : IMPORT
how to import data a SECOND TIME from an export dump file within oracle?
My Export dump file was made successfully (Full Export) and then i
tried to import datas for the first time.
I got this following message in my logfile: I ADDED SOME COMMENTS
Warning: the objects were exported by L1, not by you
. importing SYSTEM's objects into SYSTEM
REM ************** CREATING TABLESPACES *****
REM *********************************************
IMP-00015: following statement failed because the object already exists:
"CREATE TABLESPACE "USER_DATA" DATAFILE 'E:\ORANT\DATABASE\USR1ORCL.ORA' SI"
"ZE 3145728 DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAX"
"EXTENTS 121 PCTINCREASE 50) ONLINE PERMANENT"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLESPACE "ROLLBACK_DATA" DATAFILE 'E:\ORANT\DATABASE\RBS1ORCL.ORA"
"' SIZE 10485760 DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS "
"1 MAXEXTENTS 121 PCTINCREASE 50) ONLINE PERMANENT"
etc........
IMP-00017: following statement failed with ORACLE error 1119:
"CREATE TABLESPACE "L1" DATAFILE 'E:\ORADATA\L1.DBF' SIZE 1048576000 "
"DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTIN"
"CREASE 50) ONLINE PERMANENT"
IMP-00003: ORACLE error 1119 encountered
ORA-01119: error in creating database file 'E:\ORADATA\L1.DBF'
ORA-09200: sfccf: error creating file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified
--->etc..........
the drive E: with the folder E:\ORADATA didn't exist, but after
all that i created it.
see below, before my IMPORT statement
REM ********************* CREATING USER *********
REM ********************************************
IMP-00017: following statement failed with ORACLE error 959:
"CREATE USER "L1" IDENTIFIED BY VALUES 'A6E0DAA6865E7627' DEFAULT TABLESPACE"
" "L1" TEMPORARY TABLESPACE "TEMPORARY_DATA""
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace 'L1' does not exist
IMP-00017: following statement failed with ORACLE error 959:
"CREATE USER "MLCO" IDENTIFIED BY VALUES '56AC6447B7D50467' DEFAULT TABLESPA"
"CE "MLCO" TEMPORARY TABLESPACE "TEMPORARY_DATA""
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace 'MLCO' does not exist
ETC.......
REM ********************* GRANTING ROLES ***********
REM ************************************************
IMP-00017: following statement failed with ORACLE error 1917:
"GRANT ALTER ANY TABLE to "L1" "
IMP-00003: ORACLE error 1917 encountered
ORA-01917: user or role 'L1' does not exist
ETC.........
IMP-00017: following statement failed with ORACLE error 1918:
"ALTER USER "L1" DEFAULT ROLE ALL"
IMP-00003: ORACLE error 1918 encountered
ORA-01918: user 'L1' does not exist
-- that is normal, since the creation of the
tablespace failed !!
REM******************************
IMP-00015: following statement failed because the object already exists:
"CREATE ROLLBACK SEGMENT RB_TEMP STORAGE (INITIAL 10240 NEXT 10240 MINEXTENT"
"S 2 MAXEXTENTS 121) TABLESPACE "SYSTEM""
IMP-00015: following statement failed because
. importing SCOTT's objects into SCOTT
IMP-00015: following statement failed because the object already exists:
"CREATE SEQUENCE "EVT_PROFILE_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999"
"999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE"
ETC............
importing L1's objects into L1
IMP-00017: following statement failed with ORACLE error 1435:
"ALTER SCHEMA = "L1""
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
REM *************** IMPORTING TABLES *******************
REM ****************************************************
. importing SYSTEM's objects into SYSTEM
. . importing table "AN1999_BDAT" 243 rows imported
. . importing table "BOPD" 112 rows imported
. . importing table "BOINFO_AP" 49
ETC................
. . importing table "BO_WHF" 2 rows imported
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "DEF$_CALL" ("DEFERRED_TRAN_DB" VARCHAR2(128),
IMP-00015: following statement failed because the object already exists:
"CREATE SYNONYM "DBA_ROLES" FOR "SYS"."DBA_ROLES""
IMP-00015: following statement failed because the object already exists:
"CREATE SYNONYM "DBA_ERRORS" FOR "SYS"."DBA_ERRORS""
IMP-00008: unrecognized statement in the export file:
. importing L1's objects into L1
IMP-00017: following statement failed with ORACLE error 1435:
"ALTER SCHEMA = "L1""
IMP-00008: unrecognized statement in the export file:
J
Import terminated successfully with warnings.
-------------------------------------b]
So after analysing this log file, i created
the appropriate drives and folders... as the
import statement doesn't see them.
E:\ORADATA G:\ORDATA etc...
And i started to [b]IMPORT ONE MORE TIME. with:
$ IMP73 sys/pssw Full=Y FILE=c:\temp\FOLD_1\data_1.dmp BUFFER=64000
COMMIT=Y INDEXFILE=c:\temp\FOLD_1\BOO_idx.sql
LOG=c:\temp\FOLD_1\BOO_log.LOG DESTROY=Y IGNORE=Y;
after that i could not see the users nor the
tables created.
and the following message appeared in the log file:
Warning: the objects were exported by L1, not by you
. . skipping table "AN1999_BDAT"
. . skipping table "ANPK"
. . skipping table "BOAP"
. . skipping table "BOO_D"
ETC.....skipping all the tables
. . skipping table "THIN_PER0"
. . skipping table "UPDATE_TEMP"
Import terminated successfully without warnings.
and only 2 new tablespaces (originally 3) were
created without any data in ( i check that in
the Oracle Storage manager : the tablespaces exit
with 0.002 used space; originally 60 M for each !!)
so,
How to import data (with full import option) succefully
MORE THAN ONE TIME from an exported dump file ?
Even if we have to overwrite tablespaces , tables and users.
thank you very muchThe Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this thread to the appropriate Database forum.
The main URL is:
http://forums.oracle.com/forums/index.jsp?cat=18 -
My iPhone will not download more than 50mb from the app store.
I have fast iPhone LTE unlimited service from my provider. If my download is larger than 50MB I have to switch to wifi. At work my wifi connection is 2.5MB and my LTE service is 20MB. How do I stay at the fast speed for the download? Was this an oversite on apple's side?
Waiting for help.it's supposed to be that way so you don't kill your data plan.
-
How to handle the more than once from the same jsp files
Hi,
i have a one jsp file with three buttons.each one having for different functionalities. like one for cancel, second for edit the values and third for save the values in databse. so i want to handle all these 3 buttons. how can test that which button is coming for action..
Is there any validation necessary for buttons....
give me the suggestion to do this.......
help meeeeeeee
thanks
123Hint: Its something you need to handle using javascript by setting the hidden variables during submit.
I would expect you to think on this and reply the simple solution. -
Can workbook owned by another user be deleted from the database
Hello all,
We are wanting to know if a workbook can be deleted from the database by someone other than the owner. We have a user that was once with the organization that created and uploaded several Discoverer reports to the database. However, they are no longer with the organization. If a change needs to be made to one of their reports, we can download a copy and modify it. However, when you upload the report and keep the same name, it creates a copy of the report in the database but now owned being by the new user. When users using Viewer retrieve a list of reports from the database, they are seing two reports with the same name in the listing, but owned by different people. We could always rename the new report. However, we would like to 'clean up' the production database by purging any obsolete or older verision reports regardless of who they are owned by.
Thanks in advance for any inputHi,
Yes we can do this, to the best of my knowledge here is my input: There are two ways to do this
1) a) If that workbook has been shared with your id thne login as you in Discoverer Plus then open workbook and using SAVE AS and save the workbook and it wil save under your id.
b) follow the below command to delete the workbook owned by old user
2 )-->Login as EUL user (ex: EUL10_US) in Discoverer Administrator and export the workbook owned by the owner (no longer exist in the company: abc.workbookname) and save in your local drive
-->Login as new user in Administrator and import the workbook from the local drive
-->using below command delete the workbook owned by old user (*abc.workbookname*) by running at command prompt.
dis51adm.exe /connect eul10_us/xxxxx@DBname /delete /workbook "abc.workbookname" /eul eul10_us /log C:\oracle\BIToolsHome_1\bin\Delete_wb_oatr.log
Now you will have only one copy of the workbook in the database.
hope this helps you.
--skat -
How do I delete more than 1 slide at a time from the custom slide show in Elements 8
How do I Delete more than 1 slide at a time from the custom slide show in Elements 8?
How to Mass Delete Emails from iPhone and iPad Inbox (with video)
http://suiteminute.com/how-to-mass-delete-emails-from-iphone-and-ipad-inbox/
Cheers, Tom -
How to delete more than one workbook from command line
Hi, I'd like to delete more than one workbook from command line:
The following syntax, it doesn't work....but I followed the manual instructions:
dis51adm.exe /connect eul/eul@uatdb /delete /workbook "ALE_TEST_1, ALE_TEST_2" /eul eul /log D:\Ale\delete.log
where:
eul/eul@uatdb: is the db’s schema/user where the EUL is installed;
/delete "ALE_TEST_1, ALE_TEST_2": is the command to delete the workbooks, specified inside the “” (with the relative path)
/log D:\Ale\delete.log: is the command to write a log’s file named “delete.log” to track the action
The log file says:
22/4/2008 4:00:26 μμ
dis51adm.exe /connect /delete /workbook ALE_TEST_1, ALE_TEST_2 /eul eul /log D:\Ale\delete.log
Document ALE_TEST_1, ALE_TEST_2 not found in EUL.
Internal EUL Error: ObjectNotFound - Can't find EUL element
There are 0 eul elements to be deleted.
Completed deleting eul elements.
22/4/2008 4:00:29 μμ
Anyone can tell me how is the right syntax ?
Thanks in advance
AlexHi Rod
I was coming to that conclusion myself but wanted to wait until the other avenues had been exhausted first - aka making sure of the workbook names.
I checked through all of the command line documentation and read nothing which clearly indicated that only one workbook could be processed at a time, other than the fact that the syntax says workbook and not workbooks, which could be a big clue.
I think you are right though in that it has to be one at a time, which would be a pain.
Best wishes
Michael -
Deleting more than one file at a time from Nomad Jukebox Zen Xtra 4
Is there a way to delete more than one file at a time from Zen Xtra? Actually, I'd like to delete most of the 800+ files and the only way I've found is to do them one at a time..! Help!
Either use finder to drag and drop those tracks onto
"Library" in iTunes' left "Source" column or from
iTunes Menu Files use "Add to Library ..." then
navigate to a folder that keep a yoru tracks and
select that folder.
This did it! I was doing an "import" which would only let me do one song at a time. But the "add to library" and the drag and drop both worked. Thanks!!!
New Mac user
Scott in Alaska
MacBookPro Mac OS X (10.4.5) -
How to retrieve data from the Database after deleting rows from VO ?
Hello,
I am using Jdeveloper 11.1.2.1.0
I have a master and a child .
So according my use case when a value in the master vo changes the corresponding child has to be deleted.
but when i change back to any other value i want to undo the delete operation and get back the values in the child.
Is there any way to do it?
Regards,
Nigel.
Edited by: Nigel Thomas on Mar 29, 2012 5:07 AM
Edited by: Nigel Thomas on Mar 29, 2012 5:09 AMHi all,
I want to do a validation based on a SelectOneChoice List Value.
Based on which value in the select one choice is being selected, thedata from the VO should be DELETED or NOT-DELETED.
To do this I wrote a Managed Bean and the delete part is working fine if a particular value of the SelectOneChoice is selected.
Since the rows are deleted from the VO, after I change the SelectOneChoice value to the previous one I cannot retrieve the rows.
I thought of two ways:
1. As the Deleting option in the SelectOneChoice is selected the rows should be deleted from the VO and when reverted back to not-Deleting option the Rollback of Transaction method written in the Managed Bean should take place.
2. As the Deleting option is selected the data should be deleted from the VO and when reverted back to non-Deleting option, a query should be made from the Database.
The first plan was dropped because it is not VO-specific. If there are more than 1 VO in the page then whatever changes are made in the page will be reverted back as soon ad Rollback of transaction is done.
So the now i am left to go with the second plan.
Is there any way to implement the second plan?
If so...Will it compromise the performance of the application?
Or else, Is there any other way to implement my Use-Case ???
Regards,
Nigel. -
Cannot delete more than 4 e-mails from trash folder in one go
When I try to delete more than 4 e-mails in one go from the trash folder on my Sony Xperia Z2, the e-mail software crashes with the message: 'Unfortunately, E-mail has stopped'. Is this a bug everyone is experiencing on the Z2?
Thank you Thommo, your instructions have solved the problem. I cleared cache and data which got rid of the 4000+ e-mails in my bin folder. Then rebooted and inputted my e-mail account details. The e-mail app downloaded 157 e-mails from the TalkTalk server. I deleted them, and then deleted the same 157 e-mails from the bin folder... and it worked.
Thanks for your help. -
Is there a way to delete more than one photo at a time in the Photo application?
Is there a way to delete more than one photo at a time in the application Photos in the iPad? Thanks.
The links below have instructions for deleting photos.
iOS and iPod: Syncing photos using iTunes
http://support.apple.com/kb/HT4236
iPad Tip: How to Delete Photos from Your iPad in the Photos App
http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
Another Way to Quickly Delete Photos from Your iPad (Mac Only)
http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
How to Delete Photos from iPad
http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
How to: Batch Delete Photos on the iPad
http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
(With iOS 5.1, use 2 fingers)
How to Delete Photos from iCloud’s Photo Stream
http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
Cheers, Tom -
TS3899 How do I delete more than one email at a time from my i phone 5C
How do I delete more than one email at a time from my i phone 5C
With your Mail app open and the listing of the messages, tap Edit at the top right. Then check each circle on the left side of the messages to delete. When you have checked those to delete, tap Trash at the lower right.
Next tap Mailboxes upper left, under accounts select the account, then for the account tap Trash. Select Edit upper right, and at the bottom, Delete All, and confirm Delete All and all will be removed at one time. -
I want to delete more than one song at a time from iTunes
I want to delete whole albums from itunes. Is there a way to delete more than one song at a time?
Or Command click on the songs if they are not consecutive on the list.
Maybe you are looking for
-
my mail has been working perfectly on my 3gs iphone. I can now longer access the mail after tapping on the mail icon. All i get is a blank screen with a reload icon and a write icon at the bottom, neither of which responds when touched. The icon cont
-
Apache x86 wont start with CF9.01 x64 on win2k3 x64. wsconfig question.
Hey, I'm running a virtual windows 2003 x64 with Apache 2.2.16 (x86) and i want to connect my apache to cf9 with the wsconfig tool. It places a mod_jrun22.so in my /lib/wsconfig/1/ folder and changes my httpd.conf. That works just fine. But when i st
-
TS3274 Why I can't receive a blue point from Tapjoy apllcation?
I can receive any point or credit from tapjoy application.Please help me.Had contact team from the tapjoy,their sauda it's because setting on my device.Please help me,thank you.
-
I am unable to run more than 3 or 4 times a report call by a form. I have the Dr Watson after. If I close the reports background engine every thing is ok. But it is not user friendly to close the reports background engine each time. Please for your h
-
I just updated my Apple ID to a current email address, it worked on my laptop but my phone is still using the old one and neither password works. I can't download or use anything other than phone calls and texting on my phone now. Help!