我想将 unix 和 sqlplus 的输出复制到一个文件中

发布于 2024-08-25 04:57:27 字数 104 浏览 4 评论 0原文

我正在使用Solaris。我必须登录 sql plus 并运行一些查询,这会产生巨大的结果集。

我想将所有内容复制到一个文件中。 unix 或 sqlplus 中是否有任何命令?

I am using Solaris. I have to log into sql plus and run some queries, which give a huge result set.

I want to copy all that into a file. Is there any command for it in unix or sqlplus ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

歌入人心 2024-09-01 04:57:27

使用 SPOOL 命令:

SQL> SPOOL /opt/output

SQL> SELECT ...

SQL> SPOOL OFF

Use the SPOOL command:

SQL> SPOOL /opt/output

SQL> SELECT ...

SQL> SPOOL OFF
夜唯美灬不弃 2024-09-01 04:57:27

设置 Oracle 环境

(有多种方法可以在命令行上指定用户名/密码 - 这不是最好的方法,尤其是当其他用户可以在服务器上“ps”并查看您的密码时)

sqlplus -s username/password <<-!!
set trimspool on trimout on pages 0 feedback off linesize 1000 echo off verify off
spool file.out
select sysdate from dual;
exit
!!

setup Oracle environment

(there are ways around specifying username/password on the command line - not the best way especially when other users can 'ps' on the server and see your password)

sqlplus -s username/password <<-!!
set trimspool on trimout on pages 0 feedback off linesize 1000 echo off verify off
spool file.out
select sysdate from dual;
exit
!!
别念他 2024-09-01 04:57:27

如果您在命令行上,则只需使用 >以及2>将 stdout 和 stderr 分别重定向到日志文件

func >输出.log

If you are on the command line then just use the > and 2> to redirect stdout and stderr respectively to log files

func > out.log

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文