以sysas sysdba的形式执行sql语句



我在一个脚本中执行了一条sql语句,该脚本连接到sqlplus并执行一些GRANTS语句。在bash脚本中,指令类似于:

sqlplus sys as sysdba @script.sql

但我需要添加密码。我怎么能在一行中完成?

我试过了:

sqlplus "sys as sysdba"/password @script.sql

或者没有",但它不起作用。感谢

示例1

oracle@esmd:~> sqlplus /  as sysdba @ulcase1.sql
SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 21 12:07:50 2020
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
Disconnected from Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
oracle@esmd:~>

示例2

oracle@esmd:~> sqlplus sys/password  as sysdba @ulcase1.sql
SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 21 12:08:44 2020
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
Disconnected from Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
oracle@esmd:~>

示例3

oracle@esmd:~> sqlplus sys/password@esmd  as sysdba @ulcase1.sql
SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 21 12:14:49 2020
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
Disconnected from Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
oracle@esmd:~>

您可以通过以下方式执行:

sqlplus sys/password as sysdba @script.sql

相关内容

  • 没有找到相关文章

最新更新