remove a large number of user from oracle


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting remove a large number of user from oracle
# 1  
Old 08-22-2008
Question remove a large number of user from oracle

Hi

on solaris and oracle 10g2, I have number of users created in Oracle, I wonder if I have a list of the usernames will it be possible to remove the users quickly ?

I want to keep the users access to system but oracle.

some thing like shell script may be ?Smilie


I am trying to think of a way by which I can just feed the list to that script and script either execute like you said or one by one..

I don't know how to use shell script to connect to oracle and execute queries then...




Thanks
# 2  
Old 08-22-2008
I'm sorry, I don't quite understand what you are trying to do.

Are you trying to remove a list of users from Oracle? Or from the system?


You can perform a simple SQL command in Oracle to delete the users from a table. I take it that's what you're trying to get a shell script to do?

Check out this link: INTRODUCTION TO ORACLE
Oracle DELETE Statement


DELETE from [table name] where [field name] = 'whatever'; is basically what you need to do if deleting from a table in Oracle.
# 3  
Old 08-22-2008
Try this, I am not sure whether it works or not as i don't have oracle database.

#! /usr/bin/ksh
sqlplus user/pwd@database<<EOF
! for usr in `cat usernames.txt`
! do
drop user $usr;
!done
EOF

Or else you can try


#! /usr/bin/ksh
for usr in `cat usernames.txt`
do
sqlplus user/pwd@database<<EOF
drop user $usr;
EOF
done
# 4  
Old 08-22-2008
Quote:
Originally Posted by sudhamacs
Try this, I am not sure whether it works or not as i don't have oracle database.

#! /usr/bin/ksh
sqlplus user/pwd@database<<EOF
! for usr in `cat usernames.txt`
! do
drop user $usr;
!done
EOF

Or else you can try


#! /usr/bin/ksh
for usr in `cat usernames.txt`
do
sqlplus user/pwd@database<<EOF
drop user $usr;
EOF
done
Thanks Smilie Smilie
# 5  
Old 08-22-2008
Question

Do you also happen to know,

if I have a user in oracle configured with some privileges, can I add many users and have same privilege like the already configured user ?

currently,

I use web interface and use CREATE LIKE but it is time consuming to add users and set passwords through web because involves lot of copy paste in it and manual work for each new user.

Any ideas ?Smilie

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Large number of ulcm_sctp messages

Hi, I am running Solaris-10 sparc and I am seeing large number of messages related to ulcm_sctp. I tried to google, what these messages are and how it should be fixed, but I am not getting much information about it. Can somebody please some pointer or suggestion ? Sep 24 07:04:23... (7 Replies)
Discussion started by: ron323232
7 Replies

2. Shell Programming and Scripting

Remove dupes in a large file

I have a large file 1.5 gb and want to sort the file. I used the following AWK script to do the job !x++ The script works but it is very slow and takes over an hour to do the job. I suspect this is because the file is not sorted. Any solution to speed up the AWk script or a Perl script would... (4 Replies)
Discussion started by: gimley
4 Replies

3. Shell Programming and Scripting

Sftp large number of files

Want to sftp large number of files ... approx 150 files will come to server every minute. (AIX box) Also need make sure file has been sftped successfully... Please let me know : 1. What is the best / faster way to transfer files? 2. should I use batch option -b so that connectivity will be... (3 Replies)
Discussion started by: vegasluxor
3 Replies

4. UNIX for Dummies Questions & Answers

Rename a large number of files in subdirectories

Hi, I have a large number of subdirectories (>200), and in each of these directories there is a file with a name like "opp1234.dat". I'd like to know how I could change the names of these files to say "out.dat" in all these subdirectories in one go. Thanks! (5 Replies)
Discussion started by: lost.identity
5 Replies

5. Shell Programming and Scripting

Switching user to oracle to connect Oracle 11g DB with 'sysdba'

I need to connect my Oracle 11g DB from shell script with 'sysdba' permissions. To do this I have to switch user from 'root' to 'oracle'. I've tried the following with no success. su - oracle -c "<< EOF1 sqlplus -s "/ as sysdba" << EOF2 whenever sqlerror exit sql.sqlcode;... (2 Replies)
Discussion started by: NetBear
2 Replies

6. Shell Programming and Scripting

Copying number by looking a large file

Hi All, I have a big file which looks like this: abc 34.32 cdf 343.45 computer 1.34 ladder 2.3422 I have some 100000 .TXT files which look like this: computer cdf align I have to open each of the text files and read the words from the text files. Then I have to look into that... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

7. UNIX for Dummies Questions & Answers

Delete large number of files

Hi. I need to delete a large number of files listed in a txt file. There are over 90000 files in the list. Some of the directory names and some of the file names do have spaces in them. In the file, each line is a full path to a file: /path/to/the files/file1 /path/to/some other/files/file 2... (4 Replies)
Discussion started by: inakajin
4 Replies

8. Shell Programming and Scripting

Concatenation of a large number of files

Hellow i have a large number of files that i want to concatenate to one. these files start with the word 'VOICE_' for example VOICE_0000000000 VOICE_1223o23u0 VOICE_934934927349 I use the following code: cat /ODS/prepaid/CDR_FLOW/MEDIATION/VOICE_* >> /ODS/prepaid/CDR_FLOW/WORK/VOICE ... (10 Replies)
Discussion started by: chriss_58
10 Replies

9. Shell Programming and Scripting

Script to Compare a large number of files.

I have a large Filesystem on an AIX server and another one on a Red Hat box. I have syncd the two filesystems using rsysnc. What Im looking for is a script that would compare to the two filesystems to make sure the bits match up and the number of files match up. its around 2.8 million... (5 Replies)
Discussion started by: zippdawg2001
5 Replies

10. Shell Programming and Scripting

moving large number of files

I have a task to move more than 35000 files every two hours, from the same directory to another directory based on a file that has the list of filenames I tried the following logics (1) find . -name \*.dat > list for i in `cat list` do mv $i test/ done (2) cat list|xargs -i mv "{}"... (7 Replies)
Discussion started by: bryan
7 Replies
Login or Register to Ask a Question