oracle导入DMP步骤

oracle导入DMP步骤如下:
1.已经存在的数据库需要进行以下的操作,如果不存在,可略过:
    删除用户
    drop user SUDMDB cascade;
    删除表空间和数据文件
    drop tablespace SUDMDB including contents and datafiles;
2.创建SUDMDB表空间(需要提前在相应的目录中创建db文件夹,同时确定目录是否正确当前位C:\db\SUDMDB.DBF)
    CREATE TABLESPACE SUDMDB DATAFILE   
 'C:\db\SUDMDB.DBF'  SIZE 5M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED    
LOGGING    
ONLINE    
PERMANENT    
EXTENT MANAGEMENT LOCAL AUTOALLOCATE    
BLOCKSIZE 8K    
SEGMENT SPACE MANAGEMENT AUTO    
FLASHBACK ON;  

3.  创建用户SUDMDB  
--create role
-- RESOURCE  (Role)

--CREATE ROLE RESOURCE NOT IDENTIFIED;

GRANT CREATE SEQUENCE TO RESOURCE;
GRANT CREATE TRIGGER TO RESOURCE;
GRANT CREATE CLUSTER TO RESOURCE;
GRANT CREATE PROCEDURE TO RESOURCE;
GRANT CREATE TYPE TO RESOURCE;
GRANT CREATE OPERATOR TO RESOURCE;
GRANT CREATE TABLE TO RESOURCE;
GRANT CREATE INDEXTYPE TO RESOURCE;


-- CONNECT  (Role)
--CREATE ROLE CONNECT NOT IDENTIFIED;

GRANT CREATE SESSION TO CONNECT;


--创建用户

CREATE USER SUDMDB
  IDENTIFIED BY admin888
  DEFAULT TABLESPACE SUDMDB
  TEMPORARY TABLESPACE TEMP
  PROFILE DEFAULT
  ACCOUNT UNLOCK;
  -- 分配角色
  GRANT RESOURCE TO SUDMDB;
  GRANT PUBLIC TO SUDMDB;
  GRANT CONNECT TO SUDMDB;
  GRANT DBA TO SUDMDB;
  GRANT AQ_ADMINISTRATOR_ROLE TO SUDMDB;
  GRANT JAVAUSERPRIV TO SUDMDB;
  GRANT JAVA_ADMIN TO SUDMDB;
  ALTER USER SUDMDB DEFAULT ROLE ALL;
  -- 分配系统权限
  GRANT CREATE VIEW TO SUDMDB;
  GRANT CREATE TABLE TO SUDMDB;
  GRANT UNLIMITED TABLESPACE TO SUDMDB;
  GRANT CREATE MATERIALIZED VIEW TO SUDMDB;
  GRANT GLOBAL QUERY REWRITE TO SUDMDB;


4.给用户SUDMDB授予dba的权限
    grant dba to monitor;
5.接下来的三条语句都与将DMP文件导入到指定表空间(SUDMDB的表空间SUDMDB)有关
    revoke unlimited tablespace from SUDMDB;
---    grant unlimited tablespace to SUDMDB;
      alter user monitor quota unlimited on SUDMDB;
      alter user SUDMDB quota 0 on system;
6.很重要的一步:删除sysman用户的一个JOB,不然导入的时候最后会报一个违反唯一性约束的错
  11G中sysman占用了JOB_ID是3
  查看系统job:select job from dba_jobs:
  删除job:以sysman登录sqlplus,首先执行:exec dbms_job.remove(3);
                                 再执行:commit;
 7.Imp导入(最后在cmd中执行(不要进入sqlplus))
imp SUDMDB/admin888@orcl file='C:\Users\Administrator\Desktop\山西\2016-6-21.dmp' fromuser=sudmdb touser=sudmdb



posted on 2016-06-23 10:28  邬兴亮  阅读(750)  评论(0编辑  收藏  举报

导航