Oracle: Use the SPOOL command to record the operation log

Requirement: select * from dual to be executed; and the content of retrieval is in the customized file d:\test.txt.
Practice:

  1. win+R enter cmd to call up the command window
  2. sqlplus connects to the database "sqlplus username/password@ip:port number/service name"
  3. spool d:\test.txt
  4. Implementation such as: select * from dual;
  5. spool off

Example

set head off
set trimspool on
set pagesize 0
set linesize 1000
set termout off
set feedback off
set arraysize 30
set feedback off
set echo off
spool C:\Users\lianhong.li\Desktop\test\test.csv
select * from T_REWARD_COMMISSION_1212;
spool off

Guess you like

Origin blog.csdn.net/weixin_42161670/article/details/102724252