Hello all..
I need to delete a Database (8.1.7) from command prompt...My X-server is not working for some reason....
How do we delete/drop the database from command line ?
thanks
Ron
Printable View
Hello all..
I need to delete a Database (8.1.7) from command prompt...My X-server is not working for some reason....
How do we delete/drop the database from command line ?
thanks
Ron
hmm I suggest you to read concepts guide, there is no such delete/drop database command
Assuming all your datafiles are in /opt2/oradata/baddb -
as the owner of the files (oracle, oracle8, oracle9, whatever), do
rm /opt2/oradata/baddb/*
That will remove all files in the baddb directory.
If you are deleting the database (not re-using "baddb" anymore) -
rm -r /opt2/oradata/baddb
That will not only remove the files under the baddb directory, but will also remove the baddb directory.
Don't forget the control files (if you left them in $ORACLE_HOME/dbs).
Check system processes for anything to do with baddb -
ps -ef | grep baddb
Kill any remaining processes with
kill -9 (the process id you got from the ps command)
But, it sounds like you may be playing with fire by the nature of the question.
1. Note the datafiles that make up this database
select name from v$datafile
2. Note the Control files
select name from v$controlfile
3. Shutdown the database and listener
4. Remove the files noted above
5. Remove this SID entry from
/etc/oratab
6. Remove this SID entry from
$ORACLE_HOME/network/admin/listener.ora
and
$ORACLE_HOME/network/admin/tnsnames.ora
7. Change your $ORACLE_SID env var
8. If you want to remove the oracle software, let us know... That's got tentacles.
9. Put your head between your legs and kiss your butt goodbye!
Well, since we're diving in to this -
select member from v$logfile;
delete those as well
delete the init.ora file
delete the LK file in $ORACLE_HOME/dbs
Oh, and don't forget redo logs and archived log files.
select member from v$logfile
select value from v$parameter where name = 'log_archive_dest'
And don't forget files located in bdump, cdump, udump, admin, etc.
And trace files & alert log(s).
... have allready been deleted in your previous message (bdump, udump, ....). :DQuote:
Originally posted by stecal
And trace files & alert log(s).
eess probably true
One sure fire method for deletion would be:
cd /
rm -R *
this works best if you can do an su first.
:D
But if you want to keep you job you can log in as sys and do an alter database backup controlfile to trace, shut down the database and look for the file in the trace directory and it will tell you where all of the files are located. If this was NT/2000/XP then you could use the ORADIM command to remove the database. If it is Unix and you don't want to try the previous method then you need to delete the database files and edit the following files: oratab, tnsnames.ora and listener.ora, removing any references to the database you are deleting. You could also just shut down the database and set the :Y to :N for that database in the oratab to keep it from restarting on reboot. Becuase as soon as you delete the database someone will want it. I deleted an Oracle 8.0.6 database recently and the next day someone wanted it to compile some old code. Just my thoughts.
If u delete the way suggested by all these guys will ofcourse do, but if u have WIN as OS then the registry contents will be left with & u cant do anything but to delete manually if u know have knowledge of contests in registry .
If u delete manully all the said files and say u want to create a new DB with that DB name u were using, OS will not allow u to do so as u r left with registry contents.....
S if u use ORDIM then it will delete service & contents in registry as well.
Regrds
abhay.
That would be ORADIM.Quote:
Originally posted by abhaysk
S if u use ORDIM then it will delete service & contents in registry as well.
And also comment out or delete your bad db line from the "oratab" file - should be in /var/opt/oracle
What else?:D
ohh... remove the password file as welll
$ORACLE_HOME/dbs/orapw$ORACLE_SID
make sure to remove the right one.:p
Stecal :Quote:
Originally posted by stecal
That would be ORADIM.
That was typing mistake :)
Use this to identify all files:
select name from v$controlfile
union all
select member from v$logfile
union all
select name from v$datafile
union all
select name from v$tempfile;
Nobody seemed to mention v$tempfile.
And be careful with the listener. Some other DBs might be using it.
I hope someone from Oracle is reading this!? Goes in the same category as uninstalling version 7 in NT. Rumours have it that version 12i will come bundled with crow-bar, flame-thrower and machette (part of DBA Studio).