一、信息查询
查询字符集
SELECT Userenv('language') FROM dual;
二、表空间、用户
查询表空间占用
select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;
查询表空间文件路径
select name from v$datafile;
创建表空间
# PANG_HU :表空间名称
# '/data/oracle/oradata/orcl/PANG_HU.dbf' :表空间文件路径
# size 100m :初始容量
# autoextend on next 100m :自动增长,每次增加100m
create tablespace PANG_HU datafile '/data/oracle/oradata/orcl/PANG_HU.dbf' size 100m
autoextend on next 100m;
创建用户并指定默认表空间
#
create user PANG_HU identified by "123456" default tablespace PANG_HU;
用户授权
grant connect,resource,dba to PANG_HU;
级联删除表空间、用户
DROP TABLESPACE PANG_HU INCLUDING CONTENTS AND DATAFILES;
drop user PANG_HU cascade;
三、导入导出
创建导入导出目录
# expdir :目录名
create directory expdir as '/home/oracle';
给用户PANG_HU授权expdir目录
GRANT READ,WRITE ON DIRECTORY expdir to PANG_HU;
-----导入
impdp PANG_HU/123456@127.0.0.1:1521/orcl directory=expdir dumpfile=dbfile_01.dmp tablespaces=PANG_HU
-----导出
expdp PANG_HU/a123456 cluster=n schemas=PANG_HU dumpfile=dbfile_01.dmp logfile=expyth_asset.log directory=expdir