Oracle 12cでスクリプトsqlファイルを実行する

2021年11月11日

環境
Oracle 12c
Windows Server 2012 R2

書式
sqlplus ユーザーID/パスワード@接続文字列 @ファイル名.sql

1.SQLファイルcft.sql

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SELECT INSTANCE_NAME FROM V$INSTANCE;
SELECT INSTANCE_NAME FROM V$INSTANCE;
SELECT INSTANCE_NAME FROM V$INSTANCE;

2.実行例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
> sqlplus testuser/testpwd@testdb @cft.sql
SQL*Plus: Release 12.2.0.1.0 Production on 木 1111 19:07:16 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
最終正常ログイン時間: 木 1111 2021 18:58:43 +09:00
Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
に接続されました。
INSTANCE_NAME
----------------
orcl
> sqlplus testuser/testpwd@testdb @cft.sql SQL*Plus: Release 12.2.0.1.0 Production on 木 11月 11 19:07:16 2021 Copyright (c) 1982, 2016, Oracle. All rights reserved. 最終正常ログイン時間: 木 11月 11 2021 18:58:43 +09:00 Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production に接続されました。 INSTANCE_NAME ---------------- orcl
> sqlplus testuser/testpwd@testdb @cft.sql

SQL*Plus: Release 12.2.0.1.0 Production on 木 11月 11 19:07:16 2021

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

最終正常ログイン時間: 木 11月 11 2021 18:58:43 +09:00


Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
に接続されました。

INSTANCE_NAME
----------------
orcl

 

Oracle 12c

Posted by arkgame