batch-file - 带有 Windows 批处理文件的 SQLPLUS 命令行

标签 batch-file sqlplus oracle9i

我想创建一个批处理文件,它将打开 SQLPLUS [CLI] 并执行一些存储的 sql 文件,并将输出存储到文本文件。

所以我创建了这个批处理文件 [它不起作用]。
这些 SQL 文件包含从表中返回最大数量的 SQL。

sqlplus scott/tiger@DB
@sql1.sql>data1.txt
@sql2.sql>data2.txt

问题是它在打开 SQLPLUS 后不执行 SQL 文件
  • Windows XP
  • 甲骨文 9i
  • 最佳答案

    原生 Sql*plus 假脱机怎么样?

    运行.bat:

    sqlplus hr/hr@sandbox @d:\run.sql
    

    运行.sql:
    spool d:\run.log
    set echo on 
    
    select * from dual
    /
    exit
    

    运行日志:
    01:50:20 HR@sandbox> 
    01:50:20 HR@sandbox> select * from dual
    01:50:20   2  /
    
    D
    -
    X
    
    Elapsed: 00:00:00.00
    01:50:21 HR@sandbox> exit
    

    关于batch-file - 带有 Windows 批处理文件的 SQLPLUS 命令行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16412040/

    相关文章:

    oracle11g - Oracle SQL Plus : Error “ORA-00922: missing or invalid option” when creating user

    sql - 查找必须搜索多少次表才能获得匹配的 Oracle 数据库

    c - 批处理文件启动但在 c 中启动时命令不运行

    c - (Game Boy Advance) 程序从 0x00000000 而不是 0x08000000 开始。如何告诉 gcc 编译到特定地址?

    包含二进制可执行文件的 Windows 批处理脚本

    html - Oracle sqlplus HTML 报告 - 交替行颜色

    windows - 批处理文件以更改目录并运行命令

    oracle - 如何解决 “ORA-01109: database not open”错误?

    sql - 我如何知道在 oracle 9i 中哪些值是数字

    sql - 如何导出 Oracle 统计信息