Difference between revisions of "Delete / drop database"
From dbawiki
(→Unix) |
(→Unix) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 43: | Line 43: | ||
Connecting to database | Connecting to database | ||
4% complete | 4% complete | ||
| − | + | 9% complete | |
| + | 14% complete | ||
| + | 19% complete | ||
| + | 23% complete | ||
| + | 28% complete | ||
| + | 47% complete | ||
| + | Updating network configuration files | ||
| + | 48% complete | ||
| + | 52% complete | ||
| + | Deleting instance and datafiles | ||
| + | 76% complete | ||
100% complete | 100% complete | ||
</pre> | </pre> | ||
or | or | ||
<pre> | <pre> | ||
| − | startup mount | + | startup force mount restrict |
drop database; | drop database; | ||
</pre> | </pre> | ||
Latest revision as of 10:33, 19 April 2018
Contents
Windows[edit]
Check where the ORACLE_HOME for this instance is[edit]
Start:Run... services.msc
Double click on OracleService<SID>, the first part of "Path to executable" is the home or regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE See list of homes
Find location of files to delete[edit]
Connect as sys and
select name from v$datafile; select member from v$logfile; select member from v$controlfile; show parameter dump show parameter archive_dest select name from v$database; -- to be sure!
[edit]
set ORACLE_HOME=<oracle home> oradim -delete -sid <SID>
*Clean up database files: delete %ORACLE_HOME%\database\PWD<SID>.ora and any pfile, spfile and .dat files Delete the files and directories shown by above queries
Check in Registry to make sure entries have gone from HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_<home>
Unix[edit]
- Clean up RMAN repository
rman target sys/sys@DBTOGO catalog rman/rman@rmancat RMAN> unregister database;
- Drop the database (using the silent option of dbca)
. oraenv DBTOGO dbca -silent -deleteDatabase -sourceDB DBTOGO Connecting to database 4% complete 9% complete 14% complete 19% complete 23% complete 28% complete 47% complete Updating network configuration files 48% complete 52% complete Deleting instance and datafiles 76% complete 100% complete
or
startup force mount restrict drop database;
- Delete database references manually from other places
- ${ORACLE_HOME}/network/admin/tnsnames.ora (possibly on many hosts)
- ${ORACLE_HOME}/network/admin/listener.ora (probably only on this host)
- stop / restart the listener if this db was attached to a general listener
- remove entry from /etc/oratab
- Is it a clustered database?
If so, remove it from the Veritas (Solaris) or HACMP (AIX) configuration.
- Remove from any monitoring software (Grid, 3rd party)
- Clean any cleanup script where it may be hard-coded (Eek!)
- Delete archivelog directory
- Remove the database definition from backup software