冬瓜茶饮料

NC 创建表空间数据库

1、首先创建表空间

CREATE SMALLFILE

    TABLESPACE "NNC_DATA01"

    LOGGING

    DATAFILE 'D:\NCOracle\nc633sd\NNC_DATA01.ora' SIZE 500M AUTOEXTEND

    ON NEXT  10M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL

    SEGMENT SPACE MANAGEMENT  AUTO ;

 

CREATE SMALLFILE

    TABLESPACE "NNC_DATA02"

    LOGGING

    DATAFILE 'D:\NCOracle\nc633sd\NNC_DATA02.ora' SIZE 500M AUTOEXTEND

    ON NEXT  10M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL

    SEGMENT SPACE MANAGEMENT  AUTO ;

 

 

CREATE SMALLFILE

    TABLESPACE "NNC_DATA03"

    LOGGING

    DATAFILE 'D:\NCOracle\nc633sd\NNC_DATA03.ora' SIZE 500M AUTOEXTEND

    ON NEXT  10M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL

    SEGMENT SPACE MANAGEMENT  AUTO ;

   

    CREATE SMALLFILE

    TABLESPACE "NNC_INDEX01"

    LOGGING

    DATAFILE 'D:\NCOracle\nc633sd\NNC_INDEX01.ora' SIZE 300M AUTOEXTEND

    ON NEXT  10M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL

    SEGMENT SPACE MANAGEMENT  AUTO ;

   

CREATE SMALLFILE

    TABLESPACE "NNC_INDEX02"

    LOGGING

    DATAFILE 'D:\NCOracle\nc633sd\NNC_INDEX02.ora' SIZE 300M AUTOEXTEND

    ON NEXT  10M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL

    SEGMENT SPACE MANAGEMENT  AUTO ;

   

CREATE SMALLFILE

    TABLESPACE "NNC_INDEX03"

    LOGGING

    DATAFILE 'D:\NCOracle\nc633sd\NNC_INDEX03.ora' SIZE 300M AUTOEXTEND

    ON NEXT  10M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL

SEGMENT SPACE MANAGEMENT  AUTO ;

 

2、创建用户

用系统管理员账号登陆,执行语句

CREATE user 用户名 IDENTIFIED BY 密码

赋予权限

grant dba to 用户名;

再执行数据泵还原目录语句

create or replace directory BACKUP

  as 'C:\app\admin\orcl\backup';

要先把数据库dmp文件放入此目录中

 

4、导入数据库

运行—CMD—>impdp nc633sd/nc633sd@orcl  DUMPFILE=20161109.DMP remap_schema=NC633_20160415:nc633sd directory=backup

 

>impdp 登陆用户名/密码@orcl  DUMPFILE=20161109.DMP remap_schema=导出数据库用户:导入数据用户 directory=backup

 

alter user username default tablespace userspace; 解释:以上语句就是说给username用户重新指定表空间为userspace;

扩展:创建用户的时候指定表空间。 sql:create user username identified by userpassword default tablespace userspace;

 

select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

posted on 2017-09-08 09:46  冬瓜茶饮料  阅读(801)  评论(1编辑  收藏  举报

导航