开发者

Oracle SQL Developer - Default database connection when running external SQL scripts

开发者 https://www.devze.com 2023-03-05 11:51 出处:网络
What I would like to do, is connect to a database, open a number of external sql files and then execute them against the database I am connected to.

What I would like to do, is connect to a database, open a number of external sql files and then execute them against the database I am connected to.

The problem is, when the sql scripts are opened, they do not default to looking at the previously opened connection. Instead, when I run the scripts, they prompt me to select the connection 开发者_如何转开发I want. As I have a large number of scripts and a large number of databases, this opens the possibility of human error creeping in and the wrong connection being selected.

My question: Is there a way of opening an external sql script and getting it to default to a specific connection/database?

Many Thanks


  • Create a file containing a row for each script you want to run, prefixed with @:

    @c:\dev\database\script1.sql

    @c:\dev\database\script2.sql

  • Open this file in SQLDeveloper and click the "Run Script" (F5)

You will only be asked once for the database connection and then it will run each of the files you have specified.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号