Home  >  Article  >  Database  >  用数据库语句创建表空间导入11G数据到10G

用数据库语句创建表空间导入11G数据到10G

WBOY
WBOYOriginal
2016-06-07 15:24:061412browse

查看表空间和数据文件的信息 select tablespace_name,file_name,ceil(bytes/1024/1024) mb from dba_data_files order by 1; 查看表空间空闲的 select s.tablespace_name 表空间, sum(s.bytes)/1024/1024 mb from dba_free_space s group by s.tablespace_na

查看表空间和数据文件的信息

select tablespace_name,file_name,ceil(bytes/1024/1024) mb
from dba_data_files order by 1;

查看表空间空闲的

select s.tablespace_name "表空间",
       sum(s.bytes)/1024/1024 mb
from dba_free_space s
group by s.tablespace_name
order by 2

创建表空间

CREATE TABLESPACE ecology LOGGING DATAFILE 'C:\oa_data\ecology.dbf'
SIZE 1024M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;


--修改大小
Alter database datafile ‘C:\oa_data\ecology.dbf’ resize 100m;

 

数据文件的自动扩展
select FILE_NAME,AUTOEXTENSIBLE,MAXBLOCKS,INCREMENT_BY from dba_data_files;
改为自动扩展
alter database datafile 'C:\oa_data\ecology.dbf' autoextend on next 1m maxsize 2048m;


--删除用户
drop user ecology cascade;
-- 创建用户
create user ecology
  identified by ecology
  default tablespace ECOLOGY;
-- Grant/Revoke role privileges
grant connect to ecology;
grant resource to ecology;
grant dba to ecology;

--连接测试
SQL> conn ecology/ecology
---测试创建表

SQL> create table xjy_test (my_id number);

---插入数据

insert into xjy_test values (1);

delete from xjy_test;

commit;


---导入数据文件

 

 

imp ecology/ecology fromuser=ecology touser=ecology file=20140513_2.dmp  log=20140513_2.log ignore=y

 

遇到问题11G不能导入10G

 

http://www.cnblogs.com/alxc/archive/2011/03/25/1995279.html

这个文章解决
--问题1
空表没有导入

   select table_name from user_tables where NUM_ROWS=0;


---执行以下语句


  select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0

 

--把生成的结果执行
alter table FNASYSTEMSET allocate extent;
alter table BUDGETAUTOMOVE allocate extent;
alter table TAKS_MAINLINETASK allocate extent;
alter table TASK_ATTENTION allocate extent;
 

---参考 http://vondon.iteye.com/blog/1316223

    exp 用户名/密码@数据库名 file=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log  

--EXP
 exp xxxx/xxxxxx owner=xxx file=xxxx.dmp

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn