如何在 Oracle SQL 开发者工具中运行 .sql 文件来导入数据库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31560367/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 03:50:41  来源:igfitidea点击:

How to run .sql file in Oracle SQL developer tool to import database?

sqloracleoracle-sqldeveloper

提问by Madhusudan

I have exported database from Oracle SQL developer tool into .sql file. Now I want to run this file which is of size 500+ MB.

我已将数据库从 Oracle SQL 开发人员工具导出到 .sql 文件中。现在我想运行这个大小为 500+ MB 的文件。

I read about running scripts here, but I didn't understand the way. Is there any command or query by which we can run this sql script by providing path?

在这里阅读了有关运行脚本的信息,但我不明白其中的方法。是否有任何命令或查询可以通过提供路径来运行此 sql 脚本?

回答by Lalit Kumar B

You could execute the .sqlfile as a script in the SQL Developerworksheet. Either use the Run Scripticon, or simply press F5.

您可以将该.sql文件作为SQL Developer工作表中的脚本执行。要么使用运行脚本图标,要么直接按F5

enter image description here

在此处输入图片说明

For example,

例如,

@path\script.sql;

Remember, you need to put @as shown above.

请记住,您需要按上图放置@

But, if you have exported the database using database export utility of SQL Developer, then you should use the Import utility. Follow the steps mentioned here Importing and Exporting using the Oracle SQL Developer 3.0

但是,如果您使用 SQL Developer 的数据库导出实用程序导出了数据库,那么您应该使用导入实用程序。按照此处提到的步骤使用 Oracle SQL Developer 3.0 导入和导出

回答by Sandeep

You need to Open the SQL Developer first and then click on Fileoption and browse to the location where your .sql is placed. Once you are at the location where file is placed double click on it, this will get the file open in SQL Developer. Now select all of the content of file (CTRL + A)and press F9key. Just make sure there is a commit statement at the end of the .sql script so that the changes are persisted in the database

您需要先打开 SQL Developer,然后单击文件选项并浏览到放置 .sql 的位置。一旦您在放置文件的位置双击它,这将在 SQL Developer 中打开文件。现在选择文件的所有内容(CTRL + A)并按F9键。只需确保在 .sql 脚本的末尾有一个 commit 语句,以便将更改保留在数据库中

回答by J Woodchuck

As others recommend, you can use Oracle SQL Developer. You can point to the location of the script to run it, as described. A slightly simpler method, though, is to just use drag-and-drop:

正如其他人推荐的那样,您可以使用 Oracle SQL Developer。如上所述,您可以指向脚本的位置来运行它。不过,一个稍微简单的方法是使用拖放:

  • Click and drag your .sql file over to Oracle SQL Developer
  • The contents will appear in a "SQL Worksheet"
  • Click "Run Script" button, or hit F5, to run
  • 单击并将您的 .sql 文件拖到 Oracle SQL Developer
  • 内容将出现在“SQL 工作表”中
  • 单击“运行脚本”按钮,或点击F5,运行

enter image description here

在此处输入图片说明