oracle 导入数据泵常用语句

window10 导出导入数据泵文件

导入数据泵文件

首先将数据泵文件放在oracle安装得对应位置,例如:D:DevelopEnvironmentOracleadminorcldpdump

impdp system/Aa123456@127.0.0.1:1521/ORCL DIRECTORY=DATA_PUMP_DIR DUMPFILE=RB2.DMP LOG=import.log
导出数据泵文件

导出的数据泵文件默认在oracle的对应位置,例如:D:DevelopEnvironmentOracleadminorcldpdump

expdp system/Aa123456@127.0.0.1:1521/ORCL CLUSTER=N DIRECTORY=DATA_PUMP_DIR DUMPFILE=RB1_12c.DMP LOGFILE=RB1_21cto12C.log  SCHEMAS=C##CCYB compression=all VERSION=12.2.0.1.0 

oracle表空间查询、剩余空间查询

查询表空间大小及对应文件
SELECT tablespace_name, 
file_id, 
file_name, 
round(bytes / (1024 * 1024), 0) total_space 
FROM dba_data_files 
ORDER BY tablespace_name;
查询各个表空间大小
SELECT a.tablespace_name "表空间名称", 
total / (1024 * 1024) "表空间大小(M)", 
free / (1024 * 1024) "表空间剩余大小(M)", 
(total - free) / (1024 * 1024 ) "表空间使用大小(M)", 
total / (1024 * 1024 * 1024) "表空间大小(G)", 
free / (1024 * 1024 * 1024) "表空间剩余大小(G)", 
(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)", 
round((total - free) / total, 4) * 100 "使用率 %" 
FROM (SELECT tablespace_name, SUM(bytes) free 
FROM dba_free_space 
GROUP BY tablespace_name) a, 
(SELECT tablespace_name, SUM(bytes) total 
FROM dba_data_files 
GROUP BY tablespace_name) b 
WHERE a.tablespace_name = b.tablespace_name ;
扩充表空间

表空间扩展最大32G

-- 可以先用上述查询表空间大小及对应文件,查询出表空间存放位置,再根据原来位置设置新的文件
ALTER TABLESPACE SYSTEM ADD DATAFILE 'C:ORACLEAPPTAIKANGORADATAORCLSYSTEM02.DBF' SIZE 32760M AUTOEXTEND ON;
-- 表空间大小最大32G,不能等于32G
ALTER TABLESPACE USERS ADD DATAFILE 'C:ORACLEAPPTAIKANGORADATAORCLUSERS02.DBF' SIZE 32760M AUTOEXTEND ON;

ALTER TABLESPACE SYSAUX ADD DATAFILE 'C:ORACLEAPPTAIKANGORADATAORCLSYSAUX_02.DBF' SIZE 32760M AUTOEXTEND ON;

ALTER TABLESPACE UNDOTBS1 ADD DATAFILE 'C:ORACLEAPPTAIKANGORADATAORCLUNDOTBS02.DBF' SIZE 32760M AUTOEXTEND ON;