二 sqlplus 常用命令-基础版
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了二 sqlplus 常用命令-基础版相关的知识,希望对你有一定的参考价值。
1.连接 conn
1.1 以oracle用户登录系统,进入sqlplus环境,后以管理员模式登录
1 oracle@yas:~> sqlplus /nolog 2 SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 2 17:44:21 2016 3 Copyright (c) 1982, 2009, Oracle. All rights reserved. 4 SQL> show user; 5 USER is "" 6 SQL> conn / as sysdba 7 Connected. 8 SQL> show user; 9 USER is "SYS"
1.2 普通用户登录 conn 用户/密码
1 SQL> conn t1/t1 2 Connected. 3 SQL> show user; 4 USER is "T1"
2.断开连接 disc
1 SQL> disc 2 Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 3 With the Partitioning, OLAP, Data Mining and Real Application Testing options
3.修改密码 passw
1 SQL> passw 2 Changing password for T1 3 Old password: #输入原密码 4 New password: #新密码 5 Retype new password: #再输入一次新密码 6 Password changed
4.显示当前用户 show user;
1 SQL> conn t1/t1 2 Connected. 3 SQL> show user; 4 USER is "T1"
5.退出 exit 端口与当前数据库的连接,并退出sqlplus
1 SQL> exit 2 Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 3 With the Partitioning, OLAP, Data Mining and Real Application Testing options
6.查看数据库版本
1 SQL> select * from v$version; 2 3 BANNER 4 -------------------------------------------------------------------------------- 5 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production 6 PL/SQL Release 11.2.0.1.0 - Production 7 CORE 11.2.0.1.0 Production 8 TNS for Linux: Version 11.2.0.1.0 - Production 9 NLSRTL Version 11.2.0.1.0 - Production
7.启动/关闭实例,开启是startup,关闭为什么是shutdown immediate呢?正常关闭时间较长。
shutdown --正常关闭(等待所有用户断开连接后才能关闭)
shutdown immediate--建议使用(迫使用户执行当前SQL后立即断开连接)
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 576221184 bytes Fixed Size 2215464 bytes Variable Size 432013784 bytes Database Buffers 138412032 bytes Redo Buffers 3579904 bytes Database mounted. Database opened.
8. 查看执行过的命令 list\l 这里因为刚刚重启了数据库,所以只有这一条了。
1 SQL> l 2 1* select username,sid,serial# from v$session
以上是关于二 sqlplus 常用命令-基础版的主要内容,如果未能解决你的问题,请参考以下文章