特急问题,imp一个表的问题,解决即给分,up有分!

comcy 2004-08-22 07:37:28
数据库有一个表的内容让我改了,
昨天有一个备份文件,但我不敢直接imp到正式数据库上,
我想先imp到另一个库(测试数据库,表,表结构都和正式库一样)上,再将这个表导入正式库
现在的问题是:
1)我不知道测试库system用户的密码,不允许imp
2)这个正式库的dmp文件能不能imp到另一个库(即这个测试库)?
有什么好办法?
...全文
219 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
cyicecream 2004-10-30
  • 打赏
  • 举报
回复
^_^
hongjun_han 2004-10-20
  • 打赏
  • 举报
回复
恭喜....
zonelive 2004-08-24
  • 打赏
  • 举报
回复
借助第三方工具试试
yanzimeimei 2004-08-24
  • 打赏
  • 举报
回复
恭喜....
comcy 2004-08-24
  • 打赏
  • 举报
回复
问题解决了,最后我找到了system的密码
lzyzlzy 2004-08-23
  • 打赏
  • 举报
回复
oracle中怎么用SQl文件创建表?
zyh888 2004-08-23
  • 打赏
  • 举报
回复
UP
rouqu 2004-08-23
  • 打赏
  • 举报
回复
up
luxuezhu 2004-08-23
  • 打赏
  • 举报
回复
1、可以使用其它的用户进行导入,但该用户必须具备必要地条件
2、可以
lijins 2004-08-23
  • 打赏
  • 举报
回复
学习中……
up
dinya2003 2004-08-23
  • 打赏
  • 举报
回复
让系统管理员授予你DBA的权限/
Quanj 2004-08-22
  • 打赏
  • 举报
回复
那你有对此对象表的select权限吧,通过select 语句转成csv文件,通过sqlldr导入;
或者通过工具toad另存为,再通过sqlldr导入;
或者通过sqlserver dts导出/导入;
或者用以下脚本(metalink)
set pagesize 0
-- This script dumps a table to a comma delimited ASCII file and
-- also builds a control file and a parameter file for SQL*Loader.

set trimspool on
set serverout on
clear buffer
undef dumpfile
undef dumptable
undef dumpowner
var maxcol number
var linelen number
var dumpfile char(40)
col column_id noprint
set pages 0 feed off termout on echo off verify off
accept dumpowner char prompt 'Owner of table to dump: '
accept dumptable char prompt 'Table to dump: '

begin
select max (column_id)
into :maxcol
from all_tab_columns
where table_name = rtrim (upper ('&dumptable')) and
owner = rtrim (upper ('&dumpowner'));

select sum (data_length) + (:maxcol * 3)
into :linelen
from all_tab_columns
where table_name = rtrim (upper ('&dumptable')) and
owner = rtrim (upper ('&dumpowner'));
end;
/

print linelen
print maxcol

spool dump.sql
select 'set trimspool on' from dual;
select 'set termout off pages 0 heading off echo off' from dual;
select 'set line '||:linelen from dual;
select 'spool '||lower ('&dumptable')||'.txt' from dual;
select 'select'||chr (10) from dual;
select ' '||''''||'"'||''''||'||'||
'replace ('||column_name||', '||''''||'"'||''''||') '||
' ||'||''''||'", '||''''||' || ', column_id
from all_tab_columns
where table_name = upper ('&dumptable') and
owner = upper ('&dumpowner') and
column_id < :maxcol
union
select ' '||''''||'"'||''''||'||'||
'replace ('||column_name||', '||''''||'"'||''''||') '||
' ||'||''''||'"'||'''', column_id
from all_tab_columns
where table_name = upper ('&dumptable') and
owner = upper ('&dumpowner') and
column_id = :maxcol
order by 2;
select 'from &dumpowner..&dumptable;' from dual;
select 'spool off' from dual;
spool off

-- Build a basic control file
set line 79
spool dtmp.sql
select 'spool '||lower ('&dumptable')||'.par' from dual;
spool off


select 'userid = /'||chr (10)||
'control = '||lower ('&dumptable')||'.ctl'||chr (10)||
'log = '||lower ('&dumptable')||'.log'||chr (10)||
'bad = '||lower ('&dumptable')||'.bad'||chr (10)
from dual;
spool off

spool dtmp.sql
select 'spool '||lower ('&dumptable')||'.ctl' from dual;
spool off

select 'load data'||chr(10)||
'infile '||''''||lower ('&dumptable')||'.txt'||''''||chr (10)||
'into table &dumptable'||chr (10)||
'fields terminated by '||''''||','||''''||
' optionally enclosed by '||''''||'"'||''''||chr (10)||'('
from dual;
select ' '||column_name||',', column_id
from all_tab_columns
where table_name = upper ('&dumptable') and
owner = upper ('&dumpowner') and
column_id < :maxcol
union
select ' '||column_name, column_id
from all_tab_columns
where table_name = upper ('&dumptable') and
owner = upper ('&dumpowner') and
column_id = :maxcol
order by 2;
select ')' from dual;
spool off
drabit 2004-08-22
  • 打赏
  • 举报
回复
让测试库的管理员赋予你dba权限
comcy 2004-08-22
  • 打赏
  • 举报
回复
我试过用备份正式库的用户身份导入,可是系统提示我:
“只有dba才能导入由其他dba导出的文件”

zealot_zk 2004-08-22
  • 打赏
  • 举报
回复
1:你可以使用其它的用户进行导入,然后测试
2:可以啊,你只要导出正式库的数据,然后在测试库上导入就可以了,但是表所在的表空间在测试库上一定要存在

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧