上一片中介绍了安装instantclient +plsql取代庞大客户端的安装,这里说下plsql的基本操作

plsql操作界面图:

1、复制表

语句:create table IGIS_COPY as select * from IGIS_LOCATION

2、查询前5行数据

select * from IGIS_LOCATION where rownum < 6

注意:与sql server的top 5 不同,前5行数据只能使用where rownum < 6

导出查询出来的数据。注意是.sql文件

下面是用txt打开上面导出的.sql文件,其原理是是对数据库进行insert

下面的数据表是

IGIS_LOCATION_COPY,是我将上面的
IGIS_LOCATION备份了一份,进行操作
prompt Importing table IGIS_LOCATION_COPY...
set feedback off
set define off
insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('001FF92FABE165', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('004999010640000', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('012963007793321', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013437006991011', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013789000795180', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); prompt Done.

3、导出整个表

右击表,点导出数据(或者单击工具--导出表)

选择第二个“SQL插入”,注意要选上:创建表,否者导出的.sql文件没有表结构,无法使用下一步中的“导入表”方法导入。

导出的.sql文件

prompt PL/SQL Developer import file
prompt Created on 2017年5月3日 by Administrator
set feedback off
set define off
prompt Creating IGIS_LOCATION_COPY...
create table IGIS_LOCATION_COPY
(
devicecode VARCHAR2(50) not null,
type VARCHAR2(10) not null,
longitude NUMBER(10,2) not null,
latitude NUMBER(10,2) not null,
datetime DATE not null
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
); prompt Disabling triggers for IGIS_LOCATION_COPY...
alter table IGIS_LOCATION_COPY disable all triggers;
prompt Deleting IGIS_LOCATION_COPY...
delete from IGIS_LOCATION_COPY;
commit;
prompt Loading IGIS_LOCATION_COPY...
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('001FF92FABE165', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('004999010640000', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('012963007793321', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('013437006991011', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('013789000795180', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('014583569411', 'car', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('049955', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('050846', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('050853', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
insert into IGIS_LOCATION_COPY (devicecode, type, longitude, latitude, datetime)
values ('050859', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss'));
commit;
prompt 10 records loaded
prompt Enabling triggers for IGIS_LOCATION_COPY...
alter table IGIS_LOCATION_COPY enable all triggers;
set feedback on
set define on
prompt Done.

4、导入整张表

单击 “工具”--“导入表”

SQL*Plus就是上一篇博文中介绍的下载了sqlplus,如果安装的时候没下载,参考上篇

http://www.cnblogs.com/lelehellow/p/6801800.html

5、导出表结构

单击 “工具”--“导出用户对象”

记得选中表

使用上一步中的“导入表”方法来导入这个.sql文件可以导入一张空表,表结构还是跟这张表一样的。

打开导出的用户对象 .sql文件,发现其实就是导出了创建表的sql语句。

----------------------------------------------------
-- Export file for user SYSTEM --
-- Created by Administrator on 2017-5-3, 13:09:02 --
---------------------------------------------------- set define off
spool guanxi.log prompt
prompt Creating table IGIS_LOCATION_COPY
prompt =================================
prompt
create table SYSTEM.IGIS_LOCATION_COPY
(
devicecode VARCHAR2(50) not null,
type VARCHAR2(10) not null,
longitude NUMBER(10,2) not null,
latitude NUMBER(10,2) not null,
datetime DATE not null
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
); spool off

6、使用“导入表”功能来导入第二步中导出的前5行数据

使用“导入表”功能来导入第二步中导出的前5行数据(.sql文件),发现导入无效。而第三步和第五步中同样是.sql文件,使用“导入表”功能都可以导入。

对边上面的.sql文件发现,其原因在于第二步中导出的.sql文件中没有定义表结构,也就是没有创建表。将其中的insert语句复制到第五步中的表结构sql文件中,就可以实现导入表了。

这样导入的表也就是只有原表中前5行数据的表了。

处理后的.sql文件如下:

----------------------------------------------------
-- Export file for user SYSTEM --
-- Created by Administrator on 2017-5-3, 13:09:02 --
---------------------------------------------------- set define off
spool guanxi.log prompt
prompt Creating table IGIS_LOCATION_COPY
prompt =================================
prompt
create table SYSTEM.IGIS_LOCATION_COPY
(
devicecode VARCHAR2(50) not null,
type VARCHAR2(10) not null,
longitude NUMBER(10,2) not null,
latitude NUMBER(10,2) not null,
datetime DATE not null
)
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('001FF92FABE165', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('004999010640000', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('012963007793321', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013437006991011', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); insert into IGIS_LOCATION_COPY (DEVICECODE, TYPE, LONGITUDE, LATITUDE, DATETIME)
values ('013789000795180', 'man', 121.12, 31.12, to_date('26-04-2017 14:29:05', 'dd-mm-yyyy hh24:mi:ss')); spool off

7、注意:假如发现自己使用plsql导出的表无法导入,极可能是因为在导出表的时候没有选上“创建表”这一项。上一步中的介绍可猜测,在导出前5行数据的时候,默认的没有创建表。

挂两个外链,管理员请不要删我文,如违规可联系我自行修改删除,QQ:919497132

苏州空调维修 苏州冰箱维修

plsql基本操作 复制表 导出表 导出表结构 及其导入的更多相关文章

  1. sql developer Oracle 数据库 用户对象下表及表结构的导入导出

    Oracle数据库表数据及结构的导入导出   导出的主机与即将导入到的目标主机的tablespace 及用户名需一直!!!!!

  2. Oracle中如何导出存储过程、函数、包和触发器的定义语句?如何导出表的结构?如何导出索引的创建语句?

    Oracle中如何导出存储过程.函数.包和触发器的定义语句?如何导出表的结构?如何导出索引的创建语句? QQ群里有人问:如何导出一个用户下的存储过程?   麦苗答:方法有多种,可以使用DBMS_MET ...

  3. 小甲鱼PE详解之输入表(导出表)详解(PE详解09)

    小甲鱼PE详解之输出表(导出表)详解(PE详解09) 当PE 文件被执行的时候,Windows 加载器将文件装入内存并将导入表(Export Table) 登记的动态链接库(一般是DLL 格式)文件一 ...

  4. 取PE文件的引入表和导出表

    直接上代码(这里列出C++和Delphi的代码),Delphi代码中包含导入及导出文件和函数列表,PE结构可参阅资料,很多很详细,需要注意的是,本例中是映射到内存,不是通过PE装载器装入的,所以对于节 ...

  5. MySQL 复制表结构

    200 ? "200px" : this.width)!important;} --> 介绍 有时候我们需要原封不动的复制一张表的表结构来生成一张新表,MYSQL提供了两种便 ...

  6. SQL复制表结构或表数据

    需求: 软件开发过程中,一般会部署两个数据库:一个测试数据库提供给开发和测试过程使用:一个运维数据库提供上线使用.当需求变化需增加表时,会遇到数据库表结构或表数据同步的问题,这时就要复制表结构或表数据 ...

  7. ORCALE复制表结构

    1.oracle 复制表结构 不要内容 create table 表1 as select * from 表2 where 1=2 2.oracle 复制表结构 要内容 create table 表1 ...

  8. mysql 复制表结构、表数据的方法

    From: http://blog.163.com/yaoyingying681@126/blog/static/109463675201191173221759/ MySQL 添加列,修改列,删除列 ...

  9. mysql复制表结构及检查表、存储过程是否存在

    mysql命令行复制表结构的方法: 1.只复制表结构到新表 CREATE TABLE 新表 SELECT * FROM 旧表 WHERE 1=2  或者 CREATE TABLE 新表 LIKE 旧表 ...

随机推荐

  1. C# 字符串中正则表达式的应用

    1.截取字符串中指定内容 {"weatherinfo":{"city":"北京","cityid":"1010 ...

  2. SVN使用—常用命令及避免冲突的方法

    一.SVN启动 [root@localhost ~]# mkdir /data/svn [root@localhost ~]# svnadmin create /data/svn/test [root ...

  3. 使用Angularjs开发Web App 视频课程 --麦子学院课程

    前往搓这里: http://www.maiziedu.com/group/common/course/3271/ 查看课程搓这里:http://www.maiziedu.com/course/web/ ...

  4. dubbo应用

    一.安装配置 cd /usr/local/ wget http://www.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar. ...

  5. spring security使用数据库验证的逻辑处理

    前面做了多个示例,包括使用jdbc和hibernate两种方式访问数据库获取用户信息和权限信息,其中一些关键步骤如下:   我们在SecurityConfig中配置覆盖configure方法时候,可以 ...

  6. SpringBoot2.0+ElasticSearch网盘搜索实现

    1.ES是如何实现分布式高并发全文检索 2.简单介绍ES分片Shards分片技术 3.为什么ES主分片对应的备分片不在同一台节点存放 4.索引的主分片定义好后为什么不能做修改 5.ES如何实现高可用容 ...

  7. bootstrap重置校验方法

    $(function (){ $("select").change(function(){ $('#DepartForm').bootstrapValidator('resetFo ...

  8. 内核hlist的使用

    struct hlist_head { struct hlist_node *first; }; struct hlist_node { struct hlist_node *next, **ppre ...

  9. spring cloud 基本小结

    Spring cloud系列十四 分布式链路监控Spring Cloud Sleuth https://blog.csdn.net/hry2015/article/details/78905489 S ...

  10. Spring -- 入门,装备集合,自动装配,分散装配,自定义编辑器

    1. 概要 struts2:web hibernate:持久化 spring:业务层.管理bean的,容器.List Map Set. 体验spring: 1.创建java项目. 2.引入spring ...