oracle 以用户模式导入导出 oracle 以用户模式导入导出

①:查询该用户下的对象  
Sql代码     收藏代码
  1. select OBJECT_TYPE,COUNT(*) from all_objects where OWNER='用户名'  
  2. GROUP BY OBJECT_TYPE;  
用户名处大写  
②:导出xining 用户下的所有对象(包括数据)  
Cmd代码     收藏代码
  1. C:\>exp xining/xining@ylx file=e:\data_xn.dmp log=e:\log_xn.log owner=xining  

③:新建用户(xining/xining)  
在新库上新建用户:(要用有dba权限的用户登陆)  
Sql代码     收藏代码
  1. create user xining  
  2. identified by xining  
  3. default tablespace USERS  
  4. temporary tablespace TEMP;  

④:授权  
Sql代码     收藏代码
  1. grant dba to xining with admin option;  
  2. grant connect to xining with admin option;  
  3. grant resource to xining with admin option;  
  4. alter user xining default role dba,connect,resource;  

⑤:导入  
Cmd代码     收藏代码
  1. C:\>imp xining/xining@orcl file=e:\data_xn.dmp log=e:\log_xn.log fromuser=xining touser=xining  

⑥:重启服务(OS:windows)  
Sql代码     收藏代码
  1. c:\>lsnrctl stop/start --停止/启动 监听器  
  2. c:\>net stop/start oracleserivce"库名" --停止/启动 服务  


⑦:删除该用户的所用对象  
以非该用户且有管理员角色的用户登陆,然后再执行下列sql语句:  
注: 该语句慎用  
Sql代码     收藏代码
  1. drop user xining cascade;  

猜你喜欢

转载自j1017631563.iteye.com/blog/2078558