You are here: ApiroTech > Database > Oracle

 
 
 

Oracle

PREVIOUS     NEXT

Dropping everything from an Oracle database

 If you don't want to create your database from scratch it's sometimes useful to just delete all the objects from it.1. Put the following in the file "DBdrop.sql" set feedback off set pagesize 0 spool AllObjectsDrop.sql select 'drop view '||view_name||';' from user_views; select distinct 'drop sequence '||sequence_name|| ';'from user_sequences; select distinct 'drop table '||table_name|| ';'from user_tables; select distinct 'drop procedure '||name|| ';'from user_source where type = 'procedure'; select distinct 'drop function '||name|| ';'from user_source where type = 'function'; select distinct 'drop package '||name|| ';'from user_source where type = 'package'; select 'drop synonym '||synonym_name||';' from user_synonyms where synonym_name not like 'sta%' and synonym_name like 's_%' spool off 2. Log into the database as the user for the database you want to drop 3. Run the script (@DBdrop.sql). This creates the file "AllObjectsDrop.sql" which contains commands to drop all objects. 4. Ru... Read More

Login to Oracle as sysdba in one command

 Log into the database via sqlplus with sysdba priv's with a single command. This can be setup with an alias, if you'd like1. Log into the server as the oracle user end ensure you have the effective group of the appropriate DBA group. typical unix installations have the OS user as 'oracle' and the dba group as 'dba' (not to be confused with the 'oinstall' group). 2. Check your account with the unix 'id' command. Make sure your environment variables are set to the appropriate database $ id uid=510(oracle) gid=500(dba) $ env | grep ORA ORACLE_SID=TESTDB ORACLE_HOME=/opt/app/oracle/product/9.2.0 3. connect to the database $ sqlplus "/ as sysdba" SQL> 4. that's it! be *very* careful! you might want to make sure you are really in the instance you expect SQL> select name from v$database;... Read More

 

 

Pages : 1