Oracle数据库运维经验(一)

#示例
create tablespace boyuyun datafile 'G:\Oracle\xedatas\boyuyun.dbf' size 512M 
autoextend on next 32M maxsize unlimited logging 
extent management local autoallocate 
segment space management auto; 

create user byytest identified by byytest default tablespace boyuyun temporary tablespace temp; 
grant dba,connect,resource to byytest; 

#SQLPlus登录
sqlplus system/123456@XE as sysdba

#dmp文件导入
imp byytest/byytest@XE file=I:\boyuyun_20190306\boyuyun_20190306.dmp full=y

#删除表空间
drop tablespace DANZHOU including contents and datafiles;  

开启Oracle服务 
Win+R输入cmd打开命令提示符窗口 
登录 
sqlplus /nolog 
connect /as sysdba; 


#创建表空间 
create tablespace tablespace_name logging datafile ‘G:\Oracle\xedatas\boyuyun.dbf’ size 64m; 
#创建用户(指定默认表空间,所以要先创建表空间) 
create user test1 identified by test1 default tablespace test1 temporary tablespace temp; 
#授予相应权限 
grant dba,connect,resource to test1; 

#FAQ
如果表空间大小不足,可以设置让表空间超载时自动增长: 
alter database datafile ‘D:\test1.dbf’ autoextend on next 100m; 
上条语句使得表空间将满时会自动增加100m大小空间,还有另外一种增加方法: 
alter database datafile ‘D:\test1.dbf’ autoextend on next 100m maxsize 500m; 
这条语句意味着表空间每次可以增加100M,但累计增加到500M后将不再增加。 

你可能感兴趣的:(Oracle)