Access数据库导入Oracle总结
2015-07-05 14:58
609 查看
Access数据库的文件是mdb文件。我们需要把mdb文件导入oracle中。下面我为大家总结一下有哪几种方法:
问题:导入到Oracle数据库后,如果源数据的表、字段都是小写,那么导入到Oracle中也是小写,最好在网上搜一下段程序,把表、字段小写都改成大写。这样以后用数据时会方便一点。
字段、表名全部改大写的语句:
begin
for t in (select table_name tn from user_tables where table_name <> upper(table_name)) loop
begin
for c in (select column_name cn from user_tab_columns where table_name=t.tn) loop
begin
execute immediate 'alter table "'||t.tn||'" rename column "'||c.cn||'" to '||c.cn;
exception
when others then
dbms_output.put_line(t.tn||'.'||c.cn||'已经存在');
end;
end loop;
execute immediate 'alter table "'||t.tn||'" rename to '||t.tn;
exception
when others then
dbms_output.put_line(t.tn||'已存在');
end;
end loop;
end;
一、使用Navicat for oracle软件。
此软件自带把mdb文件导入Oracle的功能。在此软件的导入向导里面。二、使用ODBC、PL/SQL工具。
先创建一个ODBC的数据源,连接到Oracle数据库上,然后用Access打开mdb文件。右击其中某个表。导出方式为ODBC数据源。选择刚才名为刚才建立的数据源。这种方式每次只能导入一张表。效率很低。问题:导入到Oracle数据库后,如果源数据的表、字段都是小写,那么导入到Oracle中也是小写,最好在网上搜一下段程序,把表、字段小写都改成大写。这样以后用数据时会方便一点。
字段、表名全部改大写的语句:
begin
for t in (select table_name tn from user_tables where table_name <> upper(table_name)) loop
begin
for c in (select column_name cn from user_tab_columns where table_name=t.tn) loop
begin
execute immediate 'alter table "'||t.tn||'" rename column "'||c.cn||'" to '||c.cn;
exception
when others then
dbms_output.put_line(t.tn||'.'||c.cn||'已经存在');
end;
end loop;
execute immediate 'alter table "'||t.tn||'" rename to '||t.tn;
exception
when others then
dbms_output.put_line(t.tn||'已存在');
end;
end loop;
end;
相关文章推荐
- oracle基本sql语句和函数详解
- 关于resetlogs
- oracle 中BETWEEN命令
- oracle coalesce函数
- oracle 中IN命令
- oracle 中AND OR 命令
- C#+Oracle:ATM自助取款机开发
- oracle 中用pl/sql编辑记录里面的值 for update
- oracle 中distinct 命令
- oracle中的日期加减法
- windows安装Oracle10G
- oracle中exp,imp的使用详解
- oracle中exp,imp的使用详解
- Oracle 注释
- Oracle ORA-01033: ORACLE initialization or shutdown in progress 错误解决办法
- oracle 存储过程详细介绍(创建,删除存储过程,参数传递等)
- sql2005与oracle服务器做链接服务器
- oracle vm virtualbox右ctrl切换显示模式
- 先记下来回头再看20150704(关于oracle导入数据)
- Oracle 跨库 查询 复制表数据 分布式查询