您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle删除表空间的shell脚本实例

2024/4/6 22:00:51发布35次查看
oracle删除表空间的shell脚本代码 #!/bin/bash#ocpyang@126.com#drop tablespace if [ $# -ne 1 ]; then echo usage: $0 table
oracle删除表空间的shell脚本代码
#!/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 /dev/null #禁止sqlplus执行结果回显
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  set heading off
 drop tablespace ${tablespace_name} including contents and datafiles;
 exit;
 eof)
 echo -e \e[1;32m  ${wind_var} \e[0m  #direct display returns results
 rm -rf ${outfiletmp}
 exit 1
else
 echo -e \e[1;31m --------------------------------------- \e[0m
 echo -e \e[1;31m  the tablespace ${tablespace_name} not exits! \e[0m
 echo -e \e[1;31m --------------------------------------- \e[0m
 rm -rf ${outfiletmp}
 exit 1
fi
oracle 11g 在redhat linux 5.8_x64平台的安装手册
linux-6-64下安装oracle 12c笔记
在centos 6.4下安装oracle 11gr2(x64)
oracle 11gr2 在vmware虚拟机中安装步骤
debian 下 安装 oracle 11g xe r2
本文永久更新链接地址:

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product