ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【DBA脚本】运行SQLPLUS工具

【DBA脚本】运行SQLPLUS工具

原创 Linux操作系统 作者:chicheng_cn421 时间:2011-12-17 21:00:15 0 删除 编辑


SQL*PLUS是Oracle提供给我们与oracle数据库进行交互的客户端工具,它的安装路径位于安装目录下的bin文件夹下,如:C:\oracle\product\10.2.0\db_1\BIN\sqlplus.exe 。

根据应用不同,一般常见的sqlplus启动方法有三种。(直接上例子了)

1、启动Sqlplus+登录用户一步完成

C:\>sqlplus scott/tiger@chic

----------------------------------------
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>cd \
C:\>sqlplus scott/tiger@chic
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 12月 17 21:02:08 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
----------------------------------------

2、启动Sqlplus与登录用户分开完成

C:\>sqlplus /nolog
SQL> conn
scott/tiger@chic

----------------------------------------
例子1:(连接到普通用户)

C:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 12月 17 21:02:21 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn scott/tiger@chic
已连接。
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开

例子2:(连接到SYSTEM用户 ,用法上没有区别,一般非DBA权限应用时常用)

C:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 12月 18 06:36:44 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn system/sys@chic
已连接。
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:\>

例子3:(以OS认证方式连接到SYS用户 ,用法上没有区别,一般需要DBA权限应用时常用) 
C:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 12月 18 06:36:29 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn / as sysdba
已连接。
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
----------------------------------------

3、以OS认证(操作系统认证)方式 登录数据库 (限制:只能在数据库所在服务器上使用)
※关于OS认证,可以参考我博客中的另外一篇文章
【登陆认证】oracle的操作系统认证和口令文件认证方式(转载)

C:\>sqlplus / as sysdba

----------------------------------------
C:\>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 12月 17 21:02:44 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:\>
----------------------------------------

以上。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/20335819/viewspace-713504/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-03-05

  • 博文量
    261
  • 访问量
    417491