shell里查询oracle里v$视图需要转义

 

[oracle@lenovo scripts]$ more check_db_block_corruption.sh 
#!/bin/bash
##source /etc/profile
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1
export ORACLE_BASE=/u01/app/oracle
export TNS_ADMIN=/u01/app/oracle/product/11.2.0.4/db_1/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=${ORACLE_HOME}/bin:$PATH

block_cnt=`sqlplus -S hxl/oracle@DEV_NEW<<eof
set heading off feedback off pagesize 0 verify off echo off
select count(1) from v\\$database_block_corruption;
exit;
eof`


echo $block_cnt

 

posted @ 2023-12-20 10:14  slnngk  阅读(32)  评论(0编辑  收藏  举报