浅谈oracle数据库如何在Linux系统下登录SCOTT用户

这篇文章的前提是Linux系统已经装好了oracle数据库,只需要简单的几个步骤登录oracle中的用户。

一般我们用到oracle数据库都是使用HR用户和SCOTT用户居多,登录这两个用户的方法也十分简单。

1.首先需要从root切换到oracle,用命令# su - oracle。这里需要注意,中间的“-”必须加,这是因为,su - oracle是以login shell登陆的,相当于重新登录,此时用户的家目录和PATH等信息会发生改变,而su oracle,切换到oracle身份后用户的家目录和PATH仍然是原先用户的家目录和PATH,也就是之前登录的root用户。

[root@liucool oracle]# su - oracle

Last login: Sat Jul 21 03:53:15 EDT 2018 on pts/1

2.启监听
[oracle@liucool ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JUL-2018 03:53:38

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started

扫描二维码关注公众号,回复: 2292943 查看本文章

3.以操作系统权限认证的oracle sys管理员登录。出现如下提示表示登录成功
[oracle@liucool ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 21 03:53:57 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

4.启动

SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first

5.登录SCOTT用户,注意空格,SCOTT用户的默认密码是TIGER,orcl是你自己创建的实例名,根据个人情况来
SQL> conn scott / tiger@orcl
Connected.
SQL> 

至此,就已经登录到SCOTT用户了,可以在这里写SQL语句,对SCOTT用户下的表或视图进行操作。若要使用DML对表进行增删改,需注意权限的问题。


本文用于个人学习以及初学者相互借鉴,有不足的地方望见谅。如有错误欢迎指出,大家一起进步!!

猜你喜欢

转载自blog.csdn.net/m0_38053639/article/details/81145671