oracle 如何使用 sql 加载器将数据从不同的模式/数据库假脱机到平面文件中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19140808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to spool data into a flat file from a different schema/database by using sql loader?
提问by JohnD
SELECT column1
FROM (SELECT column1 FROM SCHEMA_B.ABC);
The above is a sample of my spool script attempting to spool data into a flat file from a different database. What are the steps to make it happen? Do I need permission/access to that database? How does it work? I am fairly new to this, so a thorough explanation will be appreciated.
以上是我的假脱机脚本的示例,该脚本试图将数据从不同的数据库假脱机到平面文件中。实现它的步骤是什么?我需要权限/访问该数据库吗?它是如何工作的?我对此相当陌生,因此将不胜感激。
Thanks in advance.
提前致谢。
采纳答案by Rajesh Chamarthi
SQL loader is a tool to load data into a database, not to get data out.
SQL loader 是一种将数据加载到数据库中的工具,而不是将数据取出。
You can change the query to get data in the exact format you want and then use SPOOL, which is a SQLPLUS command to print data to a file. Something like this.
您可以更改查询以获取您想要的确切格式的数据,然后使用 SPOOL,这是一个 SQLPLUS 命令将数据打印到文件。像这样的东西。
sqlplus <connection_details>
spool "C:/Documents/Downloads/data_out.txt"
select empname || ',' || ename
from emp
where dept = 10
spool off;
The data from the query would be spooled to the text file.
来自查询的数据将被假脱机到文本文件。
Another option, if you are using a tool like SQL Developer or Toad is click on the data grid in the results tab and "export". There are a bunch of options to export data in various formats.
另一种选择是,如果您使用 SQL Developer 或 Toad 等工具,则单击结果选项卡中的数据网格并“导出”。有很多选项可以以各种格式导出数据。