登录
sql > sqlplus / as sysdba

创建表空间
sql > create tablespace TABLESPACE datafile 'e:\tables1.dbf' size 1m segment space management auto;
赋予自动增长
sql > alter database datafile 'e:\tables1.dbf' autoextend on;

删除表空间及删除文件
sql > drop tablespace TABLESPACE including contents and datafiles;

创建用户
sql > create user USERNAME identified by hanweb default tablespace TABLESPACE;
权限赋予
sql > grant connect,resource,dba,unlimited tablespace to USERNAME with admin option;
sql > grant sysdba to USERNAME with admin option;

删除用户
sql > drop user USERNAME cascade;


退出数据库:Ctrl+C 或 sql > quit/exit

imp导入数据
imp USERNAME/PASSWORD@ORCL file='D:\backup\DMPNAME.dmp' log='d:\backuplog\DMPNAME.log' ignore=y full=y

impdp导入数据
创建.dmp文件所在文件夹容器 并需电脑手动创建
sql > create directory DIRDP as 'd:\backup';
退出数据库执行:
impdp USERNAME/PASSWORD@ORCL directory=DIRDP dumpfile='DMPNAME.dmp' logfile='DMPNAME.log' full=y

 

其它SQL语句
查看各表空间分配情况
sql > select tablespace_name, sum(bytes) / 1024 / 1024 from dba_data_files group by tablespace_name;

关闭表空间自增长
sql > alter database datafile 'e:\mytables1.dbf' autoextend off;

查看表空间状态
sql > select tablespace_name tb_n,file_name f_n,autoextensible auto from dba_data_files;

查看各表空间空闲情况
sql > select tablespace_name, sum(bytes) / 1024 / 1024 from dba_free_space group by tablespace_name;

更改数据表大小(10G)
sql > alter database datafile 'e:\DBFNAME.dbf' resize 10240m;

posted on 2017-12-20 15:02  MC伍  阅读(278)  评论(0编辑  收藏  举报