码迷,mamicode.com
首页 > 数据库 > 详细

二 sqlplus 常用命令-基础版

时间:2016-02-02 21:36:29      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:

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 常用命令-基础版

标签:

原文地址:http://www.cnblogs.com/fsckzy/p/5178214.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!