Oracle
1.
(1)SQL*Plus命令行工具(注意:反斜杠(/) 前必须加空格)
开启:
![Oracle数据库1](/Images/jiaocheng/2015-06-05/4245009530.jpg)
(2)运行cmd命令
2.连接Oracle数据库
(1)SQL*Plus连接成功后就如图所示:
![Oracle数据库2](/Images/jiaocheng/2015-06-05/3031278996.jpg)
(2)运行cmd连接成功:
![Oracle数据库3](/Images/jiaocheng/2015-06-05/537051173.jpg)
<喎�"/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+way907W9T3JhY2xlt/7O8cb3tcTD/MHuysejujwvcD4KPHA+Y29ubiDTw7unw/svw9zC6yBh
cyDBrL3Tye233UC3/s7xxvfBrL3T19a3+7SuPC9wPgo8cD7LtcP3o7o8L3A+CjxwPjxpbWcgc3JjPQ=="www.2cto.co
m/uploadfile/Collfiles/20140409/2014040911060921.png" alt="">
连接身份:表示该用户连接后拥有的权限
sysdba(数据库管理员),sysyoper(数据库操作员),normal(普通用户)
3.
(1)查询用户下的所有表 select distinct table_name from user_tab_columns
![Oracle数据库4](/Images/jiaocheng/2015-06-05/1727032828.jpg)
(2)查找用户下的所有表:select * from tab;
![Oracle数据库5](/Images/jiaocheng/2015-06-05/3026911933.jpg)
4.服务器连接字符串的配置文件
安装目录:G:appmeimeiproduct12.1.0dbhome_1NETWORKADMINlistener.ora
客户端工具可以根据“服务器连接字符串”对服务器进行连接,有了连接字符串后,客户端就可操作远程别人数据库。
![Oracle数据库6](/Images/jiaocheng/2015-06-05/2133493846.jpg)
5.Oracle用户和权限
(1)创建表
![Oracle数据库7](/Images/jiaocheng/2015-06-05/2386450654.png)
(2)插入数据
![Oracle数据库8](/Images/jiaocheng/2015-06-05/2198819064.jpg)
(3)创建用户
![Oracle数据库9](/Images/jiaocheng/2015-06-05/1020193827.png)
(4)用户授权一:CONNECT角色允许用户连接至数据库,并创建数据库对象
![Oracle数据库10](/Images/jiaocheng/2015-06-05/3228968757.png)
用户授权二:RESOURCE角色允许用户使用数据库中的存储空间
![Oracle数据库11](/Images/jiaocheng/2015-06-05/413576346.png)
(5)更改用户:
![Oracle数据库12](/Images/jiaocheng/2015-06-05/2909780023.png)
(6)连接
![Oracle数据库13](/Images/jiaocheng/2015-06-05/1707169385.png)
6.查询系统下所有的用户
![Oracle数据库14](/Images/jiaocheng/2015-06-05/249277398.jpg)
7.创建表空间
![Oracle数据库15](/Images/jiaocheng/2015-06-05/2672731564.jpg)
切换日志文件
![Oracle数据库16](/Images/jiaocheng/2015-06-05/800223391.jpg)
8.查询表的字段
![Oracle数据库17](/Images/jiaocheng/2015-06-05/60262453.jpg)
9.转化时间类型
![](/201404/10/8a2a9cca89da58f878bb57b58f334030.jpg)
10.修改字段类型
![Oracle数据库18](/Images/jiaocheng/2015-06-05/1822028184.jpg)
11.添加关联外键
![Oracle数据库19](/Images/jiaocheng/2015-06-05/3905464528.jpg)
12.删除表的方式:
(1)drop删除表,直接删除表,rollback后数据也不能恢复
![Oracle数据库20](/Images/jiaocheng/2015-06-05/2241904973.jpg)
(2)delete删除表:数据一回滚,数据还能恢复
![Oracle数据库21](/Images/jiaocheng/2015-06-05/1392312995.jpg)
(3)truncate删除表:只删数据,不删表结构,跟的delete一样,它不写日志,与delete相反
![Oracle数据库22](/Images/jiaocheng/2015-06-05/2665854329.jpg)
13.查询操作系统的大小
![Oracle数据库23](/Images/jiaocheng/2015-06-05/2891389471.jpg)
14.查询系统system下的字节
![Oracle数据库24](/Images/jiaocheng/2015-06-05/1614218592.jpg)
15.查询表空间的所有字段
![Oracle数据库25](/Images/jiaocheng/2015-06-05/1596931514.jpg)
16.查询表空间
![Oracle数据库26](/Images/jiaocheng/2015-06-05/352569960.jpg)
17.查询字段
![Oracle数据库27](/Images/jiaocheng/2015-06-05/3145484283.jpg)
18.查询表段类型
![Oracle数据库28](/Images/jiaocheng/2015-06-05/1483748507.jpg)
19.查询区
![Oracle数据库29](/Images/jiaocheng/2015-06-05/2910873894.jpg)
20.查询student表
![Oracle数据库30](/Images/jiaocheng/2015-06-05/903727780.jpg)
21.查询sc表的主键
![Oracle数据库31](/Images/jiaocheng/2015-06-05/988258013.jpg)
22.删掉sc表的主键
![Oracle数据库32](/Images/jiaocheng/2015-06-05/2860084925.jpg)
23.插入1000个信息
![Oracle数据库33](/Images/jiaocheng/2015-06-05/3038686781.jpg)
24.查询student插入信息后的kb
![Oracle数据库34](/Images/jiaocheng/2015-06-05/2753361315.jpg)
25.修改默认表空间
![Oracle数据库35](/Images/jiaocheng/2015-06-05/620488080.jpg)
26.查询不同的表空间
![Oracle数据库36](/Images/jiaocheng/2015-06-05/1163477539.jpg)
27.修改密码
![Oracle数据库37](/Images/jiaocheng/2015-06-05/3742328952.jpg)
28.删除表空间
![Oracle数据库38](/Images/jiaocheng/2015-06-05/4027187793.jpg)