Oracle deletes a shell script instance for a tablespace
Shell script code for Oracle tablespace Deletion
#! /Bin/bash
# Ocpyang@126.com
# Drop tablespace
If [$ #-ne 1]; then
Echo "Usage: $0 TABLESPACE_NAME"
Exit 1
Fi
# Configure oracle env: about oracle envs, username and password
ORACLE_SID = orcl
ORACLE_HOME =/u01/app/oracle/product/11.2.0/db_1
Ora_data =/u01/app/oracle/product/11.2.0/db_1/dbs/
Ora_user = "sys" # oracle username
Ora_pass = "password" # oracle user password
Tablespace_name = $ (echo $1 | tr '[a-z] ''[A-Z]')
Outfiletmp =/tmp/droptpstmp01.txt # specify the output file location
Sqlplus-S "$ {ora_user}/$ {ora_pass} as sysdba" <! 01>/dev/null # disable display of sqlplus execution results
Set heading off;
Set feedback off;
Set termout off;
Set pagesize 0;
Set verify off;
Set echo off;
Spool $ {outfiletmp}
Select tablespace_name from dba_tablespaces where tablespace_name = '$ {tablespace_name }';
Spool off
Exit;
! 01
Tps_jug = 'grep-I $ {tablespace_name }$ {outfiletmp }'
If ["$ {tps_jug}" = "$ {tablespace_name}"]; then
Wind_var = $ (
Sqlplus-s "{ora_user}/$ {ora_pass} as sysdba" <EOF
Set heading off
Drop tablespace $ {tablespace_name} including contents and datafiles;
EXIT;
EOF)
Echo-e "\ e [1; 32 m $ {wind_var} \ e [0 m" # Direct display returns results
Rm-rf $ {outfiletmp}
Exit 1
Else
Echo-e "\ e [1; 31 m ------------------------------------------- \ e [0 m"
Echo-e "\ e [1; 31 m The tablespace $ {tablespace_name} not exits! \ E [0 m"
Echo-e "\ e [1; 31 m ------------------------------------------- \ e [0 m"
Rm-rf $ {outfiletmp}
Exit 1
Fi
Oracle 11g installation manual on RedHat Linux 5.8 _ x64 Platform
Installing Oracle 12C in Linux-6-64
Install Oracle 11gR2 (x64) in CentOS 6.4)
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian