我有oracle数据库表并有20000000条记录。我想将数据导出到多个文件中。我正在使用Oracle SQL Developer。谁能帮助我如何根据我的要求导出数据或建议男人使用开源工具?
答案 0 :(得分:1)
您可以使用PowerShell或linux shell分割文本文件。
How to Split Large Text File into Smaller Files in Linux
Linux示例
#split -l 100000 test.txt新
Windows示例
How can I split a text file using PowerShell?
split_log.ps1
param(
[string]$input_file = "",
[string]$count_line = ""
)
$lineCount = 0
$fileCount = 1
foreach ($line_file in get-content $input_file)
{
write $line_file | out-file -encoding ASCII -Append $input_file"_"$fileCount".out"
$lineCount++
if ($lineCount -eq $count_line)
{
$fileCount++
$lineCount = 0
}
}
PS C:\АСУ\Stackoverflow\split_log> ls
Каталог: C:\АСУ\Stackoverflow\split_log
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 17.12.2018 6:03 10959355 1124.sql
-a--- 17.12.2018 7:27 357 split_log.ps1
PS C:\АСУ\Stackoverflow\split_log> .\split_log.ps1 .\1124.sql 10000
PS C:\АСУ\Stackoverflow\split_log> ls
Каталог: C:\АСУ\Stackoverflow\split_log
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 17.12.2018 6:03 10959355 1124.sql
-a--- 17.12.2018 7:50 2461667 1124.sql_1.out
-a--- 17.12.2018 7:50 2461458 1124.sql_2.out
-a--- 17.12.2018 7:50 2461340 1124.sql_3.out
-a--- 17.12.2018 7:50 2461352 1124.sql_4.out
-a--- 17.12.2018 7:50 1113540 1124.sql_5.out
-a--- 17.12.2018 7:27 357 split_log.ps1