数据库的基本导入

PLSQL创建用户步骤

转义

select * from bis_acc_his_dtl where acc_name like '%\%%' escape '\'; 
select * from dba_directories
--创建目录
create directory dpdata as 'd:/dpdata'

--给权限
grant all on directory dpdata to gfcw;


expdp lljf05/TEST@127.0.0.1:1521/orcl DIRECTORY=DATA_PUMP_DIR dumpfile=lljf05.dmp VERSION=11.1.0.6.0
@pause

exp username/password@oracleservice file=c:\backup%date:~4,4%%date:~9,2%%date:~12,2%.dmp    owner=(lee)
--导入的表复制到创建的文件目录
--导入的用户 目录  文件 原始的用户名当前用户名 

impdp gfcw/gfcw directory=dpdata dumpfile=201603151012.DMP  logfile=aa.log remap_schema=TEST:gfcw remap_tablespace=TEST:users


imp gy/gy@127.0.0.1:1521/orcl file=E:\备份20160401\数据库备份\gfcwgs\gy-04-29.dmp tablespaces=gync log=D:\bb.log fromuser=TEST touser=gy

select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name
	1.创建两个表空间:NNC_DATA01.DBF 和 NNC_INDEX01.DBF :  
	create tablespace NNC_DATA01  
	logging    
	datafile 'H:\IDE\oracle\oradata\orcl\NNC_DATA01.dbf'   
	size 50m    
	autoextend on    
	next 50m maxsize 32767m    
	extent management local;   
	  
	  
	create tablespace NNC_INDEX01  
	logging    
	datafile 'H:\IDE\oracle\oradata\orcl\NNC_INDEX01.dbf'   
	size 50m    
	autoextend on    
	next 50m maxsize 32767m    
	extent management local;     
	  
	alter tablespace NNC_DATA01    
	add datafile 'H:\IDE\oracle\oradata\orcl\NNC_DATA02.dbf' size 50m   
	autoextend on next 50m maxsize 32767m;  
	  
	  
	2.创建用户nc633jx/a:  
	Create user nc633jx identified by a default tablespace NNC_DATA01 temporary  tablespace temp;  
	  
	3.授权用户:  
	Grant connect,dba to nc633jx;   
	  
	4.还原数据库nc633jx:  
	impdp nc633jx/a[@orcl](https://my.oschina.net/u/3674287) schemas=nc633jx directory=DATA_PUMP_DIR dumpfile=1009jt1.DMP logfile=1009jt1.log   
	  
	  
	-------------------------------------------------------------------------------------------------------------------------------  
	-------------------------------------------------------------------------------------------------------------------------------  
	  
	5.删除表空间:  
	drop tablespace  NNC_DATA01  including contents and datafiles;  
	drop tablespace  NNC_INDEX01 including contents and datafiles;  
	  
	  
	6.删除数据库用户:  
	drop user  nc633jx cascade;  
	  
	  
	7.删除磁盘上生成的表空间文件:  
	H:\IDE\oracle\oradata\orcl\NNC_DATA01.dbf  
	H:\IDE\oracle\oradata\orcl\NNC_INDEX01.dbf  
    原文作者:数据库基础
    原文地址: https://my.oschina.net/findurl/blog/1559404
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞