首页 > Linux操作系统 > Linux操作系统 > Linux shell
[oracle@zdtdbatest testtablespace]$ cat test.sh
#!/bin/bash
. $HOME/.bash_profile
export ORACLE_SID=$1
echo "your numbe is : ==> $1"
if [ $ORACLE_SID = 'zdtdbat1' ];
then
exit
fi
tablespace=$(cat /home/oracle/check/testtablespace/tablespce.txt)
path=$ORACLE_HOME
$path/bin/sqlplus -s "/as sysdba" <
set head on
spool /home/oracle/check/testtablespace/checkck
set linesize 120 pagesize 10000
col name format a50
select count (distinct a.file_name) from dba_data_files a where a.tablespace_name='$tablespace';
select trim(file_name) file_name from dba_data_files a where a.tablespace_name='$tablespace' and file_id = (select max(file_id) from dba_data_files a where a.tablespace_name = 'TBS_AISHU');
spool off
exit
EOF
[oracle@zdtdbatest testtablespace]$ sh -x test.sh zdtdbat1
++ export LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/db_1/lib
++ LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/db_1/lib
+ export ORACLE_SID=zdtdbat1
+ ORACLE_SID=zdtdbat1
+ echo 'your numbe is : ==> zdtdbat1'
your numbe is : ==> zdtdbat1
+ '[' zdtdbat1 != zdtdbat1 ']'
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15187685/viewspace-733233/ ,如需转载,请注明出处,否则将追究法律责任。