目录
删除数据文件(注意不能删除第一个创建的数据文件,除非删除所有)
甲骨文用户
SYS,SYSTEM,SYSMAN,斯科特
其中sys,system,sysman的在安装的时候都是可以指定的
在SYS,SYSTEM,SYSMAN,斯科特四个用户权限中,斯科特用户最低。
使用的SQLPlus工具进行登录
好吧,今天我们的SQL Plus又出现了问题,协议适配器错误
协议适配器错误解决方案
原来是自己没有启动的Oracle相关的服务,
开始---程序---管理工具---服务,打开服务面板,启动OracleServiceORCL服务
再次连接成功
查看用户
查看当前用户
显示用户
从数据字典中查询相关的字段
desc dba_users
查看常用的数组字典中的用户
select username from dba_users
启动scott用户
scott用户是默认被锁定的
alter user username account unlock //解锁scott用户
username 可以是任何值
scott用户的默认密码就是tiger
表空间
表空间是数据库的空间用来存放数据库的对象。
表空间分为 “”永久表空间“”,“”临时表空间“”,“”undo表空间“”
undo表空间用来保存被修改之前的数据,当对一张表进行修改的时候,undo表空间会对数据进行保存,方便以后回滚
创建永久表空间
创建一个大小为10mb的永久表空间名称为test1_tablespace
create tablespace test1_tablespace datafile 'test.dbf' size 10m;
创建临时表空间
create temporary tablespace temptest2_tablespace tempfile '22.dbf' size 10m;
查询默认数据存放的位置
select file_name from dba_data_files where tablespace_name ='TEST1_TABLESPACE';(表空间名要大写)
修改永久表空间
修改表的状态 设置脱机状态
alter tablespace test1_tablespace online|offline
修改表空间的只读或者可读写的状态
alter tablespace test1_tablespace readonly|read write
增加数据文件
alter tablespace test1_tablespace add datafile'test2_file.dbf'size 20m;
删除数据文件(注意不能删除第一个创建的数据文件,除非删除所有)
alter tablespace test1_tablespace drop datafile'test2_file.dbf'size 20m;
删除表空间
drop tablespace test1_tablespace //只删除表空间不删除文件
drop tablespace test1_tablespace包括内容//表空间和文件全部删除。