视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
Oracle新建表空间的shell脚本实例
2020-11-09 12:50:13 责编:小采
文档


Oracle新建表空间的shell脚本实例代码: #!/bin/bash#ocpyang@126.com#create tablespace if [ $# -ne 2 ]; then echo Usage:

Oracle新建表空间的shell脚本实例代码:

#!/bin/bash
#ocpyang@126.com
#create tablespace

if [ $# -ne 2 ]; then
echo "Usage: $0 TABLESPACE_NAME TABLESPACE_SIZE"
exit 1
fi

#configure oracle env:about oracle envs, username and password

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

ORACLE_SID=orcl

ora_data=/u01/app/oracle/product/11.2.0/db_1/dbs/


ora_user="sys"

ora_pass="password"


tablespace_name=$(echo $1 | tr '[a-z]' '[A-Z]')

tablespace_size=$2


outfiletmp01=/tmp/createtpstmp01.txt #specify the output file location

outfiletmp03=/tmp/createtpstmp03.txt #specify the output file location

outfiletmp02=/tmp/createtpstmp02.txt #specify the output file location

#check oracle instance is down or up

sqlplus -S "${ora_user}/${ora_pass} as sysdba" set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool ${outfiletmp01}
select sysdate from dual;
spool off
exit;
!01


ins_jug=`grep -i "ORA-01034:" ${outfiletmp01} >${outfiletmp02} `
if [ -s ${outfiletmp02} ]; then
echo -e "\e[1;31m ****************************************************************** \e[0m"
echo -e "\e[1;31m !!!!, oracle IS down! \e[0m"
echo -e "\e[1;31m ****************************************************************** \e[0m"
rm -rf ${outfiletmp01}
rm -rf ${outfiletmp02}
exit 1

fi

#
sqlplus -S "${ora_user}/${ora_pass} as sysdba" set heading off;
set feedback off;
set termout off;
set pagesize 0;
set verify off;
set echo off;
spool $outfiletmp03
select tablespace_name from dba_tablespaces where tablespace_name='${tablespace_name}';
spool off
exit;
!01

tps_jug=`grep -i ${tablespace_name} ${outfiletmp03} `

if [ "${tps_jug}" = "${tablespace_name}" ]; then
echo -e "\e[1;32m The tablespace ${tablespace_name} exits! \e[0m"
rm -rf ${outfiletmp03}
exit 1
else
wind_var=$(
sqlplus -s "{ora_user}/${ora_pass} as sysdba" < create tablespace ${tablespace_name}
datafile '${ora_data}/${tablespace_name}.dbf'
size $tablespace_size
extent management local
uniform size 128k
segment space management auto;
EXIT ;
EOF)
echo -e "\e[1;32m ${wind_var} \e[0m" #Direct display returns results
rm -rf ${outfiletmp03}
exit 1

fi

Oracle 11g 在RedHat Linux 5.8_x平台的安装手册

Linux-6-下安装Oracle 12C笔记

在CentOS 6.4下安装Oracle 11gR2(x)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

本文永久更新链接地址:

下载本文
显示全文
专题