oracle 建立表空间

create tablespace zshzxs_db   表空间名
logging
datafile 'F:\oracletablespace\zshzxs_data01.dbf'  //表空间对应的存储地方
size 500m     //初始大小200M
autoextend on 
next 100m maxsize 1500m  //当表空间不够的时候,一次增长100M,最大增长到1500M
extent management local;





PLSQL创建表空间-关联用户-DMP文件导入

1.创建表空间

create tablespace test datafile 'E:\oracle\product\10.2.0\oradata\orcl\test.dbf' size 200m autoextend on next 10m maxsize unlimited;

2.设置表空间自动增长

alter database datafile 'E:\oracle\product\10.2.0\oradata\orcl\test.dbf' autoextend on;

3.创建临时表空间

create temporary tablespace test_temp tempfile 'E:\oracle\product\10.2.0\oradata\orcl\test_temp.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;

4.创建用户

create user test identified by test default tablespace test temporary tablespace test_temp;

5.给用户授予权限

-- Grant/Revoke role privileges

grant connect,resource to test;

grant exp_full_database to test;

grant imp_full_database to test;

-- Grant/Revoke system privileges

grant create procedure to test;

grant create trigger to test;

grant execute any procedure to test;

grant grant any privilege to test;

grant restricted session to test;

grant select any table to test;

grant unlimited tablespace to test;

grant create any view to test;

6.删除表空间

drop tablespace testdb INCLUDING CONTENTS;

7.PLSQL导入dmp文件

工具----导入表

选择oracle导入

在 “从用户”的下拉框中选择 dmp的导出用户

在 “导入到”的下拉框中选择 要导入用户

在 “导入文件”处选择要导入的 dmp文件

点击导入

8.命令提示行导入dmp文件

首先询问对方数据库的表空间名称和大小,然后在你的oracle中建立相应表空间,最后使用imp命令导入数据:

imp username/password@SID file=XXX.dmp fromuser=XXX touser=XXX tables=(XXX,XXX)

  其中,fromuser若为多个表空间的话,使用()将其括起来:fromuser=(a,b);

  touser参数仿fromuser参数;

  若只导入一部分表,使用tables参数,用()括起要导入的表;如果想全部导入,不需要指定tables参数

  补充:

  1.要新建一个数据库;

  2.若你的oracle安装在Unix/Linux上,直接在shell中使用imp;如果你的oracle安装在Windows上,随便在哪里开启一个CMD窗口就可以执行imp;

  3.username/password指的是你的数据库的登录用户名和密码;

  4.fromuser指对方数据库用户名,touser指你的数据库的用户名;

  5.使用oracle的管理端在“表空间”中即可创建;

  6.要导入所有的表最方便,不用写tables参数就成,不需要知道对方的表名。

你可能感兴趣的:(oracle,linux,windows,unix,F#)