bat

本文介绍了一个批处理脚本,该脚本用于解析Oracle数据库日志文件以查找错误并提取错误代码。通过find和for循环命令组合使用,能够快速定位到预创建数据库过程中的错误,并返回相应的错误代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

for /f "delims=" %%a in (%current_dir%\precreatedb_error.log) do (
set /a a+=1
if !a!==2 set secondrow=%%a
)
set result=!secondrow:~4,-1!

从第四个开始取取到倒数第一个


 find /i /c "ORA-" %current_dir%\precreatedb.log>%current_dir%\precreatedb_error.log
        FOR /F "tokens=3 delims=:" %%i in (%current_dir%\precreatedb_error.log) do (set record=%%i echo %record%)
        set /A ErrorNu=!record:~1,1!
        if !ErrorNu!==0  ( echo create table successfully,return 0
                echo create bmp tables successfully>%current_dir%\precreatedb_error.log 
        )else ( 
                echo failed to create table,return the error code
                find /i "ORA-" %current_dir%\precreatedb.log>%current_dir%\precreatedb_error.log
                FOR /F %%i in (%current_dir%\precreatedb_error.log) do (set record=%%i)
                set result=!record:~4,-1!


exit /b %result% 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值